Kontron KTAM3874-pITX Manual de usuario Pagina 184

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 293
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 183
KTD-S0057-I Page 180 Linux® Programming Examples (DebianTM)
KTAM3874/pITX Software Guide
QRectF boundingRect () const;
QPainterPath shape () const;
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
protected:
void advance (int step);
private:
qreal angle;
qreal speed;
qreal mouseEyeDirection;
QColor color;
};
#endif
File mouse.cpp
(header with Qt
TM
license see 'main.cpp'):
#include <QtGui/QGraphicsScene>
#include <QtGui/QPainter>
#include <QtGui/QStyleOption>
#include <math.h>
#include "mouse.h"
static const double Pi = 3.14159265358979323846264338327950288419717;
static double TwoPi = 2.0 * Pi;
static qreal normalizeAngle (qreal angle)
{
while (angle < 0)
angle += TwoPi;
while (angle > TwoPi)
angle -= TwoPi;
return angle;
}
Mouse::Mouse ()
: angle (0), speed (0), mouseEyeDirection (0), color (qrand () % 256, qrand () % 256, qrand () % 256)
{
setRotation (qrand () % (360 * 16));
}
QRectF Mouse::boundingRect () const
{
qreal adjust = 0.5;
return QRectF (-18 - adjust, -22 - adjust, 36 + adjust, 60 + adjust);
}
Vista de pagina 183
1 2 ... 179 180 181 182 183 184 185 186 187 188 189 ... 292 293

Comentarios a estos manuales

Sin comentarios