Diffstat (limited to 'noncore/graphics/drawpad/colorpanel.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/colorpanel.cpp | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/noncore/graphics/drawpad/colorpanel.cpp b/noncore/graphics/drawpad/colorpanel.cpp index 1db0d7b..9327012 100644 --- a/noncore/graphics/drawpad/colorpanel.cpp +++ b/noncore/graphics/drawpad/colorpanel.cpp | |||
@@ -22,40 +22,25 @@ ColorPanelButton::ColorPanelButton(const QColor& color, QWidget* parent, const c | |||
22 | m_color = color; | 22 | m_color = color; |
23 | 23 | ||
24 | setFixedSize(16, 16); | 24 | setFixedSize(16, 16); |
25 | setActive(false); | 25 | setFrameStyle(NoFrame); |
26 | } | 26 | } |
27 | 27 | ||
28 | ColorPanelButton::~ColorPanelButton() | 28 | ColorPanelButton::~ColorPanelButton() |
29 | { | 29 | { |
30 | } | 30 | } |
31 | 31 | ||
32 | void ColorPanelButton::setActive(bool active) | ||
33 | { | ||
34 | m_active = active; | ||
35 | |||
36 | if (m_active) { | ||
37 | setFrameStyle(Panel | Sunken); | ||
38 | } else { | ||
39 | setFrameStyle(NoFrame); | ||
40 | } | ||
41 | } | ||
42 | |||
43 | void ColorPanelButton::enterEvent(QEvent* e) | 32 | void ColorPanelButton::enterEvent(QEvent* e) |
44 | { | 33 | { |
45 | Q_UNUSED(e) | 34 | Q_UNUSED(e) |
46 | 35 | ||
47 | if (!m_active) { | 36 | setFrameStyle(Panel | Sunken); |
48 | setFrameStyle(Panel | Sunken); | ||
49 | } | ||
50 | } | 37 | } |
51 | 38 | ||
52 | void ColorPanelButton::leaveEvent(QEvent* e) | 39 | void ColorPanelButton::leaveEvent(QEvent* e) |
53 | { | 40 | { |
54 | Q_UNUSED(e) | 41 | Q_UNUSED(e) |
55 | 42 | ||
56 | if (!m_active) { | 43 | setFrameStyle(NoFrame); |
57 | setFrameStyle(NoFrame); | ||
58 | } | ||
59 | } | 44 | } |
60 | 45 | ||
61 | void ColorPanelButton::paintEvent(QPaintEvent* e) | 46 | void ColorPanelButton::paintEvent(QPaintEvent* e) |
@@ -125,6 +110,7 @@ void ColorPanel::addColor(const QColor& color, int row, int col) | |||
125 | { | 110 | { |
126 | ColorPanelButton* panelButton = new ColorPanelButton(color, this); | 111 | ColorPanelButton* panelButton = new ColorPanelButton(color, this); |
127 | connect(panelButton, SIGNAL(selected(const QColor&)), this, SLOT(buttonSelected(const QColor&))); | 112 | connect(panelButton, SIGNAL(selected(const QColor&)), this, SLOT(buttonSelected(const QColor&))); |
113 | |||
128 | m_pGridLayout->addWidget(panelButton, row, col); | 114 | m_pGridLayout->addWidget(panelButton, row, col); |
129 | } | 115 | } |
130 | 116 | ||