MCPcopy Create free account
hub / github.com/LMMS/lmms / drawPrimitive

Method drawPrimitive

src/gui/LmmsStyle.cpp:200–308  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198
199
200void LmmsStyle::drawPrimitive( PrimitiveElement element,
201 const QStyleOption *option, QPainter *painter,
202 const QWidget *widget) const
203{
204 if( element == QStyle::PE_Frame ||
205 element == QStyle::PE_FrameLineEdit ||
206 element == QStyle::PE_PanelLineEdit )
207 {
208 const QRect rect = option->rect;
209
210 QColor black = QColor( 0, 0, 0 );
211 QColor shadow = option->palette.shadow().color();
212 QColor highlight = option->palette.highlight().color();
213
214 int a100 = 165;
215 int a75 = static_cast<int>( a100 * .75 );
216 int a50 = static_cast<int>( a100 * .6 );
217 int a25 = static_cast<int>( a100 * .33 );
218
219 QLine lines[4];
220 QPoint points[4];
221
222 // black inside lines
223 // 50%
224 black.setAlpha(a100);
225 painter->setPen(QPen(black, 0));
226 lines[0] = QLine(rect.left() + 2, rect.top() + 1,
227 rect.right() - 2, rect.top() + 1);
228 lines[1] = QLine(rect.left() + 2, rect.bottom() - 1,
229 rect.right() - 2, rect.bottom() - 1);
230 lines[2] = QLine(rect.left() + 1, rect.top() + 2,
231 rect.left() + 1, rect.bottom() - 2);
232 lines[3] = QLine(rect.right() - 1, rect.top() + 2,
233 rect.right() - 1, rect.bottom() - 2);
234 painter->drawLines(lines, 4);
235
236 // black inside dots
237 black.setAlpha(a50);
238 painter->setPen(QPen(black, 0));
239 points[0] = QPoint(rect.left() + 2, rect.top() + 2);
240 points[1] = QPoint(rect.left() + 2, rect.bottom() - 2);
241 points[2] = QPoint(rect.right() - 2, rect.top() + 2);
242 points[3] = QPoint(rect.right() - 2, rect.bottom() - 2);
243 painter->drawPoints(points, 4);
244
245
246 // outside lines - shadow
247 // 100%
248 shadow.setAlpha(a75);
249 painter->setPen(QPen(shadow, 0));
250 lines[0] = QLine(rect.left() + 2, rect.top(),
251 rect.right() - 2, rect.top());
252 lines[1] = QLine(rect.left(), rect.top() + 2,
253 rect.left(), rect.bottom() - 2);
254 painter->drawLines(lines, 2);
255
256 // outside corner dots - shadow
257 // 75%

Callers 7

paintEventMethod · 0.80
paintEventMethod · 0.80
paintEventMethod · 0.80
paintEventMethod · 0.80
paintEventMethod · 0.80
paintEventMethod · 0.80
paintEventMethod · 0.80

Calls 3

leftMethod · 0.80
rightMethod · 0.80
colorMethod · 0.45

Tested by

no test coverage detected