target.h
来自「Qt4源代码,详细介绍了Qt4编程中的范例」· C头文件 代码 · 共 47 行
H
47 行
#ifndef TARGET_H#define TARGET_H#include <QGraphicsItem>#include <QObject>class Target : public QObject, public QGraphicsItem{ Q_OBJECTpublic: Target(); Target(qreal speed, qreal course, short type, short attribute); QRectF boundingRect() const; void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);public: qreal m_course; qreal m_speed; short m_type; // surface, undersurface, air short m_attribute; // friend, foe, unknown QColor m_color; protected: void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); void mousePressEvent(QGraphicsSceneMouseEvent * event); void dragEnterEvent(QGraphicsSceneDragDropEvent * event); void dragMoveEvent(QGraphicsSceneDragDropEvent * event); void dropEvent(QGraphicsSceneDragDropEvent * event);private: enum Attr { Foe, Us, Unknown }; enum Type { Surface, UnderSurface, Air };};#endif
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?