author | LocutusOfBorg |
Mon, 12 Sep 2022 18:23:24 -0400 | |
branch | 1.0.0 |
changeset 15863 | d04f4a0af0fe |
parent 8434 | 4821897a0f10 |
permissions | -rw-r--r-- |
7130 | 1 |
#ifndef COLORWIDGET_H |
2 |
#define COLORWIDGET_H |
|
3 |
||
7749
edad8a7bcaea
Convert ColorWidget from QWidget to QFrame and make use of The Box Model(tm) in stylesheet
unc0rr
parents:
7130
diff
changeset
|
4 |
#include <QFrame> |
7130 | 5 |
#include <QModelIndex> |
6 |
||
7 |
namespace Ui { |
|
8 |
class ColorWidget; |
|
9 |
} |
|
10 |
||
11 |
class QStandardItemModel; |
|
12 |
||
7749
edad8a7bcaea
Convert ColorWidget from QWidget to QFrame and make use of The Box Model(tm) in stylesheet
unc0rr
parents:
7130
diff
changeset
|
13 |
class ColorWidget : public QFrame |
7130 | 14 |
{ |
15 |
Q_OBJECT |
|
8434 | 16 |
|
7130 | 17 |
public: |
18 |
explicit ColorWidget(QStandardItemModel *colorsModel, QWidget *parent = 0); |
|
19 |
~ColorWidget(); |
|
20 |
||
21 |
void setColors(QStandardItemModel * colorsModel); |
|
22 |
void setColor(int color); |
|
23 |
int getColor(); |
|
24 |
||
25 |
signals: |
|
26 |
void colorChanged(int color); |
|
8434 | 27 |
|
7130 | 28 |
private: |
29 |
int m_color; |
|
30 |
QStandardItemModel * m_colorsModel; |
|
31 |
||
32 |
private slots: |
|
33 |
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); |
|
34 |
||
35 |
protected: |
|
36 |
void mousePressEvent(QMouseEvent * event); |
|
37 |
void wheelEvent(QWheelEvent * event); |
|
7750
31e4f6c1834b
small tweak. (reverse mouse wheel directions for color change)
sheepluva
parents:
7749
diff
changeset
|
38 |
void nextColor(); |
31e4f6c1834b
small tweak. (reverse mouse wheel directions for color change)
sheepluva
parents:
7749
diff
changeset
|
39 |
void previousColor(); |
7130 | 40 |
}; |
41 |
||
42 |
#endif // COLORWIDGET_H |