|
- #ifndef LIGHT_H
- #define LIGHT_H
- #include "item.h"
-
- class Light : public Item
- {
- public:
- Light(const QString &type);
- QRectF boundingRect() const override;
- void paint(QPainter *painter,
- const QStyleOptionGraphicsItem *option,
- QWidget *) override;
- bool state() const override;
- void addMenuActions(QMenu *menu) override;
- void handleMenuAction(QAction *action) override;
- void setCustomImage(const QString& imagePath);
- void setOnImage(const QString& imagePath);
- void setOffImage(const QString& imagePath);
- void loadImage();
-
- private:
- QString onImagePath_; // ON状态图片路径
- QString offImagePath_; // OFF状态图片路径
- QPixmap onPixmap_; // ON状态图片
- QPixmap offPixmap_; // OFF状态图片
- };
-
- #endif // LIGHT_H
|