|
24 | 24 |
|
25 | 25 | #include "RDStyle.h"
|
26 | 26 | #include <QAbstractItemView>
|
| 27 | +#include <QBitmap> |
27 | 28 | #include <QComboBox>
|
28 | 29 | #include <QCommonStyle>
|
29 | 30 | #include <QDebug>
|
@@ -130,6 +131,16 @@ void start(QAbstractAnimation *anim)
|
130 | 131 | RDStyle::RDStyle(ColorScheme scheme) : RDTweakedNativeStyle(new QCommonStyle())
|
131 | 132 | {
|
132 | 133 | m_Scheme = scheme;
|
| 134 | + |
| 135 | + const uchar bits[] = { |
| 136 | + 0x19, // X..XX |
| 137 | + 0x1C, // ..XXX |
| 138 | + 0x0E, // .XXX. |
| 139 | + 0x07, // XXX.. |
| 140 | + 0x13, // XX..X |
| 141 | + }; |
| 142 | + |
| 143 | + m_PartialCheckPattern = QBitmap::fromData(QSize(5, 5), bits); |
133 | 144 | }
|
134 | 145 |
|
135 | 146 | RDStyle::~RDStyle()
|
@@ -1271,7 +1282,15 @@ void RDStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *opt, Q
|
1271 | 1282 | rect = rect.adjusted(2, 2, -1, -1);
|
1272 | 1283 |
|
1273 | 1284 | if(opt->state & State_On)
|
| 1285 | + { |
1274 | 1286 | p->fillRect(rect, opt->palette.brush(QPalette::ButtonText));
|
| 1287 | + } |
| 1288 | + else if(opt->state & State_NoChange) |
| 1289 | + { |
| 1290 | + QBrush brush = opt->palette.brush(QPalette::ButtonText); |
| 1291 | + brush.setTexture(m_PartialCheckPattern); |
| 1292 | + p->fillRect(rect, brush); |
| 1293 | + } |
1275 | 1294 |
|
1276 | 1295 | p->restore();
|
1277 | 1296 |
|
@@ -1385,7 +1404,15 @@ void RDStyle::drawControl(ControlElement control, const QStyleOption *opt, QPain
|
1385 | 1404 | rect = rect.adjusted(2, 2, -1, -1);
|
1386 | 1405 |
|
1387 | 1406 | if(opt->state & State_On)
|
| 1407 | + { |
1388 | 1408 | p->fillRect(rect, opt->palette.brush(QPalette::ButtonText));
|
| 1409 | + } |
| 1410 | + else if(opt->state & State_NoChange) |
| 1411 | + { |
| 1412 | + QBrush brush = opt->palette.brush(QPalette::ButtonText); |
| 1413 | + brush.setTexture(m_PartialCheckPattern); |
| 1414 | + p->fillRect(rect, brush); |
| 1415 | + } |
1389 | 1416 |
|
1390 | 1417 | p->restore();
|
1391 | 1418 |
|
|
0 commit comments