Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwindecoration/declarative-plugin/previewbutton.cpp
Show All 18 Lines | |||||
19 | */ | 19 | */ | ||
20 | #include "previewbutton.h" | 20 | #include "previewbutton.h" | ||
21 | #include "previewbridge.h" | 21 | #include "previewbridge.h" | ||
22 | #include "previewclient.h" | 22 | #include "previewclient.h" | ||
23 | #include "previewsettings.h" | 23 | #include "previewsettings.h" | ||
24 | 24 | | |||
25 | #include <KDecoration2/Decoration> | 25 | #include <KDecoration2/Decoration> | ||
26 | 26 | | |||
27 | #include <QDebug> | 27 | #include <QPainter> | ||
28 | 28 | | |||
29 | namespace KDecoration2 | 29 | namespace KDecoration2 | ||
30 | { | 30 | { | ||
31 | 31 | | |||
32 | namespace Preview | 32 | namespace Preview | ||
33 | { | 33 | { | ||
34 | 34 | | |||
35 | PreviewButtonItem::PreviewButtonItem(QQuickItem* parent) | 35 | PreviewButtonItem::PreviewButtonItem(QQuickItem* parent) | ||
▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Line(s) | 123 | { | |||
127 | m_button->setGeometry(QRect(0, 0, width(), height())); | 127 | m_button->setGeometry(QRect(0, 0, width(), height())); | ||
128 | } | 128 | } | ||
129 | 129 | | |||
130 | void PreviewButtonItem::paint(QPainter *painter) | 130 | void PreviewButtonItem::paint(QPainter *painter) | ||
131 | { | 131 | { | ||
132 | if (!m_button) { | 132 | if (!m_button) { | ||
133 | return; | 133 | return; | ||
134 | } | 134 | } | ||
135 | m_button->paint(painter, QRect(0, 0, width(), height())); | 135 | QRect size { 0, 0, (int)width(), (int)height() }; | ||
136 | m_button->paint(painter, size); | ||||
137 | painter->setCompositionMode(QPainter::CompositionMode_SourceAtop); | ||||
138 | painter->fillRect(size, m_color); | ||||
139 | } | ||||
140 | | ||||
141 | void PreviewButtonItem::setColor(const QColor color) | ||||
142 | { | ||||
143 | m_color = color; | ||||
144 | m_color.setAlpha(127); | ||||
145 | update(); | ||||
zzag: Doesn't QQuickItem have size() method? | |||||
Everything else can take/return real, but DecorationButton::paint() can only take a QReal so I thought to reduce conversions this way vpilo: Everything else can take/return real, but DecorationButton::paint() can only take a QReal so I… | |||||
136 | } | 146 | } | ||
137 | 147 | | |||
138 | } | 148 | } | ||
139 | } | 149 | } |
Doesn't QQuickItem have size() method?