Changeset View
Changeset View
Standalone View
Standalone View
src/dcc/whiteboardcolorchooser.cpp
Show All 27 Lines | 26 | : QFrame(parent), | |||
---|---|---|---|---|---|
28 | m_backgroundColor(Qt::white), | 28 | m_backgroundColor(Qt::white), | ||
29 | m_swapPixmap(16,16) | 29 | m_swapPixmap(16,16) | ||
30 | { | 30 | { | ||
31 | setFrameStyle(QFrame::NoFrame | QFrame::Plain); | 31 | setFrameStyle(QFrame::NoFrame | QFrame::Plain); | ||
32 | setMinimumSize(40,40); | 32 | setMinimumSize(40,40); | ||
33 | drawSwapPixmap(); | 33 | drawSwapPixmap(); | ||
34 | } | 34 | } | ||
35 | 35 | | |||
36 | WhiteBoardColorChooser::~WhiteBoardColorChooser() | 36 | WhiteBoardColorChooser::~WhiteBoardColorChooser() = default; | ||
37 | { | | |||
38 | } | | |||
39 | 37 | | |||
40 | QColor WhiteBoardColorChooser::color(const ColorLayer& layer) const | 38 | QColor WhiteBoardColorChooser::color(const ColorLayer& layer) const | ||
41 | { | 39 | { | ||
42 | switch (layer) | 40 | switch (layer) | ||
43 | { | 41 | { | ||
44 | case BackgroundColor: | 42 | case BackgroundColor: | ||
45 | return m_backgroundColor; | 43 | return m_backgroundColor; | ||
46 | case ForegroundColor: | 44 | case ForegroundColor: | ||
▲ Show 20 Lines • Show All 94 Lines • ▼ Show 20 Line(s) | 134 | { | |||
141 | 139 | | |||
142 | tPaint.drawPixmap(swapPixmapRect().topLeft(), m_swapPixmap); | 140 | tPaint.drawPixmap(swapPixmapRect().topLeft(), m_swapPixmap); | ||
143 | QRect bgRect = backgroundRect(); | 141 | QRect bgRect = backgroundRect(); | ||
144 | QRect bgRectInside = QRect(bgRect.x () + 2, bgRect.y () + 2, | 142 | QRect bgRectInside = QRect(bgRect.x () + 2, bgRect.y () + 2, | ||
145 | bgRect.width () - 4, bgRect.height () - 4); | 143 | bgRect.width () - 4, bgRect.height () - 4); | ||
146 | tPaint.fillRect(bgRectInside, m_backgroundColor); | 144 | tPaint.fillRect(bgRectInside, m_backgroundColor); | ||
147 | qDrawShadePanel(&tPaint, bgRect, palette(), | 145 | qDrawShadePanel(&tPaint, bgRect, palette(), | ||
148 | false/*not sunken*/, 2/*lineWidth*/, | 146 | false/*not sunken*/, 2/*lineWidth*/, | ||
149 | 0/*never fill*/); | 147 | nullptr/*never fill*/); | ||
150 | 148 | | |||
151 | QRect fgRect = foregroundRect(); | 149 | QRect fgRect = foregroundRect(); | ||
152 | QRect fgRectInside = QRect(fgRect.x () + 2, fgRect.y () + 2, | 150 | QRect fgRectInside = QRect(fgRect.x () + 2, fgRect.y () + 2, | ||
153 | fgRect.width () - 4, fgRect.height () - 4); | 151 | fgRect.width () - 4, fgRect.height () - 4); | ||
154 | tPaint.fillRect(fgRectInside, m_foregroundColor); | 152 | tPaint.fillRect(fgRectInside, m_foregroundColor); | ||
155 | qDrawShadePanel(&tPaint, fgRect, palette (), | 153 | qDrawShadePanel(&tPaint, fgRect, palette (), | ||
156 | false/*not sunken*/, 2/*lineWidth*/, | 154 | false/*not sunken*/, 2/*lineWidth*/, | ||
157 | 0/*never fill*/); | 155 | nullptr/*never fill*/); | ||
158 | 156 | | |||
159 | tPaint.end(); | 157 | tPaint.end(); | ||
160 | } | 158 | } | ||
161 | 159 | | |||
162 | void WhiteBoardColorChooser::resizeEvent(QResizeEvent *e) | 160 | void WhiteBoardColorChooser::resizeEvent(QResizeEvent *e) | ||
163 | { | 161 | { | ||
164 | Q_UNUSED(e); | 162 | Q_UNUSED(e); | ||
165 | const int minWidthHeight = qMin(width(),height()); | 163 | const int minWidthHeight = qMin(width(),height()); | ||
▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines |