📄 axbouncer.h
字号:
#ifndef AXBOUNCER_H#define AXBOUNCER_H#include <QAxBindable>#include <QWidget>class AxBouncer : public QWidget, public QAxBindable{ Q_OBJECT Q_ENUMS(SpeedValue) Q_PROPERTY(QColor color READ color WRITE setColor) Q_PROPERTY(SpeedValue speed READ speed WRITE setSpeed) Q_PROPERTY(int radius READ radius WRITE setRadius) Q_PROPERTY(bool running READ isRunning)public: enum SpeedValue { Slow, Normal, Fast }; AxBouncer(QWidget *parent = 0); void setSpeed(SpeedValue newSpeed); SpeedValue speed() const { return ballSpeed; } void setRadius(int newRadius); int radius() const { return ballRadius; } void setColor(const QColor &newColor); QColor color() const { return ballColor; } bool isRunning() const { return myTimerId != 0; } QSize sizeHint() const; QAxAggregated *createAggregate();public slots: void start(); void stop();signals: void bouncing();protected: void paintEvent(QPaintEvent *event); void timerEvent(QTimerEvent *event);private: int intervalInMilliseconds() const; QColor ballColor; SpeedValue ballSpeed; int ballRadius; int myTimerId; int x; int delta;};#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -