Ktam3874/pitx software guide, New file main.h (header with qt, License see 'main.cpp') – Kontron KTAM3874-pITX User Manual

Page 191

Advertising
background image

KTD-S0057-I

Page 187 Linux® Programming Examples (DebianTM)


KTAM3874/pITX Software Guide


trans = rootState->addTransition (randomButton, SIGNAL (pressed ()), randomState);

trans->addAnimation

(group);

trans = rootState->addTransition (tiledButton, SIGNAL (pressed ()), tiledState);

trans->addAnimation

(group);

trans = rootState->addTransition (centeredButton, SIGNAL (pressed ()), centeredState);

trans->addAnimation

(group);

QTimer

timer;

timer.start

(125);

timer.setSingleShot

(true);

trans = rootState->addTransition (&timer, SIGNAL (timeout ()), ellipseState);

trans->addAnimation

(group);

states.start

();

#ifdef QT_KEYPAD_NAVIGATION
QApplication::setNavigationMode

(Qt::NavigationModeCursorAuto);

#endif

return app.exec ();

}


New file main.h (header with Qt

TM

license see 'main.cpp'):

#include <QtGui/QtGui>
/* #include <QtCore/qstate.h> */


class Pixmap : public QObject, public QGraphicsPixmapItem
{
Q_OBJECT

Q_PROPERTY (QPointF pos READ pos WRITE setPos)

public:

Pixmap (const QPixmap &pix)

: QObject (), QGraphicsPixmapItem (pix)

{

setCacheMode

(DeviceCoordinateCache);

}
};

class Button : public QGraphicsWidget
{
Q_OBJECT
public:

Button (const QPixmap &pixmap, QGraphicsItem *parent = 0)

: QGraphicsWidget (parent), _pix (pixmap)

{

setAcceptHoverEvents

(true);

setCacheMode

(DeviceCoordinateCache);

}

QRectF boundingRect () const

{

return QRectF (-65, -65, 130, 130);

}

Advertising
This manual is related to the following products: