Monday, September 28, 2009

Qt OpenGL in QGraphicsItem

I was working on trying to use OpenGL facilities in my graphics View ..As I am more into animations I was looking for QGraphicsItem to be on similar lines for OpenGL widget also.

The scan over the web always pushed me to use setViewPort on GraphicsView for OpenGL widget...but alas this was not tht was gonna help me...

Also Qt 4.6 follow ups made sure that I got to look at ideas of extending QGraphicsItem and QObject together to create my own needed OpenGL Graphics Item...

I will put here what I acheived from Qt 4.6 guys and am working on customising this more for OpenGL item support...


Here s the code snippet that can help having OpenGL widget as QGraphicsItem




OGMainWindow::OGMainWindow(QWidget *parent)
: QMainWindow(parent), ui(new Ui::OGMainWindow)
{
ui->setupUi(this);

ui->graphicsView->setScene(&scene);
GLWidget *glWidget= new GLWidget();


QImage image=QImage(":/img/auxpoint.png");

QGraphicsItem *gitem=new QGraphicsPixmapItem(QPixmap::fromImage(image));

scene.addItem(gitem);

//Custom Item can be similar to QGraphicsWidgetItem
CusotmItem *glItem = new CusotmItem(glWidget);
scene.addItem(glItem);

}

Sunday, September 27, 2009

Extending Qt Animation

Recently working with Qt Animation Framework I realised that though QVariantAnimation has property for setting easing curve to Custom type .

However this custom graph style doesnt really help the animation to follow graph of user s choice as the function pointer behind expects a definition like

qreal customFunc( qreal time) ;

where time t element of [0,1]  closed interval

also the return value is progress normalised between [0,1].

To support custom graph style that does have more parameters varying rather than just time one needs to extend QtVariantAnimation or QtPropertyAnimation.

I extended from QtPropertyAnimation for my CustomAnimation class something like..
class CustomAnimation : public QtPropertyAnimation

{

Q_OBJECT

public:

qreal a1Value() const;

void seta1Value(const qreal value);

...

QString style();

void setStyle(QString style);

CustomAnimation(QObject *parent = 0);

CustomAnimation(QObject *target, const QByteArray &propertyName, QObject *parent = 0);

~ CustomAnimation();

void updateCurrentValue(const qreal value);

void updateState(QtAbstractAnimation::State oldState, QtAbstractAnimation::State newState);

void updateCurrentTime(int msecs);

private:

qreal a1;

QString curveStyle;

Q_DISABLE_COPY(CustomAnimation);

};


Monday, August 11, 2008

JiGrahak Mobility Solutions Interview

Hey ppl

if u lukin for some info in how to come through the 4-5-6 rounds of technical interview with this organisation.I am putting up whatever I remember with them ...The last round was with CEO and he is a cool guy to talk after the technical rounds :) .

Be Prepared for finding the most effecient solutions for a given problem with slight bit of how to get it from maths.
For java ppl its good to know collections design patterns and good programming practices as in concepts slightly more than just basic....but thats okay given that I have been working with java technologies for more than 3yrs now.

Anyhelp more put your comments I will try to follow up.

hp it hlps
avi(A14)

Monday, March 31, 2008

google interview

I had first round of telephonic interview with google and the questions asked were not very tough though it was very much mathematical ...just be good with the data structures that will be suffice for 1st round ...it was more on finding complexities and kind of mathmetical puzzle coded in c...so hv fun wid algorithms it ll help...!!!