44 #if !defined(QT_NO_STYLE_WINDOWSCE) || defined(QT_PLUGIN) 85 bool doRestore =
false;
92 (widget && qobject_cast<QToolBar*>(widget->
parentWidget())) ||
94 #ifndef QT_NO_DOCKWIDGET 95 (widget && widget->
inherits(
"QDockWidgetTitleButton")) ||
114 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
116 QRect rect = tab->rect;
122 for(
int jags = 1; jags <= count; ++jags, rtl = !rtl)
126 painter->
setBrush(tab->palette.background());
131 #endif //QT_NO_TABBAR 132 #ifndef QT_NO_TOOLBAR 165 #endif // QT_NO_TOOLBAR 167 #ifndef QT_NO_DOCKWIDGET 168 if (widget && widget->
inherits(
"QDockWidgetTitleButton")) {
170 if (dw->isFloating()){
177 #endif // QT_NO_DOCKWIDGET 226 panel ? &fill : 0); ;
236 if (
const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
237 QRect fr = frame->rect;
238 painter->
setPen(frame->palette.shadow().color());
276 linearGradient.
setColorAt(0, windowsCECheckBoxGradientColorBegin);
277 linearGradient.
setColorAt(1, windowsCECheckBoxGradientColorEnd);
290 xx = option->
rect.
x() + 4;
291 yy = option->
rect.
y() + 6;
292 for (i = 0; i < 4; ++i) {
293 lines[i] =
QLineF(xx, yy, xx, yy + arrowSize);
298 for (i = 4; i < 9; ++i) {
299 lines[i] =
QLineF(xx, yy, xx, yy + arrowSize);
319 option->
rect.
height() - 2, 40 * 16, 180 * 16);
339 if (
const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
352 }
else if (flags & (
State_Raised | State_Sunken | State_On | State_Sunken)) {
364 rect.
adjust(0, 0, -1, -1);
373 int step = (br.
width() + 4) / 5;
374 painter->
fillRect(br.
x() + offset, br.
y() + offset +br.
height() / 2 - step / 2,
378 painter->
fillRect(br.
x() + br.
width() / 2 - step / 2 + offset, br.
y() + offset+4,
388 points[0] =
QPoint(-2, -4);
389 points[1] =
QPoint(-2, 2);
390 points[2] =
QPoint(-1, -3);
391 points[3] =
QPoint(-1, 1);
392 points[4] =
QPoint(0, -2);
394 points[6] =
QPoint(1, -1);
397 points[0] =
QPoint(0, -4);
399 points[2] =
QPoint(-1, -3);
400 points[3] =
QPoint(-1, 1);
401 points[4] =
QPoint(-2, -2);
402 points[5] =
QPoint(-2, 0);
403 points[6] =
QPoint(-3, -1);
415 painter->
drawLine(points[0], points[1]);
416 painter->
drawLine(points[2], points[3]);
417 painter->
drawLine(points[4], points[5]);
423 painter->
drawLine(points[0], points[1]);
424 painter->
drawLine(points[2], points[3]);
425 painter->
drawLine(points[4], points[5]);
429 painter->
drawLine(points[0], points[1]);
430 painter->
drawLine(points[2], points[3]);
431 painter->
drawLine(points[4], points[5]);
446 points[0] =
QPoint(-4, 2);
448 points[2] =
QPoint(-3, 1);
450 points[4] =
QPoint(-2, 0);
452 points[6] =
QPoint(-1, -1);
453 points[7] =
QPoint(1, -1);
454 points[8] =
QPoint(0, -2);
458 points[0] =
QPoint(-4, -2);
459 points[1] =
QPoint(4, -2);
460 points[2] =
QPoint(-3, -1);
461 points[3] =
QPoint(3, -1);
462 points[4] =
QPoint(-2, 0);
464 points[6] =
QPoint(-1, 1);
469 points[0] =
QPoint(-3, -4);
470 points[1] =
QPoint(-3, 4);
471 points[2] =
QPoint(-2, -3);
472 points[3] =
QPoint(-2, 3);
473 points[4] =
QPoint(-1, -2);
474 points[5] =
QPoint(-1, 2);
475 points[6] =
QPoint(0, -1);
480 points[0] =
QPoint(1, -4);
482 points[2] =
QPoint(0, -3);
484 points[4] =
QPoint(-1, -2);
485 points[5] =
QPoint(-1, 2);
486 points[6] =
QPoint(-2, -1);
487 points[7] =
QPoint(-2, 1);
488 points[8] =
QPoint(-3, 0);
500 painter->
drawLine(points[0], points[1]);
501 painter->
drawLine(points[2], points[3]);
502 painter->
drawLine(points[4], points[5]);
503 painter->
drawLine(points[6], points[7]);
509 painter->
drawLine(points[0], points[1]);
510 painter->
drawLine(points[2], points[3]);
511 painter->
drawLine(points[4], points[5]);
512 painter->
drawLine(points[6], points[7]);
516 painter->
drawLine(points[0], points[1]);
517 painter->
drawLine(points[2], points[3]);
518 painter->
drawLine(points[4], points[5]);
519 painter->
drawLine(points[6], points[7]);
534 if (
const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
536 QRect r = frame->rect;
581 if (
const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
586 if (active || hasFocus) {
588 if (active && down) {
589 painter->
fillRect(mbi->rect.adjusted(0, 1, 0, -1), b);
631 if (
const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
633 menuitem->rect.getRect(&x, &y, &w, &h);
634 int tab = menuitem->tabWidth;
637 ? menuitem->checked :
false;
643 painter->
fillRect(menuitem->rect.adjusted(1, 1, 0, 0), fill);
646 int yoff = y-1 + h / 2;
647 painter->
setPen(menuitem->palette.shadow().color());
648 painter->
drawLine(x + 4, yoff + 1, x + w - 8, yoff + 1);
653 menuitem->rect.y(), checkcol, menuitem->rect.height()));
657 menuitem->palette.button().color(), 1,
658 &menuitem->palette.brush(QPalette::Button));
661 qDrawPlainRect(painter, vCheckRect,menuitem->palette.button().color(), 1, &fill);
664 painter->
fillRect(vCheckRect, menuitem->palette.brush(QPalette::Button));
669 if (!menuitem->icon.isNull()) {
678 int pixw = pixmap.
width();
679 int pixh = pixmap.
height();
680 if (act && !dis && !checked)
681 qDrawPlainRect(painter, vCheckRect, menuitem->palette.button().color(), 1,
682 &menuitem->palette.brush(QPalette::Button));
683 QRect pmr(0, 0, pixw, pixh);
684 pmr.moveCenter(vCheckRect.
center());
685 painter->
setPen(menuitem->palette.text().color());
687 }
else if (checked) {
699 painter->
setPen(act ? menuitem->palette.highlightedText().color() : menuitem->palette.buttonText().color());
703 discol = menuitem->palette.text().color();
707 int xpos = menuitem->rect.x() + xm;
723 painter->
drawText(vShortcutRect, text_flags, s.
mid(t + 1));
726 QFont font = menuitem->font;
742 newMI.
rect = vSubMenuRect;
761 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
767 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
775 bool firstTab = ((!rtlHorTabs
780 bool previousSelected =
789 && tab->selectedPosition
792 bool leftAligned = (!rtlHorTabs && tabBarAlignment ==
Qt::AlignLeft)
796 bool rightAligned = (!rtlHorTabs && tabBarAlignment ==
Qt::AlignRight)
800 QColor midlight = tab->palette.midlight().color();
802 QColor shadow = tab->palette.shadow().color();
803 QColor background = tab->palette.background().color();
806 borderThinkness /= 2;
812 switch (tab->shape) {
819 x1 += firstTab ? borderThinkness : 0;
820 x2 -= lastTab ? borderThinkness : 0;
823 painter->
fillRect(
QRect(x1 + 1, y1 + 1, (x2 - x1) - 1, (y2 - y1) - 2), tab->palette.background());
827 painter->
setPen(background);
828 painter->
drawLine(x1, y2 - 1, x2, y2 - 1);
829 painter->
drawLine(x1, y2 + 1, x2, y2 + 1);
833 if (firstTab || selected || onlyOne || !previousSelected) {
835 painter->
drawLine(x1, y1 + 2, x1, y2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
837 painter->
setPen(midlight);
838 painter->
drawLine(x1 + 1, y1 + 2, x1 + 1, y2 -
839 ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
844 int beg = x1 + (previousSelected ? 0 : 2);
845 int end = x2 - (nextSelected ? 0 : 2);
847 painter->
drawLine(beg, y1, end, y1);
849 painter->
setPen(midlight);
850 painter->
drawLine(beg, y1 + 1, end, y1 + 1);
854 if (lastTab || selected || onlyOne || !nextSelected) {
856 painter->
drawLine(x2, y1 + 2, x2, y2 - ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness));
859 painter->
drawLine(x2 - 1, y1 + 2, x2 - 1, y2 - ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness));
865 x1 += firstTab ? borderThinkness : 0;
866 x2 -= lastTab ? borderThinkness : 0;
869 painter->
fillRect(
QRect(x1 + 1, y1 + 2, (x2 - x1) - 1, (y2 - y1) - 1), tab->palette.background());
873 painter->
setPen(background);
874 painter->
drawLine(x1, y1 + 1, x2 - 1, y1 + 1);
875 painter->
drawLine(x1, y1 - 1, x2 - 1, y1 - 1);
876 painter->
drawLine(x1, y1, x2 - 1, y1);
879 if (firstTab || selected || onlyOne || !previousSelected) {
881 painter->
drawLine(x1, y2 - 2, x1, y1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
883 painter->
setPen(midlight);
884 painter->
drawLine(x1 + 1, y2 - 2, x1 + 1, y1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
888 int beg = x1 + (previousSelected ? 0 : 2);
889 int end = x2 - (nextSelected ? 0 : 2);
891 painter->
drawLine(beg, y2, end, y2);
893 painter->
drawLine(beg, y2 - 1, end, y2 - 1);
896 if (lastTab || selected || onlyOne || !nextSelected) {
898 painter->
drawLine(x2, y2 - 2, x2, y1 + ((onlyOne || lastTab) && selected &&
899 rightAligned ? 0 : borderThinkness));
902 painter->
drawLine(x2 - 1, y2 - 2, x2 - 1, y1 + ((onlyOne || lastTab) && selected &&
903 rightAligned ? 0 : borderThinkness));
909 y1 += firstTab ? borderThinkness : 0;
910 y2 -= lastTab ? borderThinkness : 0;
913 painter->
fillRect(
QRect(x1 + 1, y1 + 1, (x2 - x1) - 2, (y2 - y1) - 1), tab->palette.background());
917 painter->
setPen(background);
918 painter->
drawLine(x2 - 1, y1, x2 - 1, y2);
922 if (firstTab || selected || onlyOne || !previousSelected) {
924 painter->
drawLine(x1 + 2, y1, x2 - ((onlyOne || firstTab) && selected &&
925 leftAligned ? 0 : borderThinkness), y1);
927 painter->
setPen(midlight);
928 painter->
drawLine(x1 + 2, y1 + 1, x2 - ((onlyOne || firstTab) && selected &&
929 leftAligned ? 0 : borderThinkness), y1 + 1);
933 int beg = y1 + (previousSelected ? 0 : 2);
934 int end = y2 - (nextSelected ? 0 : 2);
936 painter->
drawLine(x1, beg, x1, end);
937 painter->
setPen(midlight);
938 painter->
drawLine(x1 + 1, beg, x1 + 1, end);
941 if (lastTab || selected || onlyOne || !nextSelected) {
943 painter->
drawLine(x1 + 3, y2, x2 - ((onlyOne || lastTab) && selected &&
944 rightAligned ? 0 : borderThinkness), y2);
947 painter->
drawLine(x1 + 3, y2 - 1, x2 - ((onlyOne || lastTab) && selected &&
948 rightAligned ? 0 : borderThinkness), y2 - 1);
956 y1 += firstTab ? borderThinkness : 0;
957 y2 -= lastTab ? borderThinkness : 0;
960 painter->
fillRect(
QRect(x1 + 2, y1 + 1, (x2 - x1) - 1, (y2 - y1) - 1), tab->palette.background());
964 painter->
setPen(background);
965 painter->
drawLine(x1 + 1, y1, x1 + 1, y2 - 1);
966 painter->
drawLine(x1, y1, x1, y2 - 1);
969 if (firstTab || selected || onlyOne || !previousSelected) {
971 painter->
drawLine(x2 - 2, y1, x1 + ((onlyOne || firstTab) && selected &&
972 leftAligned ? 0 : borderThinkness), y1);
974 painter->
setPen(midlight);
975 painter->
drawLine(x2 - 3, y1 + 1, x1 + ((onlyOne || firstTab) &&
976 selected && leftAligned ? 0 : borderThinkness), y1 + 1);
982 int beg = y1 + (previousSelected ? 0 : 2);
983 int end = y2 - (nextSelected ? 0 : 2);
985 painter->
drawLine(x2, beg, x2, end);
987 painter->
drawLine(x2 - 1, beg, x2 - 1, end);
990 if (lastTab || selected || onlyOne || !nextSelected) {
992 painter->
drawLine(x2 - 2, y2, x1 + ((onlyOne || lastTab) &&
993 selected && rightAligned ? 0 : borderThinkness), y2);
996 painter->
drawLine(x2 - 2, y2 - 1, x1 + ((onlyOne || lastTab) &&
997 selected && rightAligned ? 0 : borderThinkness), y2 - 1);
1003 #endif // QT_NO_TABBAR 1027 #ifndef QT_NO_SCROLLBAR 1082 buttonOpt.QStyleOption::operator=(*option);
1093 buttonOpt.QStyleOption::operator=(*option);
1098 #endif // QT_NO_SCROLLBAR 1119 if (
const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
1124 QRect ir = btn->rect;
1132 if (!btn->icon.isNull()) {
1140 QPixmap pixmap = btn->icon.pixmap(btn->iconSize, mode, state);
1141 int pixw = pixmap.
width();
1142 int pixh = pixmap.
height();
1146 if (btn->text.isEmpty()) {
1148 ir.
y() + ir.
height() / 2 - pixh / 2);
1166 if (!btn->text.isEmpty())
1185 #ifndef QT_NO_SLIDER 1187 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
1190 int ticks = slider->tickPosition;
1195 int mid = thickness / 2;
1201 painter->
setPen(slider->palette.shadow().color());
1205 painter->
drawLine(groove.
x() + 1, groove.
y() + mid - 1,
1206 groove.
x() + groove.
width() - 3, groove.
y() + mid - 1);
1210 painter->
drawLine(groove.
x() + mid - 1, groove.
y() + 1,
1211 groove.
x() + mid - 1, groove.
y() + groove.
height() - 3);
1230 const QColor c0 = slider->palette.shadow().color();
1231 const QColor c1 = slider->palette.
dark().color();
1233 const QColor c3 = slider->palette.midlight().color();
1234 const QColor c4 = slider->palette.
dark().color();
1244 int x = handle.
x(), y = handle.
y(),
1248 int x2 = x + wi - 1;
1250 int y2 = y + he - 1;
1258 fropt.QStyleOption::operator=(*slider);
1262 if ((tickAbove && tickBelow) || (!tickAbove && !tickBelow)) {
1270 painter->
fillRect(
QRectF(x1 + 2, y1 + 2, x2 - x1 - 3, y2 - y1 - 3),fill);
1290 d = (wi + 1) / 2 - 1;
1291 a.
setPoints(5, x1, y1, x1, y2, x2, y2, x2, y1, x1 + d, y1 - d);
1296 d = (wi + 1) / 2 - 1;
1297 a.
setPoints(5, x1, y1, x1, y2, x1 + d, y2+d, x2, y2, x2, y1);
1300 d = (he + 1) / 2 - 1;
1302 a.
setPoints(5, x1, y1, x1 - d, y1 + d, x1, y2, x2, y2, x2, y1);
1306 d = (he + 1) / 2 - 1;
1308 a.
setPoints(5, x1, y1, x1, y2, x2, y2, x2 + d, y1 + d, x2, y1);
1317 painter->
drawRect(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
1321 painter->
fillRect(
QRectF(x1, y1, x2 - x1 + 1, y2 - y1 + 1),fill);
1329 painter->
drawLine(x1, y1 + 1, x2, y1 + 1);
1333 painter->
drawLine(x1 + 1, y1 + 1, x1 + 1, y2);
1341 painter->
drawLine(x2 - 1, y1 + 1, x2 - 1, y2 - 1);
1347 painter->
drawLine(x1+1, y2 - 1, x2 - 1, y2 - 1);
1353 painter->
fillRect(
QRectF(x1 + 3, y1 - d + 2, x2 - x1 - 4,y1), fill);
1355 painter->
drawLine(x1, y1, x1 + d, y1 - d);
1358 painter->
drawLine(x2, y1, x2 - d, y1 - d);
1361 painter->
drawLine(x1 + 1, y1, x1 + 1 + d-1, y1 - d + 1);
1363 painter->
drawLine(x2 - 1, y1, x2-1 - d, y1 - d);
1367 painter->
fillRect(
QRectF(x1 + 3, y2 - d, x2 - x1 - 4,y2 - 8), fill);
1369 painter->
drawLine(x1, y2, x1 + d, y2 + d);
1372 painter->
drawLine(x2, y2, x2 - d, y2 + d);
1375 painter->
drawLine(x1 + 1, y2, x1 + 1 + d - 1, y2 + d - 1);
1377 painter->
drawLine(x2 - 1, y2, x2 - 1 - d, y2 + d);
1381 painter->
fillRect(
QRectF(x1 - d + 2, y1 + 2, x1,y2 - y1 - 3), fill);
1383 painter->
drawLine(x1, y1, x1 - d, y1 + d);
1386 painter->
drawLine(x1, y2, x1 - d, y2 - d);
1389 painter->
drawLine(x1, y1 + 1, x1 - d + 1, y1 + 1 + d - 1);
1391 painter->
drawLine(x1, y2 - 1, x1 - d, y2 - 1 - d);
1395 painter->
fillRect(
QRectF(x2 - d - 4, y1 + 2, x2 - 4, y2 - y1 - 3), fill);
1397 painter->
drawLine(x2, y1, x2 + d, y1 + d);
1400 painter->
drawLine(x2, y2, x2 + d, y2 - d);
1403 painter->
drawLine(x2, y1 + 1, x2 + d - 1, y1 + 1 + d - 1);
1405 painter->
drawLine(x2, y2 - 1, x2 + d, y2 - 1 - d);
1411 #endif // QT_NO_SLIDER 1414 = qstyleoption_cast<const QStyleOptionToolButton *>(option)) {
1415 QRect button, menuarea;
1417 #ifndef QT_NO_TOOLBAR 1431 State bflags = toolbutton->state;
1437 State mflags = bflags;
1445 tool.
palette = toolbutton->palette;
1448 tool.
state = bflags;
1453 tool.
rect = menuarea;
1454 tool.
state = mflags;
1455 tool.
state = bflags;
1516 fr.QStyleOption::operator=(*toolbutton);
1520 toolbutton, widget), 0);
1530 #ifndef QT_NO_GROUPBOX 1532 if (
const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
1544 frame.QStyleOption::operator=(*groupBox);
1545 frame.
features = groupBox->features;
1551 QRegion region(groupBox->rect);
1552 if (!groupBox->text.isEmpty()) {
1556 finalRect.
adjust(ltr ? -4 : 0, 0, ltr ? 0 : 4, 0);
1557 region -= finalRect;
1566 QColor textColor = groupBox->textColor;
1568 painter->
setPen(textColor);
1569 int alignment = int(groupBox->textAlignment);
1574 groupBox->palette, groupBox->state &
State_Enabled, groupBox->text,
1579 fropt.QStyleOption::operator=(*groupBox);
1580 fropt.
rect = textRect;
1587 box.QStyleOption::operator=(*groupBox);
1588 box.
rect = checkBoxRect;
1594 #endif //QT_NO_GROUPBOX 1595 #ifndef QT_NO_COMBOBOX 1597 if (
const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
1609 painter->
setPen(cmb->palette.dark().color());
1629 arrowOpt.
palette = cmb->palette;
1630 arrowOpt.
state = flags;
1639 painter->
setPen(cmb->palette.highlightedText().color());
1642 painter->
setPen(cmb->palette.text().color());
1647 focus.QStyleOption::operator=(*cmb);
1656 #endif // QT_NO_COMBOBOX 1657 #ifndef QT_NO_SPINBOX 1659 if (
const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
1702 copy.
state = sb->state;
1747 #endif // QT_NO_SPINBOX 1761 savedPen = painter->
pen();
1770 painter->
drawText(rect, alignment, text);
1772 painter->
setPen(savedPen);
1781 if (
const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
1783 int w = newSize.
width(),
1788 if (w < 75 + defwidth && btn->icon.isNull())
1790 if (h < 23 + defwidth)
1792 newSize =
QSize(w+14, h);
1798 if (
const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
1805 int margins = (!btn->icon.isNull() && btn->text.isEmpty()) ? 0 : 10;
1806 newSize +=
QSize(irect.
right() + margins, 4);
1811 if (
const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
1816 #ifndef QT_NO_SPINBOX 1818 if (
const QStyleOptionSpinBox *spnb = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
1825 newSize +=
QSize(0,1);
1828 newSize +=
QSize(5, 1);
1831 newSize +=
QSize(0, -2);
1834 newSize +=
QSize(0, -1);
1854 #ifndef QT_NO_COMBOBOX 1856 if (
const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
1857 int margin = cb->frame ? 3 : 0;
1862 #endif // QT_NO_COMBOBOX 1873 #ifndef QT_NO_SLIDER 1875 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
1879 switch (subControl) {
1885 slider->sliderPosition,
1886 (horizontal ? slider->rect.width()
1887 : slider->rect.height()) - len,
1888 slider->upsideDown);
1890 rect.
setRect(slider->rect.x() + sliderPos, slider->rect.y() + tickOffset, len, thickness);
1892 rect.
setRect(slider->rect.x() + tickOffset, slider->rect.y() + sliderPos, thickness, len);
1897 rect =
visualRect(slider->direction, slider->rect, rect);
1900 #endif //QT_NO_SLIDER 1901 #ifndef QT_NO_COMBOBOX 1903 if (
const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
1904 int x = cb->rect.x(),
1906 wi = cb->rect.width(),
1907 he = cb->rect.height();
1909 int margin = cb->frame ? 3 : 0;
1910 int bmarg = cb->frame ? 2 : 0;
1911 xpos += wi - (he - 2*bmarg) - bmarg;
1912 switch (subControl) {
1914 rect.
setRect(xpos, y + bmarg, he - 2*bmarg, he - 2*bmarg);
1917 rect.
setRect(x + margin, y + margin, wi - 2 * margin - (he - 2*bmarg), he - 2 * margin);
1928 rect =
visualRect(cb->direction, cb->rect, rect);
1930 #endif //QT_NO_COMBOBOX 1931 #ifndef QT_NO_SPINBOX 1933 if (
const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
1936 bs.
setWidth(
qMax(18, (spinbox->rect.height() / 2 - fw + 1)));
1942 x = spinbox->rect.
width() - y - bs.
width() * 2;
1945 switch (subControl) {
1954 rect =
QRect(lx, fw, spinbox->rect.width() - 2*fw - 2, spinbox->rect.height() - 2*fw);
1956 rect =
QRect(lx, fw, rx-2, spinbox->rect.height() - 2*fw);
1960 rect = spinbox->rect;
1964 rect =
visualRect(spinbox->direction, spinbox->rect, rect);
1967 #endif // Qt_NO_SPINBOX 1968 #ifndef QT_NO_GROUPBOX 1970 if (
const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
1971 switch (subControl) {
1977 int bottomMargin = 0;
1978 int noLabelMargin = 0;
1979 QRect frameRect = groupBox->rect;
1981 if (groupBox->text.size()) {
1982 topHeight = groupBox->fontMetrics.height();
1984 topMargin = topHeight / 2;
1986 topMargin = -topHeight/2;
1989 topHeight = groupBox->fontMetrics.height();
1990 noLabelMargin = topHeight / 2;
1992 topMargin = topHeight / 4 - 4;
1993 bottomMargin = topHeight / 4 - 4;
1996 topMargin = topHeight/2 - 4;
1997 bottomMargin = topHeight/2 - 4;
2002 frameRect.
setTop(topMargin);
2011 rect = frameRect.
adjusted(frameWidth, frameWidth + topHeight, -frameWidth, -frameWidth - noLabelMargin);
2018 int h = fontMetrics.
height();
2021 rect = groupBox->rect.
adjusted(marg, 0, -marg, 0);
2027 int checkBoxSize = hasCheckBox ? (indicatorWidth + indicatorSpace) : 0;
2030 QRect totalRect =
alignedRect(groupBox->direction, groupBox->textAlignment,
2031 QSize(tw + checkBoxSize, h), rect);
2040 left = ltr ? totalRect.left() : (totalRect.right() - indicatorWidth);
2041 int top = totalRect.top() + (fontMetrics.
height() - indicatorHeight) / 2;
2042 totalRect.setRect(left, top, indicatorWidth, indicatorHeight);
2045 left = ltr ? (totalRect.left() + checkBoxSize - 2) : totalRect.left();
2046 totalRect.setRect(left, totalRect.top(),
2047 totalRect.width() - checkBoxSize, totalRect.height());
2059 #endif // QT_NO_GROUPBOX 2078 QColor(132, 130, 132),
QColor(198, 195, 198) ,
Qt::black,
Qt::white,
Qt::white,
QColor(198, 195, 198));
2136 #ifndef QT_NO_TABBAR 2164 #ifndef QT_NO_SLIDER 2180 if (
const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
2181 int space = (sl->orientation ==
Qt::Horizontal) ? sl->rect.height() : sl->rect.width();
2182 int ticks = sl->tickPosition;
2198 thick += (space * 2) / (n + 2);
2204 #endif // QT_NO_SLIDER 2229 #if defined(Q_WS_WIN) 2240 #endif // QT_NO_MENU 2252 #if defined(Q_WS_WIN) 2278 #ifndef QT_NO_IMAGEFORMAT_XPM 2284 #endif //QT_NO_IMAGEFORMAT_XPM 2309 int x,
int y,
int w,
int h,
2322 if (w > 4 && h > 4) {
2336 int x,
int y,
int w,
int h,
2346 if (w > 4 && h > 4) {
2363 int x,
int y,
int w,
int h,
2374 if (w > 4 && h > 4) {
2395 drawWinCEShadesSunken(p, x, y, w, h,
2399 drawWinCEShades(p, x, y, w, h,
2408 drawWinShades(p, x, y, w, h,
2412 drawWinShades(p, x, y, w, h,
2419 drawWinCEButton(p, r.
x(), r.
y(), r.
width(), r.
height(), pal, sunken, fill);
2424 drawWinCEPanel(p, r.
x(), r.
y(), r.
width(), r.
height(), pal, sunken, fill);
2429 #endif // QT_NO_STYLE_WINDOWSCE void setBackgroundMode(Qt::BGMode mode)
Sets the background mode of the painter to the given mode.
The QPainter class performs low-level painting on widgets and other paint devices.
The QColor class provides colors based on RGB, HSV or CMYK values.
static QRect alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment, const QSize &size, const QRect &rectangle)
Returns a new rectangle of the specified size that is aligned to the given rectangle according to the...
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
static const int windowsItemFrame
static Qt::LayoutDirection layoutDirection()
void polish(QApplication *)
Reimplemented Function
static void drawWinShades(QPainter *p, int x, int y, int w, int h, const QColor &c1, const QColor &c2, const QColor &c3, const QColor &c4, const QBrush *fill)
The QApplication class manages the GUI application's control flow and main settings.
void drawPath(const QPainterPath &path)
Draws the given painter path using the current pen for outline and the current brush for filling...
QRect adjusted(int x1, int y1, int x2, int y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
void setHeight(int h)
Sets the height of the rectangle to the given height.
const QBrush & base() const
Returns the base brush of the current color group.
const QBrush & brightText() const
Returns the bright text foreground brush of the current color group.
static const int windowsCEitemViewCheckBoxSize
SubControl
This enum describes the available sub controls.
StyleHint
This enum describes the available style hints.
void drawArc(const QRectF &rect, int a, int alen)
Draws the arc defined by the given rectangle, startAngle and spanAngle.
The QStyleHintReturn class provides style hints that return more than basic data types.
void setBottom(int pos)
Sets the bottom edge of the rectangle to the given y coordinate.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
The QFontMetrics class provides font metrics information.
void setColorAt(qreal pos, const QColor &color)
Creates a stop point at the given position with the given color.
#define QT_END_NAMESPACE
This macro expands to.
const QColor & color() const
Returns the brush color.
int width() const
Returns the width of the pixmap.
QPointer< QWidget > widget
ColorRole
The ColorRole enum defines the different symbolic color roles used in current GUIs.
void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &c, int lineWidth, const QBrush *fill)
static QPoint visualPos(Qt::LayoutDirection direction, const QRect &boundingRect, const QPoint &logicalPos)
Returns the given logicalPosition converted to screen coordinates based on the specified direction...
const QBrush & dark() const
Returns the dark brush of the current color group.
void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
Reimplemented Function
const QBrush & background() const
Returns the current background brush.
QStyle::State state
the style flags that are used when drawing the control
void qDrawShadeRect(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken, int lineWidth, int midLineWidth, const QBrush *fill)
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
static QSize globalStrut()
const QBrush & background() const
Use window() instead.
static void drawWinCEShadesSunken(QPainter *p, int x, int y, int w, int h, const QColor &c1, const QColor &c2, const QColor &c3, const QColor &c4, const QBrush *fill)
ComplexControl
This enum describes the available complex controls.
QRect united(const QRect &other) const
Returns the bounding rectangle of this rectangle and the given rectangle.
static C reverse(const C &l)
void restore()
Restores the current painter state (pops a saved state off the stack).
State
This enum describes the state for which a pixmap is intended to be used.
PixelMetric
This enum describes the various available pixel metrics.
static const int windowsCEIndicatorSize
static void drawWinCEPanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, const QBrush *fill=0)
QSize expandedTo(const QSize &) const
Returns a size holding the maximum width and height of this size and the given otherSize.
int left() const
Returns the x-coordinate of the rectangle's left edge.
int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
int width() const
Returns the width of the rectangle.
QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
Reimplemented Function
long ASN1_INTEGER_get ASN1_INTEGER * a
The QPolygon class provides a vector of points using integer precision.
void drawLine(const QLineF &line)
Draws a line defined by line.
int height() const
Returns the height of the rectangle.
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
The QString class provides a Unicode character string.
QFontMetrics fontMetrics
the font metrics that should be used when drawing text in the control
void setHeight(int h)
Sets the height to the given height.
T * qobject_cast(QObject *object)
static const int windowsRightBorder
static const QColor windowsCECheckBoxGradientColorBegin
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
The QPen class defines how a QPainter should draw lines and outlines of shapes.
void setBrushOrigin(int x, int y)
Sets the brush's origin to point (x, y).
void drawPoint(const QPointF &pt)
Draws a single point at the given position using the current pen's color.
void moveTo(const QPointF &p)
Moves the current point to the given point, implicitly starting a new subpath and closing the previou...
static int sliderPositionFromValue(int min, int max, int val, int space, bool upsideDown=false)
Converts the given logicalValue to a pixel position.
static const QColor windowsCECheckBoxGradientColorEnd
void save()
Saves the current painter state (pushes the state onto a stack).
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
static void drawWinCEShades(QPainter *p, int x, int y, int w, int h, const QColor &c1, const QColor &c2, const QColor &c3, const QColor &c4, const QBrush *fill)
StandardPixmap
This enum describes the available standard pixmaps.
The QLineF class provides a two-dimensional vector using floating point precision.
void setWidth(int w)
Sets the width to the given width.
QColor backgroundColor
the background color on which the focus rectangle is being drawn
void lineTo(const QPointF &p)
Adds a straight line from the current position to the given endPoint.
void setCurrentColorGroup(ColorGroup cg)
Set the palette's current color group to cg.
int lineWidth
the line width for drawing the frame
int width() const
Returns the width.
virtual void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole) const
Draws the given text in the specified rectangle using the provided painter and palette.
void drawText(const QPointF &p, const QString &s)
Draws the given text with the currently defined text direction, beginning at the given position...
void setRenderHint(RenderHint hint, bool on=true)
Sets the given render hint on the painter if on is true; otherwise clears the render hint...
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const
Reimplemented Function
const QPen & pen() const
Returns the painter's current pen.
#define QT_BEGIN_NAMESPACE
This macro expands to.
void drawEllipse(const QRectF &r)
Draws the ellipse defined by the given rectangle.
The QRectF class defines a rectangle in the plane using floating point precision. ...
void setBold(bool)
If enable is true sets the font's weight to QFont::Bold ; otherwise sets the weight to QFont::Normal...
QPoint bottomRight() const
Returns the position of the rectangle's bottom-right corner.
const QBrush & light() const
Returns the light brush of the current color group.
void drawLines(const QLineF *lines, int lineCount)
Draws the first lineCount lines in the array lines using the current pen.
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget=0) const
Reimplemented Function
QSize size(int flags, const QString &str, int tabstops=0, int *tabarray=0) const
Returns the size in pixels of text.
The QStyleOption class stores the parameters used by QStyle functions.
static const int windowsArrowHMargin
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
ContentsType
This enum describes the available contents types.
The QStyleOptionSpinBox class is used to describe the parameters necessary for drawing a spin box...
void setTop(int pos)
Sets the top edge of the rectangle to the given y coordinate.
const QFont & font() const
Returns the currently set font used for drawing text.
Mode
This enum type describes the mode for which a pixmap is intended to be used.
QColor dark(int f=200) const
Use darker(factor) instead.
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
void setRight(int pos)
Sets the right edge of the rectangle to the given x coordinate.
const QBrush & midlight() const
Returns the midlight brush of the current color group.
const QBrush & mid() const
Returns the mid brush of the current color group.
The QStyleOptionFocusRect class is used to describe the parameters for drawing a focus rectangle with...
int & rx()
Returns a reference to the x coordinate of this point.
static const int windowsItemVMargin
void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
Reimplemented Function
The QStyleOptionFrame class is used to describe the parameters for drawing a frame.
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
static const int windowsCESliderThickness
int pixelMetric(PixelMetric pm, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule=Qt::OddEvenFill)
Draws the polygon defined by the first pointCount points in the array points using the current pen an...
void qDrawShadePanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken, int lineWidth, const QBrush *fill)
The QRegion class specifies a clip region for a painter.
static const int windowsCheckMarkWidth
The State element defines configurations of objects and properties.
QPixmap texture() const
Returns the custom brush pattern, or a null pixmap if no custom brush pattern has been set...
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
bool inherits(const char *classname) const
Returns true if this object is an instance of a class that inherits className or a QObject subclass t...
FrameFeatures features
a bitwise OR of the features that describe this frame.
QPalette standardPalette() const
Returns the style's standard palette.
static void drawWinCEButton(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken=false, const QBrush *fill=0)
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget=0) const
Reimplemented Function
int styleHint(StyleHint hint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const
Reimplemented Function
void polish(QWidget *widget)
Reimplemented Function
QPoint topRight() const
Returns the position of the rectangle's top-right corner.
const QBrush & brush() const
Returns the painter's current brush.
QPalette palette
the palette that should be used when painting the control
The QBrush class defines the fill pattern of shapes drawn by QPainter.
QPoint center() const
Returns the center point of the rectangle.
const QBrush & shadow() const
Returns the shadow brush of the current color group.
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
virtual void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const
Draws the given pixmap in the specified rectangle, according to the specified alignment, using the provided painter.
int top() const
Returns the y-coordinate of the rectangle's top edge.
static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, const QRect &logicalRect)
Returns the given logicalRectangle converted to screen coordinates based on the specified direction...
void setClipRegion(const QRegion &, Qt::ClipOperation op=Qt::ReplaceClip)
Sets the clip region to the given region using the specified clip operation.
int right() const
Returns the x-coordinate of the rectangle's right edge.
QPoint bottomLeft() const
Returns the position of the rectangle's bottom-left corner.
PrimitiveElement
This enum describes the various primitive elements.
void setLeft(int pos)
Sets the left edge of the rectangle to the given x coordinate.
The QLinearGradient class is used in combination with QBrush to specify a linear gradient brush...
The QFont class specifies a font used for drawing text.
int y() const
Returns the y-coordinate of the rectangle's top edge.
Qt::BGMode backgroundMode() const
Returns the current background mode.
const QBrush & highlightedText() const
Returns the highlighted text brush of the current color group.
static const int windowsCEExclusiveIndicatorSize
int midLineWidth
the mid-line width for drawing the frame
QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *widget=0) const
Reimplemented Function
static const int windowsItemHMargin
void eraseRect(const QRectF &)
Erases the area inside the given rectangle.
int x() const
Returns the x-coordinate of the rectangle's left edge.
static const int windowsCEFrameGroupBoxOffset
QObject * parent() const
Returns a pointer to the parent object.
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget=0) const
Reimplemented Function
void setRect(int x, int y, int w, int h)
Sets the coordinates of the rectangle's top-left corner to ({x}, {y}), and its size to the given widt...
The QPoint class defines a point in the plane using integer precision.
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid co...
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
The QStyleOptionGroupBox class describes the parameters for drawing a group box.
The QStyleOptionComboBox class is used to describe the parameter for drawing a combobox.
SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget=0) const
Reimplemented Function
void setWidth(int w)
Sets the width of the rectangle to the given width.
void setPen(const QColor &color)
Sets the painter's pen to have style Qt::SolidLine, width 0 and the specified color.
int height() const
Returns the height.
Qt::LayoutDirection direction
the text layout direction that should be used when drawing text in the control
The QRect class defines a rectangle in the plane using integer precision.
SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *w=0) const
Reimplemented Function
The QStyleOptionFrameV2 class is used to describe the parameters necessary for drawing a frame in Qt ...
void drawRect(const QRectF &rect)
Draws the current rectangle with the current pen and brush.
int y() const
Returns the y coordinate of this point.
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
The QPixmap class is an off-screen image representation that can be used as a paint device...
The QStyleOptionTab class is used to describe the parameters for drawing a tab bar.
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device...
int height() const
Returns the height of the pixmap.
ControlElement
This enum represents a control element.
The QStyleOptionSlider class is used to describe the parameters needed for drawing a slider...
const QBrush & link() const
Returns the unvisited link text brush of the current color group.
The QSize class defines the size of a two-dimensional object using integer point precision.
void setFont(const QFont &f)
Sets the painter's font to the given font.
void setPoints(int nPoints, const int *points)
Resizes the polygon to nPoints and populates it with the given points.
const QBrush & buttonText() const
Returns the button text foreground brush of the current color group.
QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget=0) const
Reimplemented Function
static const int windowsCEIconSize
int x() const
Returns the x coordinate of this point.
The QStyleOptionComplex class is used to hold parameters that are common to all complex controls...
bool isValid() const
Returns true if the color is valid; otherwise returns false.
QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const
Reimplemented Function
The QWindowsStyle class provides a Microsoft Windows-like look and feel.
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
int height() const
Returns the height of the font.
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
void translate(int dx, int dy)
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position...
static const KeyPair *const end
const QBrush & button() const
Returns the button brush of the current color group.
int styleHint(StyleHint hint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const
Reimplemented Function
void drawPolyline(const QPointF *points, int pointCount)
Draws the polyline defined by the first pointCount points in points using the current pen...
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QRect rect
the area that should be used for various calculations and painting
QStyle::SubControls subControls
This variable holds a bitwise OR of the sub-controls to be drawn for the complex control.
void setBackground(const QBrush &bg)
Sets the background brush of the painter to the given brush.
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *w=0) const
Reimplemented Function
const QBrush & text() const
Returns the text foreground brush of the current color group.
SubElement
This enum represents a sub-area of a widget.
QColor light(int f=150) const
Use lighter(factor) instead.
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.
The QPalette class contains color groups for each widget state.