123456789101112131415161718192021222324252627282930313233343536373839 |
- #ifndef CLICKABLELABEL_H
- #define CLICKABLELABEL_H
- #include <QObject>
- #include <QWidget>
- #include <QLabel>
- #include <QMouseEvent>
- class MenuEntry : public QLabel {
- Q_OBJECT
- public:
- explicit MenuEntry(QWidget* parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
- ~MenuEntry();
- static MenuEntry *getActiveLabel();
- static void setActiveLabel(MenuEntry *label);
- static MenuEntry *getHoverLabel();
- static void setHoverLabel(MenuEntry *label);
- signals:
- void clicked();
- void active_label_changed();
- void hover_label_changed();
- protected:
- void mousePressEvent(QMouseEvent* event);
- void mouseMoveEvent(QMouseEvent *event) override;
- private slots:
- void on_clicked();
- private:
- static MenuEntry *active_label;
- static MenuEntry *hover_label;
- const QString default_stylesheet = "color:rgb(255, 255, 255);\nfont:15px \"Trebuchet MS\";";
- const QString active_stylesheet = "color:rgb(200, 200, 200);\nfont:15px \"Trebuchet MS\";";
- };
- #endif // CLICKABLELABEL_H
|