45 #if !defined(QT_NO_STYLE_CLEANLOOKS) || defined(QT_PLUGIN) 69 #include <private/qstylehelper_p.h> 478 if (bgBrush.gradient())
479 gradient->
setStops(bgBrush.gradient()->stops());
495 bool horizontal =
false;
513 if (bgBrush.gradient())
514 gradient->
setStops(bgBrush.gradient()->stops());
516 int size = horizontal ? rect.
width() : rect.
height() ;
518 float edge = 4.0/(float)size;
539 QColor titleBarHighlight(255, 255, 255, 60);
546 QColor mdiButtonGradientStartColor;
547 QColor mdiButtonGradientStopColor;
549 mdiButtonGradientStartColor =
QColor(0, 0, 0, 40);
550 mdiButtonGradientStopColor =
QColor(255, 255, 255, 60);
553 titleBarHighlight = highlight.
darker(130);
556 gradient.
setColorAt(0, mdiButtonGradientStartColor);
557 gradient.setColorAt(1, mdiButtonGradientStopColor);
560 painter->
setPen(
QPen(mdiButtonBorderColor, 1));
561 const QLine lines[4] = {
568 const QPoint points[4] = {
576 painter->
setPen(titleBarHighlight);
658 QPen savedPen = painter->
pen();
666 painter->
drawText(rect, alignment, text);
667 painter->
setPen(savedPen);
672 const int maxFactor = 100;
674 tmp.
setRed((tmp.
red() * factor) / maxFactor + (colorB.
red() * (maxFactor - factor)) / maxFactor);
675 tmp.
setGreen((tmp.
green() * factor) / maxFactor + (colorB.
green() * (maxFactor - factor)) / maxFactor);
676 tmp.
setBlue((tmp.
blue() * factor) / maxFactor + (colorB.
blue() * (maxFactor - factor)) / maxFactor);
689 int state = option->
state;
692 QColor buttonShadowAlpha = buttonShadow;
709 = qstyleoption_cast<const QStyleOptionTabBarBase *>(option)) {
712 switch (tbb->shape) {
715 region -= tbb->selectedTabRect;
716 painter->
drawLine(tbb->rect.topLeft(), tbb->rect.topRight());
720 tbb->rect.topRight() +
QPoint(0, 1));
724 painter->
drawLine(tbb->rect.left(), tbb->rect.top(), tbb->rect.left(), tbb->rect.bottom());
727 painter->
drawLine(tbb->rect.left(), tbb->rect.bottom(),
728 tbb->rect.right(), tbb->rect.bottom());
731 painter->
drawLine(tbb->rect.topRight(), tbb->rect.bottomRight());
744 #endif // QT_NO_TABBAR 748 button.QStyleOption::operator=(*option);
754 if (
const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
755 QRect r = header->rect;
764 arrow.
setColor(1, header->palette.foreground().color().rgba());
775 const int margin = 6;
777 const int offset = rect.
width()/2;
789 const int offset = rect.
height()/2;
819 painter->
setPen(frameLight);
823 painter->
setPen(frameShadow);
836 painter->
setPen(softshadow);
852 if (widget && widget->
inherits(
"QDockWidgetTitleButton")) {
889 #ifndef QT_NO_LINEEDIT 892 #endif // QT_NO_LINEEDIT 894 if (widget && widget->
inherits(
"Q3ToolBar")) {
909 painter->
setPen(buttonShadowAlpha);
911 const QPoint points[8] = {
943 painter->
setPen(highlight);
953 const QPoint points2[4] = {
966 if (
const QStyleOptionButton *checkbox = qstyleoption_cast<const QStyleOptionButton*>(option)) {
1005 QColor bgc = buttonShadow;
1019 for (
int i = rect.
height()/5; i <= 4*(rect.
height()/5) ; ++i) {
1020 int y = rect.
topLeft().
y() + i + 1;
1032 for (
int i = rect.
width()/5; i <= 4*(rect.
width()/5) ; ++i) {
1033 int x = rect.
topLeft().
x() + i + 1;
1048 if (
const QStyleOptionFocusRect *focusFrame = qstyleoption_cast<const QStyleOptionFocusRect *>(option)) {
1051 QRect rect = focusFrame->rect;
1057 const QRect rects[4] = {
1069 bool isDefault =
false;
1070 bool isFlat =
false;
1076 if (
const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton*>(option)) {
1081 if (isFlat && !isDown) {
1085 const QLine lines[4] = {
1096 const QPoint points[4] = {
1115 QColor highlightedGradientStopColor = buttonShadow.
lighter(107);
1120 QColor gradientStopColor;
1121 gradientStopColor.
setHsv(buttonColor.
hue(),
1123 qMin(255, (
int)(buttonColor.
value()*0.96)));
1133 p->fillRect(gradRect, fillColor);
1134 p->setPen(gradientStopColor.
darker(125));
1140 highlightedGradientStartColor,
1141 highlightedGradientMidColor,
1158 p->setPen(
QPen(darkOutline, 1));
1166 const QPoint points[4] = {
1172 p->drawPoints(points, 4);
1174 if (!isDefault && !hasFocus && isEnabled)
1182 p->setPen(highlight);
1188 QColor topShadow = darkOutline;
1191 p->setPen(topShadow);
1192 const QPoint points2[8] = {
1202 p->drawPoints(points2, 8);
1205 p->setPen(topShadow);
1214 p->setPen(buttonShadowAlpha.
darker(120));
1215 const QLine lines[4] = {
1221 p->drawLines(lines, 4);
1222 const QPoint points3[8] = {
1232 p->drawPoints(points3, 8);
1239 #ifndef QT_NO_TABBAR 1245 #ifndef QT_NO_TABWIDGET 1254 switch (twf->shape) {
1257 tabBarRect =
QRect(twf->rect.right() - twf->leftCornerWidgetSize.width()
1258 - twf->tabBarSize.width() + 1,
1260 twf->tabBarSize.width(), borderThickness);
1262 tabBarRect =
QRect(twf->rect.left() + twf->leftCornerWidgetSize.width(),
1264 twf->tabBarSize.width(), borderThickness);
1268 tabBarRect =
QRect(twf->rect.left(),
1269 twf->rect.top() + twf->leftCornerWidgetSize.height(),
1271 twf->tabBarSize.height());
1272 tabBarRect = tabBarRect;
1275 tabBarRect =
QRect(twf->rect.right() - borderThickness + 1,
1276 twf->rect.top() + twf->leftCornerWidgetSize.height(),
1278 twf->tabBarSize.height());
1282 tabBarRect =
QRect(twf->rect.right() - twf->leftCornerWidgetSize.width() - twf->tabBarSize.width() + 1,
1283 twf->rect.bottom() + 1,
1284 twf->tabBarSize.width(),
1287 tabBarRect =
QRect(twf->rect.left() + twf->leftCornerWidgetSize.width(),
1288 twf->rect.bottom() + 1,
1289 twf->tabBarSize.width(),
1298 region -= tabBarRect;
1303 QLine rightLine =
QLine(twf->rect.topRight(), twf->rect.bottomRight() -
QPoint(0, 2));
1305 QLine topLine =
QLine(twf->rect.topLeft(), twf->rect.topRight());
1307 painter->
setPen(borderColor);
1327 painter->
setPen(borderColor);
1331 painter->
drawPoint(leftBottomOuterCorner);
1332 painter->
drawPoint(rightBottomOuterCorner);
1339 painter->
setPen(buttonShadowAlpha);
1341 painter->
drawLine(innerBottomLine);
1343 painter->
setPen(alphaCornerColor);
1344 const QPoint points[6] = {
1345 leftBottomInnerCorner1,
1346 leftBottomInnerCorner2,
1347 rightBottomInnerCorner1,
1348 rightBottomInnerCorner2,
1349 leftTopInnerCorner1,
1354 #endif // QT_NO_TABWIDGET 1363 if (
d->tabBarcloseButtonIcon.isNull())
1372 #endif // QT_NO_TABBAR 1405 if (
const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
1408 painter->
fillRect(rect, btn->palette.background().color().lighter(104));
1432 for(
int i = -20; i< 20 ; i += 2) {
1436 scrollBarSlider.
top() + gripMargin),
1438 scrollBarSlider.
bottom() - gripMargin));
1442 scrollBarSlider.
top() + gripMargin ),
1444 scrollBarSlider.
bottom() - gripMargin));
1447 for (
int i = -20; i < 20 ; i += 2) {
1451 scrollBarSlider.
center().
y()+ i),
1453 scrollBarSlider.
center().
y()+ i));
1457 scrollBarSlider.
center().
y() + 1 + i),
1459 scrollBarSlider.
center().
y() + 1 + i));
1466 #ifndef QT_NO_SIZEGRIP 1472 int sw =
qMin(h, w);
1483 for (
int i = 0; i < 4; ++i) {
1485 painter->
drawLine(x, sy - 1 , sx + 1, sw);
1492 for (
int i = 0; i < 4; ++i) {
1494 painter->
drawLine(sx - 1, sw, sw, sy - 1);
1504 #endif // QT_NO_SIZEGRIP 1505 #ifndef QT_NO_TOOLBAR 1511 bool paintLeftBorder =
true;
1512 bool paintRightBorder =
true;
1513 bool paintBottomBorder =
true;
1515 switch (
toolbar->toolBarArea) {
1517 switch(
toolbar->positionOfLine) {
1520 paintBottomBorder =
false;
1525 switch (
toolbar->positionWithinLine) {
1527 paintLeftBorder =
false;
1530 paintRightBorder =
false;
1533 paintRightBorder =
false;
1534 paintLeftBorder =
false;
1539 bool tmp = paintLeftBorder;
1540 paintRightBorder=paintLeftBorder;
1541 paintLeftBorder=tmp;
1545 switch (
toolbar->positionOfLine) {
1548 paintRightBorder =
false;
1555 switch (
toolbar->positionOfLine) {
1558 paintLeftBorder =
false;
1577 if (paintLeftBorder) {
1585 if (paintRightBorder) {
1593 if (paintBottomBorder) {
1603 #endif // QT_NO_TOOLBAR 1604 #ifndef QT_NO_DOCKWIDGET 1612 QRect rect = dwOpt->rect;
1615 if (verticalTitleBar)
1622 if (verticalTitleBar) {
1640 if (!dwOpt->title.isEmpty()) {
1653 #endif // QT_NO_DOCKWIDGET 1657 if (
const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
1663 QColor gradientStopColor;
1665 gradientStopColor.
setHsv(gradientStartColor.
hue(),
1667 qMin(255, (
int)(gradientStartColor.
value()*0.96)));
1672 gradient.setColorAt(0, gradientStartColor);
1673 gradient.setColorAt(0.8, gradientStartColor);
1674 gradient.setColorAt(1, gradientStopColor);
1684 cachePainter.setPen(
QPen(dark));
1685 cachePainter.drawLine(pixmapRect.topRight(), pixmapRect.bottomRight());
1687 cachePainter.setPen(
QPen(shadow));
1688 cachePainter.drawLine(pixmapRect.bottomLeft() +
QPoint(3, -1), pixmapRect.bottomRight() +
QPoint(-3, -1)); cachePainter.setPen(
QPen(option->
palette.
light().
color()));
1689 cachePainter.drawLine(pixmapRect.bottomLeft() +
QPoint(3, 0), pixmapRect.bottomRight() +
QPoint(-3, 0)); }
1691 cachePainter.setPen(
QPen(dark));
1692 cachePainter.drawLine(pixmapRect.bottomLeft(), pixmapRect.bottomRight());
1693 cachePainter.setPen(
QPen(shadow));
1694 cachePainter.drawLine(pixmapRect.topRight() +
QPoint(-1, 3), pixmapRect.bottomRight() +
QPoint(-1, -3)); cachePainter.setPen(
QPen(option->
palette.
light().
color()));
1695 cachePainter.drawLine(pixmapRect.topRight() +
QPoint(0, 3), pixmapRect.bottomRight() +
QPoint(0, -3)); }
1709 const QLine lines[4] = {
1720 painter->
setPen(alphaCorner);
1721 const QPoint points[4] = {
1730 painter->
setPen(innerShadow);
1742 QRect rect = bar->rect;
1743 bool vertical =
false;
1744 bool inverted =
false;
1745 bool indeterminate = (bar->minimum == 0 && bar->maximum == 0);
1750 inverted = bar2->invertedAppearance;
1763 int maxWidth = rect.
width() - 4;
1765 qreal progress =
qMax(bar->progress, bar->minimum);
1766 int progressBarWidth = (progress - bar->minimum) *
qreal(maxWidth) /
qMax(
qreal(1.0),
qreal(bar->maximum) - bar->minimum);
1767 int width = indeterminate ? maxWidth :
qMax(minWidth, progressBarWidth);
1774 if (!indeterminate) {
1782 int slideWidth = ((rect.
width() - 4) * 2) / 3;
1783 int step = ((
d->animateStep * slideWidth) /
d->animationFps) % slideWidth;
1784 if ((((
d->animateStep * slideWidth) /
d->animationFps) % (2 * slideWidth)) >= slideWidth)
1785 step = slideWidth - step;
1787 slideWidth / 2, rect.
height() - 3);
1792 QColor highlightedGradientStartColor = highlight.
lighter(100);
1793 QColor highlightedGradientStopColor = highlight.
lighter(130);
1798 gradient.
setColorAt(0, highlightedGradientStartColor);
1799 gradient.
setColorAt(1, highlightedGradientStopColor);
1810 painter->
setPen(
QPen(highlightedGradientStartColor, 7.0));
1814 for (
int x = progressBar.
left() - 32; x < rect.
right() ; x+=18) {
1852 const QLine lines[4] = {
1874 if (
const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
1887 painter->
fillRect(menuItem->rect, menuBackground);
1889 if (!menuItem->text.isEmpty()) {
1890 painter->
setFont(menuItem->font);
1892 menuItem->palette, menuItem->state &
State_Enabled, menuItem->text,
1894 w = menuItem->fontMetrics.width(menuItem->text) + 5;
1898 painter->
drawLine(menuItem->rect.left() + 5 + (reverse ? 0 : w), menuItem->rect.center().y(),
1899 menuItem->rect.right() - 5 - (reverse ? w : 0), menuItem->rect.center().y());
1911 const QLine lines[4] = {
1923 bool checked = menuItem->checked;
1927 bool ignoreCheckMark =
false;
1928 int checkcol =
qMax(menuItem->maxIconWidth, 20);
1930 #ifndef QT_NO_COMBOBOX 1931 if (qobject_cast<const QComboBox*>(widget))
1932 ignoreCheckMark =
true;
1935 if (!ignoreCheckMark) {
1938 checkRect =
visualRect(menuItem->direction, menuItem->rect, checkRect);
1942 if (checked || sunken) {
1949 painter->
drawEllipse(checkRect.adjusted(4, 4, -4, -4));
1953 if (menuItem->icon.isNull()) {
1954 if (checked || sunken) {
1970 checkRect.center().y() - image.
height() / 2), image);
1976 if (menuItem->icon.isNull())
1979 checkcol = menuItem->maxIconWidth;
1992 if (!menuItem->icon.isNull()) {
1999 QSize iconSize(smallIconSize, smallIconSize);
2000 #ifndef QT_NO_COMBOBOX 2001 if (
const QComboBox *combo = qobject_cast<const QComboBox*>(widget))
2002 iconSize = combo->iconSize();
2003 #endif // QT_NO_COMBOBOX 2005 pixmap = menuItem->icon.pixmap(iconSize, mode,
QIcon::On);
2007 pixmap = menuItem->icon.pixmap(iconSize, mode);
2009 int pixw = pixmap.
width();
2010 int pixh = pixmap.
height();
2012 QRect pmr(0, 0, pixw, pixh);
2014 painter->
setPen(menuItem->palette.text().color());
2015 if (checkable && checked) {
2023 opt.
rect = vCheckRect;
2029 painter->
setPen(menuItem->palette.highlightedText().color());
2031 painter->
setPen(menuItem->palette.text().color());
2042 int xpos = menuitem->
rect.
x() + xm;
2062 p->
drawText(vShortcutRect, text_flags, s.
mid(t + 1));
2088 int dim = (menuItem->rect.height() - 4) / 2;
2091 int xpos = menuItem->rect.left() + menuItem->rect.width() - 3 - dim;
2093 QRect(xpos, menuItem->rect.top() + menuItem->rect.height() / 2 - dim / 2, dim, dim));
2095 newMI.
rect = vSubMenuRect;
2111 if (
const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
2112 QRect ir = button->rect;
2119 if (!button->icon.isNull()) {
2131 QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state);
2132 int w = pixmap.
width();
2135 if (!button->text.isEmpty())
2136 w += button->fontMetrics.boundingRect(option->
rect, tf, button->text).width() + 2;
2139 ir.
y() + ir.
height() / 2 - h / 2);
2152 if (!button->text.isEmpty())
2176 #ifndef QT_NO_MAINWINDOW 2177 if (widget && qobject_cast<const QMainWindow *>(widget->
parentWidget())) {
2182 #endif // QT_NO_MAINWINDOW 2186 #ifndef QT_NO_TABBAR 2189 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
2201 bool atBeginning = ((tab->position == (tab->direction ==
Qt::LeftToRight ?
2205 bool previousSelected =
2214 && tab->selectedPosition
2217 bool leftAligned = (!rtlHorTabs && tabBarAlignment ==
Qt::AlignLeft)
2221 bool rightAligned = (!rtlHorTabs && tabBarAlignment ==
Qt::AlignRight)
2227 QColor background = tab->palette.background().color();
2230 borderThinkness /= 2;
2233 int x2 = r2.
right();
2241 switch (tab->shape) {
2247 rotMatrix.
scale(-1, 1);
2251 rotMatrix.
rotate(180 + 90);
2252 rotMatrix.
scale(-1, 1);
2286 else if (selected) {
2288 gradient.setColorAt(1, tabFrameColor);
2293 gradient.setColorAt(1, dark.
lighter(120));
2300 painter->
drawLine(x1 + 1, y1 + 1, x2 - 1, y1 + 1);
2301 painter->
drawLine(x1 , y1 + 2, x2 , y1 + 2);
2304 painter->
drawLine(x1, y2 - 1, x2 + 2, y2 - 1 );
2307 painter->
drawLine(x1, y2 , x2, y2 );
2311 if (atBeginning || selected ) {
2313 painter->
drawLine(x1 + 1, y1 + 2 + 1, x1 + 1, y2 - ((onlyOne || atBeginning) && selected && leftAligned ? 0 : borderThinkness) - (atBeginning && leftCornerWidget ? 1 : 0));
2316 painter->
drawLine(x1, y1 + 2, x1, y2 - ((onlyOne || atBeginning) && leftAligned ? 0 : borderThinkness) - (atBeginning && leftCornerWidget ? 1 : 0));
2320 int beg = x1 + (previousSelected ? 0 : 2);
2321 int end = x2 - (nextSelected ? 0 : 2);
2324 if (!selected)painter->
drawLine(beg - 2, y1 + 1, end, y1 + 1);
2329 painter->
setPen(darkOutline);
2330 painter->
drawLine(beg, y1 , end, y1);
2332 if (atBeginning|| selected) {
2334 }
else if (!atBeginning) {
2346 if (lastTab || selected || onlyOne || !nextSelected) {
2347 painter->
setPen(darkOutline);
2348 painter->
drawLine(x2, y1 + 2, x2, y2 - ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness));
2352 painter->
setPen(darkOutline);
2357 painter->
drawLine(x2 - 1, y1 + 3, x2 - 1, y2 - ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness));
2364 #endif // QT_NO_TABBAR 2381 QColor backGround(239, 235, 231);
2386 dark = backGround.
darker(150);
2405 QColor button = backGround;
2452 #ifndef QT_NO_SPINBOX 2454 if (
const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
2458 cache =
QPixmap(spinBox->rect.size());
2460 QRect pixmapRect(0, 0, spinBox->rect.width(), spinBox->rect.height());
2467 bool upIsActive = (spinBox->activeSubControls ==
SC_SpinBoxUp);
2468 bool downIsActive = (spinBox->activeSubControls ==
SC_SpinBoxDown);
2470 QRect rect = pixmapRect;
2472 spinBoxCopy.
rect = pixmapRect;
2477 cachePainter.fillRect(rect.
adjusted(1,
qMax(fw - 1, 0), -1, -fw),
2481 if (spinBox->frame) {
2483 QColor topShadow = darkOutline;
2485 cachePainter.setPen(topShadow);
2488 const QPoint points[8] = {
2498 cachePainter.drawPoints(points, 8);
2502 cachePainter.setPen(topShadow);
2519 cachePainter.setPen(highlight);
2523 cachePainter.setPen(
QPen(darkOutline, 1));
2526 const QLine lines[4] = {
2532 cachePainter.drawLines(lines, 4);
2537 gradientStartColor.
darker(106),
2540 gradientStartColor.
darker(106),
2545 cachePainter.fillRect(upRect.
adjusted(1, 0, 0, 0), gradientStopColor.
darker(110));
2548 gradientStartColor.
lighter(110),
2554 cachePainter.fillRect(downRect.
adjusted(1, 0, 0, 1), gradientStopColor.
darker(110));
2558 gradientStartColor.
lighter(110),
2564 if (spinBox->frame) {
2566 const QPoint points[4] = {
2572 cachePainter.drawPoints(points, 4);
2577 cachePainter.setPen(
QPen(innerline, 0));
2579 cachePainter.drawRect(rect.
adjusted(1, 2, -3 -downRect.
width(), -3));
2580 cachePainter.setPen(
QPen(darkoutline, 0));
2581 const QLine lines[4] = {
2587 cachePainter.drawLines(lines, 4);
2592 cachePainter.drawRect(rect.
adjusted(downRect.
width() + 2, 2, -2, -3));
2593 cachePainter.setPen(
QPen(darkoutline, 0));
2607 cachePainter.setPen(darkOutline);
2611 cachePainter.drawLine(upRect.
right(), upRect.
top() - 1, upRect.
right(), downRect.
bottom() + 1);
2612 cachePainter.setPen(light);
2613 cachePainter.drawLine(upRect.
right() - 1, upRect.
top() + 3, upRect.
right() - 1, downRect.
bottom() );
2615 cachePainter.drawLine(upRect.
left(), upRect.
top() - 1, upRect.
left(), downRect.
bottom() + 1);
2616 cachePainter.setPen(light);
2617 cachePainter.drawLine(upRect.
left() + 1, upRect.
top() , upRect.
left() + 1, downRect.
bottom() );
2619 if (upIsActive && sunken) {
2620 cachePainter.setPen(gradientStopColor.
darker(130));
2621 cachePainter.drawLine(upRect.
left() + 1, upRect.
top(), upRect.
left() + 1, upRect.
bottom());
2622 cachePainter.drawLine(upRect.
left(), upRect.
top() - 1, upRect.
right(), upRect.
top() - 1);
2624 cachePainter.setPen(light);
2626 cachePainter.setPen(darkOutline);
2629 if (downIsActive && sunken) {
2630 cachePainter.setPen(gradientStopColor.
darker(130));
2631 cachePainter.drawLine(downRect.
left() + 1, downRect.
top(), downRect.
left() + 1, downRect.
bottom() + 1);
2632 cachePainter.drawLine(downRect.
left(), downRect.
top(), downRect.
right(), downRect.
top());
2633 cachePainter.setPen(gradientStopColor.
darker(110));
2634 cachePainter.drawLine(downRect.
left(), downRect.
bottom() + 1, downRect.
right(), downRect.
bottom() + 1);
2636 cachePainter.setPen(light);
2641 int centerX = upRect.
center().
x();
2642 int centerY = upRect.
center().
y();
2643 cachePainter.setPen(spinBox->palette.foreground().color());
2646 if (spinBox->activeSubControls ==
SC_SpinBoxUp && sunken) {
2647 cachePainter.drawLine(1 + centerX - 2, 1 + centerY, 1 + centerX + 2, 1 + centerY);
2648 cachePainter.drawLine(1 + centerX, 1 + centerY - 2, 1 + centerX, 1 + centerY + 2);
2650 cachePainter.drawLine(centerX - 2, centerY, centerX + 2, centerY);
2651 cachePainter.drawLine(centerX, centerY - 2, centerX, centerY + 2);
2654 centerX = downRect.
center().
x();
2655 centerY = downRect.
center().
y();
2657 cachePainter.drawLine(1 + centerX - 2, 1 + centerY, 1 + centerX + 2, 1 + centerY);
2659 cachePainter.drawLine(centerX - 2, centerY, centerX + 2, centerY);
2664 upArrow.
setColor(1, spinBox->palette.foreground().color().rgba());
2666 cachePainter.drawImage(upRect.
center().
x() - upArrow.
width() / 2,
2671 downArrow.
setColor(1, spinBox->palette.foreground().color().rgba());
2673 cachePainter.drawImage(downRect.
center().
x() - downArrow.
width() / 2,
2681 cachePainter.fillRect(upRect.
adjusted(1, 0, 0, 0), disabledColor);
2683 cachePainter.fillRect(downRect.
adjusted(1, 0, 0, 0), disabledColor);
2688 painter->
drawPixmap(spinBox->rect.topLeft(), cache);
2691 #endif // QT_NO_SPINBOX 2694 if (
const QStyleOptionTitleBar *titleBar = qstyleoption_cast<const QStyleOptionTitleBar *>(option)) {
2695 const int buttonMargin = 5;
2696 bool active = (titleBar->titleBarState &
State_Active);
2697 QRect fullRect = titleBar->rect;
2703 QColor textColor(active ? 0xffffff : 0xff000000);
2704 QColor textAlphaColor(active ? 0xffffff : 0xff000000 );
2707 if (widget && widget->
inherits(
"Q3DockWindowTitleBar")) {
2709 dockwidget.QStyleOption::operator=(*option);
2712 #endif // QT3_SUPPORT 2720 gradient.setColorAt(0.5, titlebarColor.
lighter(102));
2721 gradient.setColorAt(0.51, titlebarColor.
darker(104));
2722 gradient.setColorAt(1, titlebarColor);
2726 painter->
setPen(titleBarFrameBorder);
2731 const QPoint points[5] = {
2741 const QPoint points2[5] = {
2754 painter->
setPen(titleBarHighlight);
2762 painter->
setPen(active? (titleBar->palette.text().color().lighter(120)) :
2763 titleBar->palette.text().color() );
2774 if (minButtonRect.
isValid()) {
2778 QRect minButtonIconRect = minButtonRect.
adjusted(buttonMargin ,buttonMargin , -buttonMargin, -buttonMargin);
2779 painter->
setPen(textColor);
2781 minButtonIconRect.
center().
x() + 3, minButtonIconRect.
center().
y() + 3);
2783 minButtonIconRect.
center().
x() + 3, minButtonIconRect.
center().
y() + 4);
2784 painter->
setPen(textAlphaColor);
2786 minButtonIconRect.
center().
x() - 3, minButtonIconRect.
center().
y() + 4);
2788 minButtonIconRect.
center().
x() + 4, minButtonIconRect.
center().
y() + 4);
2795 if (maxButtonRect.
isValid()) {
2800 QRect maxButtonIconRect = maxButtonRect.
adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin);
2802 painter->
setPen(textColor);
2804 painter->
drawLine(maxButtonIconRect.
left() + 1, maxButtonIconRect.
top() + 1,
2805 maxButtonIconRect.
right() - 1, maxButtonIconRect.
top() + 1);
2806 painter->
setPen(textAlphaColor);
2807 const QPoint points[4] = {
2820 if (closeButtonRect.
isValid()) {
2824 QRect closeIconRect = closeButtonRect.
adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin);
2825 painter->
setPen(textAlphaColor);
2826 const QLine lines[4] = {
2828 closeIconRect.
right(), closeIconRect.
bottom() - 1),
2830 closeIconRect.
right() - 1, closeIconRect.
bottom()),
2832 closeIconRect.
left(), closeIconRect.
bottom() - 1),
2834 closeIconRect.
left() + 1, closeIconRect.
bottom())
2837 const QPoint points[4] = {
2845 painter->
setPen(textColor);
2847 closeIconRect.
right() - 1, closeIconRect.
bottom() - 1);
2849 closeIconRect.
right() - 1, closeIconRect.
top() + 1);
2860 if (normalButtonRect.
isValid()) {
2864 QRect normalButtonIconRect = normalButtonRect.
adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin);
2867 QRect frontWindowRect = normalButtonIconRect.
adjusted(0, 3, -3, 0);
2868 painter->
setPen(textColor);
2870 painter->
drawLine(frontWindowRect.
left() + 1, frontWindowRect.
top() + 1,
2871 frontWindowRect.
right() - 1, frontWindowRect.
top() + 1);
2872 painter->
setPen(textAlphaColor);
2873 const QPoint points[4] = {
2881 QRect backWindowRect = normalButtonIconRect.
adjusted(3, 0, 0, -3);
2882 QRegion clipRegion = backWindowRect;
2883 clipRegion -= frontWindowRect;
2886 painter->
setPen(textColor);
2888 painter->
drawLine(backWindowRect.
left() + 1, backWindowRect.
top() + 1,
2889 backWindowRect.
right() - 1, backWindowRect.
top() + 1);
2890 painter->
setPen(textAlphaColor);
2891 const QPoint points2[4] = {
2906 if (contextHelpButtonRect.
isValid()) {
2913 QColor alpha = textColor;
2915 image.
setColor(1, textColor.rgba());
2925 if (shadeButtonRect.
isValid()) {
2930 image.
setColor(1, textColor.rgba());
2938 if (unshadeButtonRect.
isValid()) {
2943 image.
setColor(1, textColor.rgba());
2951 if (!titleBar->icon.isNull()) {
2952 titleBar->icon.paint(painter, iconRect);
2955 tool.
palette = titleBar->palette;
2957 tool.
rect = iconRect;
2967 #ifndef QT_NO_SCROLLBAR 2970 if (
const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
2989 painter->
setPen(darkOutline);
2994 painter->
setPen(darkOutline);
3001 QRect pixmapRect = scrollBarSlider;
3003 pixmapRect.
adjust(-1, 0, 0, -1);
3005 pixmapRect.
adjust(0, -1, -1, 0);
3019 gradient.setColorAt(0, gradientStartColor.
lighter(110));
3020 gradient.setColorAt(1, gradientStopColor.
lighter(110));
3022 gradient.setColorAt(0, gradientStartColor);
3023 gradient.setColorAt(1, gradientStopColor);
3032 int yoffset, xoffset;
3043 scrollBarSlider.
bottom() - yoffset,
3044 scrollBarSlider.
right() - xoffset,
3045 scrollBarSlider.
bottom() - yoffset);
3047 scrollBarSlider.
top() + yoffset,
3048 scrollBarSlider.
right() - xoffset,
3049 scrollBarSlider.
bottom() - yoffset);
3052 painter->
setPen(
QPen(gradientStartColor, 0));
3054 scrollBarSlider.
top() + yoffset,
3055 scrollBarSlider.
right() - xoffset,
3056 scrollBarSlider.
top() + yoffset);
3058 scrollBarSlider.
top() + yoffset,
3059 scrollBarSlider.
left() + xoffset,
3060 scrollBarSlider.
bottom() - yoffset);
3070 gradient.setColorAt(1, gradientStopColor.
lighter(110));
3072 gradient.setColorAt(0, gradientStartColor);
3073 gradient.setColorAt(1, gradientStopColor);
3075 painter->
setPen(darkOutline);
3082 for (
int i = -3; i< 6 ; i += 3) {
3086 scrollBarSlider.
top() + gripMargin),
3088 scrollBarSlider.
bottom() - gripMargin));
3092 scrollBarSlider.
top() + gripMargin ),
3094 scrollBarSlider.
bottom() - gripMargin));
3097 for (
int i = -3; i < 6 ; i += 3) {
3101 scrollBarSlider.
center().
y()+ i),
3103 scrollBarSlider.
center().
y()+ i));
3107 scrollBarSlider.
center().
y() + 1 + i),
3109 scrollBarSlider.
center().
y() + 1 + i));
3117 QRect pixmapRect = scrollBarSubLine;
3124 gradientStopColor.
darker(120),
3125 gradientStopColor.
darker(120),
3130 gradientStartColor.
lighter(105),
3142 subButton.setColor(1, alphaCornerColor.
rgba());
3143 subButton.setColor(2, darkOutline.
rgba());
3145 subButton.setColor(3, gradientStopColor.
darker(140).
rgba());
3146 subButton.setColor(4, gradientStopColor.
darker(120).
rgba());
3148 subButton.setColor(3, gradientStartColor.
lighter(105).
rgba());
3149 subButton.setColor(4, gradientStopColor.
rgba());
3151 subButton.setColor(5, scrollBar->palette.text().color().rgba());
3152 painter->
drawImage(pixmapRect, subButton);
3161 arrowOpt.
rect = scrollBarSubLine.
adjusted(3, 3, -2, -2);
3168 QRect pixmapRect = scrollBarAddLine;
3175 gradientStopColor.
darker(120),
3176 gradientStopColor.
darker(120),
3181 gradientStartColor.
lighter(105),
3193 addButton.setColor(1, alphaCornerColor.
rgba());
3194 addButton.setColor(2, darkOutline.
rgba());
3196 addButton.setColor(3, gradientStopColor.
darker(140).
rgba());
3197 addButton.setColor(4, gradientStopColor.
darker(120).
rgba());
3199 addButton.setColor(3, gradientStartColor.
lighter(105).
rgba());
3200 addButton.setColor(4, gradientStopColor.
rgba());
3202 addButton.setColor(5, scrollBar->palette.text().color().rgba());
3203 painter->
drawImage(pixmapRect, addButton);
3212 arrowOpt.
rect = scrollBarAddLine.
adjusted(3, 3, -2, -2);
3219 #endif // QT_NO_SCROLLBAR 3220 #ifndef QT_NO_COMBOBOX 3223 if (
const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
3224 bool sunken = comboBox->state &
State_On;
3231 if (comboBox->editable)
3237 cache =
QPixmap(comboBox->rect.size());
3240 QRect pixmapRect(0, 0, comboBox->rect.width(), comboBox->rect.height());
3242 comboBoxCopy.
rect = pixmapRect;
3244 QRect rect = pixmapRect;
3250 if (comboBox->editable) {
3252 buttonOption.QStyleOption::operator=(*comboBox);
3253 buttonOption.
rect = rect;
3296 buttonOption.QStyleOption::operator=(*comboBox);
3297 buttonOption.
rect = rect;
3337 if (comboBox->editable) {
3340 downArrow.
setColor(1, comboBox->palette.foreground().color().rgba());
3342 downArrowRect.
center().
y() - downArrow.
height() / 2 + 1, downArrow);
3346 upArrow.
setColor(1, comboBox->palette.foreground().color().rgba());
3348 downArrow.
setColor(1, comboBox->palette.foreground().color().rgba());
3350 downArrowRect.
center().
y() - upArrow.
height() - 1 , upArrow);
3352 downArrowRect.
center().
y() + 2, downArrow);
3356 if (focus && !comboBox->editable
3366 painter->
drawPixmap(comboBox->rect.topLeft(), cache);
3370 #endif // QT_NO_COMBOBOX 3371 #ifndef QT_NO_GROUPBOX 3374 if (
const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
3382 frame.QStyleOption::operator=(*groupBox);
3383 frame.
features = groupBox->features;
3389 QRegion region(groupBox->rect);
3391 region -= checkBoxRect.
united(textRect).
adjusted(ltr ? -4 : 0, 0, ltr ? 0 : 4, 0);
3401 if (!groupBox->text.isEmpty()) {
3402 QColor textColor = groupBox->textColor;
3404 painter->
setPen(textColor);
3405 int alignment = int(groupBox->textAlignment);
3421 box.QStyleOption::operator=(*groupBox);
3422 box.
rect = checkBoxRect;
3428 #endif // QT_NO_GROUPBOX 3429 #ifndef QT_NO_SLIDER 3431 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
3455 cache =
QPixmap(pixmapRect.size());
3459 groovePainter.
setPen(shadowAlpha);
3463 groovePainter.
setPen(highlightAlpha);
3468 gradient.
setStart(pixmapRect.center().x(), pixmapRect.top());
3469 gradient.
setFinalStop(pixmapRect.center().x(), pixmapRect.bottom());
3472 gradient.
setStart(pixmapRect.left(), pixmapRect.center().y());
3473 gradient.
setFinalStop(pixmapRect.right(), pixmapRect.center().y());
3479 groovePainter.
drawRect(pixmapRect.adjusted(1, 1, -2, -2));
3480 groovePainter.
end();
3489 cache =
QPixmap(pixmapRect.size());
3494 gradient.
setStart(pixmapRect.center().x(), pixmapRect.top());
3495 gradient.
setFinalStop(pixmapRect.center().x(), pixmapRect.bottom());
3498 gradient.
setStart(pixmapRect.left(), pixmapRect.center().y());
3499 gradient.
setFinalStop(pixmapRect.right(), pixmapRect.center().y());
3505 groovePainter.
drawRect(pixmapRect.adjusted(1, 1, -2, -2));
3506 groovePainter.
end();
3510 if (slider->upsideDown)
3515 if (slider->upsideDown)
3537 QColor gradientStopColor = gradientStartColor.
darker(108);
3540 QColor gradientBgStartColor = gradientStartColor;
3541 QColor gradientBgStopColor = gradientStopColor;
3554 gradientBgStartColor,
3555 gradientBgStopColor,
3558 handlePainter.setPen(
QPen(outline.
darker(110), 1));
3563 handlePainter.save();
3565 handlePainter.translate(0.5, 0.5);
3566 const QLine lines[4] = {
3572 handlePainter.drawLines(lines, 4);
3573 handlePainter.restore();;
3574 handlePainter.setPen(
QPen(outline.
darker(130), 1));
3579 handlePainter.setPen(cornerAlpha);
3589 handlePainter.setPen(shadowAlpha);
3597 gradientStopColor.
darker(106),
3602 for (
int i = -3; i< 6 ; i += 3) {
3603 for (
int j = -3; j< 6 ; j += 3) {
3604 handlePainter.fillRect(r.
center().
x() + i, r.
center().
y() + j, 2, 2, highlightAlpha);
3605 handlePainter.setPen(gripShadow);
3606 handlePainter.drawPoint(r.
center().
x() + i, r.
center().
y() + j );
3609 handlePainter.end();
3617 fropt.QStyleOption::operator=(*slider);
3618 fropt.
rect = slider->rect;
3623 painter->
setPen(darkOutline);
3626 int interval = slider->tickInterval;
3627 if (interval <= 0) {
3628 interval = slider->singleStep;
3633 interval = slider->pageStep;
3638 int v = slider->minimum;
3640 while (v <= slider->maximum + 1) {
3641 if (v == slider->maximum + 1 && interval == 1)
3643 const int v_ =
qMin(v, slider->maximum);
3646 ? slider->rect.width()
3647 : slider->rect.height()) - len,
3648 slider->upsideDown) + len / 2;
3649 int extra = 2 - ((v_ == slider->minimum || v_ == slider->maximum) ? 1 : 0);
3653 painter->
drawLine(pos, slider->rect.top() + extra,
3654 pos, slider->rect.top() + tickSize);
3657 painter->
drawLine(pos, slider->rect.bottom() - extra,
3658 pos, slider->rect.bottom() - tickSize);
3662 painter->
drawLine(slider->rect.left() + extra, pos,
3663 slider->rect.left() + tickSize, pos);
3666 painter->
drawLine(slider->rect.right() - extra, pos,
3667 slider->rect.right() - tickSize, pos);
3671 int nextInterval = v + interval;
3672 if (nextInterval < v)
3681 #endif // QT_NO_SLIDER 3684 if (
const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(option))
3687 #endif // QT_NO_DIAL 3803 if (
const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(option)) {
3804 if (!btn->text.isEmpty() && newSize.
width() < 80)
3806 if (!btn->icon.isNull() && btn->iconSize.height() > 16)
3807 newSize -=
QSize(0, 2);
3808 newSize +=
QSize(0, 1);
3810 if (
const QPushButton *button = qobject_cast<const QPushButton *>(widget)) {
3811 if (qobject_cast<const QDialogButtonBox *>(button->parentWidget())) {
3812 if (newSize.
height() < 32)
3817 #ifndef QT_NO_GROUPBOX 3820 if (
const QGroupBox *gb = qobject_cast<const QGroupBox*>(widget)) {
3821 QFont font = gb->font();
3825 if (gb->isCheckable()) {
3831 newSize +=
QSize(0, 1);
3833 #endif //QT_NO_GROUPBOX 3836 newSize +=
QSize(0, 1);
3839 #ifndef QT_NO_TOOLBAR 3840 if (widget && qobject_cast<QToolBar *>(widget->
parentWidget()))
3841 newSize +=
QSize(4, 6);
3842 #endif // QT_NO_TOOLBAR 3845 newSize +=
QSize(0, -2);
3848 newSize +=
QSize(2, 4);
3851 newSize +=
QSize(0, 4);
3854 newSize +=
QSize(0, 2);
3857 if (
const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
3859 if (!menuItem->text.isEmpty()) {
3860 newSize.
setHeight(menuItem->fontMetrics.height());
3863 #ifndef QT_NO_COMBOBOX 3864 else if (!menuItem->icon.isNull()) {
3865 if (
const QComboBox *combo = qobject_cast<const QComboBox*>(widget)) {
3869 #endif // QT_NO_COMBOBOX 3873 newSize +=
QSize(4, 4);
3876 if (
const QStyleOptionComplex *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(option)) {
3884 newSize =
QSize(width, 19);
3886 newSize =
QSize(60, 19);
3909 if (qobject_cast<QAbstractButton*>(widget)
3911 || qobject_cast<QComboBox *>(widget)
3914 || qobject_cast<QProgressBar *>(widget)
3917 || qobject_cast<QScrollBar *>(widget)
3920 || qobject_cast<QSplitterHandle *>(widget)
3922 || qobject_cast<QAbstractSlider *>(widget)
3924 || qobject_cast<QAbstractSpinBox *>(widget)
3926 || (widget->
inherits(
"QWorkspaceChild"))
3927 || (widget->
inherits(
"QDockSeparator"))
3928 || (widget->
inherits(
"QDockWidgetSeparator"))
3945 if (
qGray(highlightText.
rgb()) < 128)
3956 if (qobject_cast<QAbstractButton*>(widget)
3958 || qobject_cast<QComboBox *>(widget)
3961 || qobject_cast<QProgressBar *>(widget)
3964 || qobject_cast<QScrollBar *>(widget)
3967 || qobject_cast<QSplitterHandle *>(widget)
3969 || qobject_cast<QAbstractSlider *>(widget)
3971 || qobject_cast<QAbstractSpinBox *>(widget)
3973 || (widget->
inherits(
"QWorkspaceChild"))
3974 || (widget->
inherits(
"QDockSeparator"))
3975 || (widget->
inherits(
"QDockWidgetSeparator"))
3998 #ifndef QT_NO_SLIDER 4000 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
4002 switch (subControl) {
4007 int centerY = slider->rect.center().y() - rect.
height() / 2;
4009 centerY += tickSize;
4011 centerY -= tickSize;
4016 int centerX = slider->rect.center().x() - rect.
width() / 2;
4018 centerX += tickSize;
4020 centerX -= tickSize;
4026 QPoint grooveCenter = slider->rect.center();
4030 grooveCenter.
ry() += tickSize;
4032 grooveCenter.
ry() -= tickSize;
4036 grooveCenter.
rx() += tickSize;
4038 grooveCenter.
rx() -= tickSize;
4048 #endif // QT_NO_SLIDER 4051 #ifndef QT_NO_SPINBOX 4053 if (
const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
4055 int center = spinbox->rect.height() / 2;
4061 x = spinbox->rect.width() - y - bs.
width() + 2;
4064 switch (subControl) {
4068 rect =
QRect(x, fw, bs.
width(), center - fw);
4074 rect =
QRect(x, center, bs.
width(), spinbox->rect.bottom() - center - fw + 1);
4078 rect =
QRect(lx, fw, spinbox->rect.width() - 2*fw, spinbox->rect.height() - 2*fw);
4080 rect =
QRect(lx, fw, rx -
qMax(fw - 1, 0), spinbox->rect.height() - 2*fw);
4084 rect = spinbox->rect;
4088 rect =
visualRect(spinbox->direction, spinbox->rect, rect);
4091 #endif // Qt_NO_SPINBOX 4092 #ifndef QT_NO_GROUPBOX 4094 if (
const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(option)) {
4099 if (!groupBox->text.isEmpty()) {
4100 topHeight = groupBox->fontMetrics.height();
4102 topMargin = topHeight / 2;
4104 topMargin = topHeight;
4106 QRect frameRect = groupBox->rect;
4107 frameRect.
setTop(topMargin);
4114 int leftMarginExtension = 16;
4115 rect = frameRect.
adjusted(leftMarginExtension + margin, margin + topHeight, -margin, -margin);
4120 if (
const QGroupBox *groupBoxWidget = qobject_cast<const QGroupBox *>(widget)) {
4132 rect.
moveTop((fontMetrics.
height() - indicatorHeight) / 2 + 2);
4140 #ifndef QT_NO_COMBOBOX 4142 switch (subControl) {
4153 option->
rect.
width() - 19 - 2 * frameWidth,
4155 if (
const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
4156 if (!box->editable) {
4169 #endif // QT_NO_COMBOBOX 4170 #endif //QT_NO_GROUPBOX 4172 if (
const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(option)) {
4175 const int indent = 3;
4176 const int controlTopMargin = 3;
4177 const int controlBottomMargin = 3;
4178 const int controlWidthMargin = 2;
4179 const int controlHeight = tb->rect.
height() - controlTopMargin - controlBottomMargin ;
4180 const int delta = controlHeight + controlWidthMargin;
4191 ret.
adjust(delta, 0, -delta, 0);
4193 ret.
adjust(0, 0, -delta, 0);
4195 ret.
adjust(0, 0, -delta, 0);
4197 ret.
adjust(0, 0, -delta, 0);
4199 ret.
adjust(0, 0, -delta, 0);
4237 ret.
setRect(tb->rect.right() - indent - offset, tb->rect.top() + controlTopMargin,
4238 controlHeight, controlHeight);
4242 ret.
setRect(tb->rect.left() + controlWidthMargin + indent, tb->rect.top() + controlTopMargin,
4243 controlHeight, controlHeight);
4249 ret =
visualRect(tb->direction, tb->rect, ret);
4272 int alignment,
const QPixmap &pixmap)
const 4334 if (widget && widget->
inherits(
"Q3ComboBox"))
4338 ret = !cmb->editable;
4346 mask->region = option->
rect;
4368 #ifndef QT_NO_WIZARD 4398 if (verticalTitleBar) {
4436 #ifndef QT_NO_IMAGEFORMAT_XPM 4437 switch (standardPixmap) {
4449 #endif //QT_NO_IMAGEFORMAT_XPM 4456 #endif // QT_NO_STYLE_CLEANLOOKS || QT_PLUGIN static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
#define BEGIN_STYLE_PIXMAPCACHE(a)
void polish(QWidget *widget)
Reimplemented Function
void setTransform(const QTransform &transform, bool combine=false)
Sets the world transformation matrix.
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.
void setFinalStop(const QPointF &stop)
Sets the final stop point of this linear gradient in logical coordinates to stop. ...
void setRed(int red)
Sets the red color component of this color to red.
The QColor class provides colors based on RGB, HSV or CMYK values.
QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget=0) const
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
static const char *const dock_widget_close_xpm[]
void polish(QApplication *)
Reimplemented Function
void unpolish(QApplication *)
Reimplemented Function
const QBrush & highlight() const
Returns the highlight brush of the current color group.
The QApplication class manages the GUI application's control flow and main settings.
static const char *const qt_scrollbar_button_left[]
int width(const QString &, int len=-1) const
Returns the width in pixels of the first len characters of text.
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.
QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const
Reimplemented Function
SubControl
This enum describes the available sub controls.
QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget=0) const
Reimplemented Function
void setColor(int i, QRgb c)
Sets the color at the given index in the color table, to the given to colorValue. ...
StyleHint
This enum describes the available style hints.
The QStyleHintReturn class provides style hints that return more than basic data types.
static const char *const qt_scrollbar_button_arrow_left[]
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.
SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *w=0) const
Reimplemented Function
int width() const
Returns the width of the pixmap.
ushort hue
Returns the hue color component of this color.
QPointer< QWidget > widget
static void qt_cleanlooks_draw_buttongradient(QPainter *painter, const QRect &rect, const QColor &gradientStart, const QColor &gradientMid, const QColor &gradientStop, Direction direction=TopDown, QBrush bgBrush=QBrush())
ColorRole
The ColorRole enum defines the different symbolic color roles used in current GUIs.
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...
The QLine class provides a two-dimensional vector using integer precision.
void drawPoints(const QPointF *points, int pointCount)
Draws the first pointCount points in the array points using the current pen's color.
void moveLeft(int pos)
Moves the rectangle horizontally, leaving the rectangle's left edge at the given x coordinate...
const QGradient * gradient() const
Returns the gradient describing this brush.
QStyle::State state
the style flags that are used when drawing the control
QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
QPoint p1() const
Returns the line's start point.
virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget=0) const =0
Returns the rectangle containing the specified subControl of the given complex control (with the styl...
virtual QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const
Returns the area within the given rectangle in which to draw the specified pixmap according to the de...
void rotate(qreal a)
Rotates the coordinate system the given angle clockwise.
const QBrush & background() const
Use window() instead.
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *option, const QWidget *widget=0) const
bool isNull() const
Returns true if it is a null image, otherwise returns false.
ComplexControl
This enum describes the available complex controls.
QPoint p2() const
Returns the line's end point.
QRect united(const QRect &other) const
Returns the bounding rectangle of this rectangle and the given rectangle.
static C reverse(const C &l)
void setClipRect(const QRectF &, Qt::ClipOperation op=Qt::ReplaceClip)
Enables clipping, and sets the clip region to the given rectangle using the given clip operation...
static const char *const qt_cleanlooks_radiobutton_checked[]
The QStyleOptionTitleBar class is used to describe the parameters for drawing a title bar...
void setGreen(int green)
Sets the green color component of this color to green.
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.
virtual int styleHint(StyleHint stylehint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const =0
Returns an integer representing the specified style hint for the given widget described by the provid...
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget=0) const
Reimplemented Function
int left() const
Returns the x-coordinate of the rectangle's left edge.
#define END_STYLE_PIXMAPCACHE
static const char *const qt_scrollbar_button_arrow_up[]
int width() const
Returns the width of the rectangle.
int & ry()
Returns a reference to the y coordinate of this point.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
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.
QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const
Reimplemented Function
QStyle::SubControls activeSubControls
This variable holds a bitwise OR of the sub-controls that are active for the complex control...
static const char *const qt_scrollbar_button_up[]
void drawLine(const QLineF &line)
Draws a line defined by line.
ushort red
Returns the red color component of this color.
int height() const
Returns the height of the rectangle.
void setY(int y)
Sets the top edge of the rectangle to the given y coordinate.
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
The QString class provides a Unicode character string.
void setHeight(int h)
Sets the height to the given height.
Q_DECL_CONSTEXPR T qAbs(const T &t)
static const char *const qt_scrollbar_button_right[]
static const char *const qt_spinbox_button_arrow_down[]
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.
void drawControl(ControlElement ce, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
Reimplemented Function
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).
QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const
Reimplemented Function
void drawPoint(const QPointF &pt)
Draws a single point at the given position using the current pen's color.
static const char *const qt_cleanlooks_radiobutton[]
static int sliderPositionFromValue(int min, int max, int val, int space, bool upsideDown=false)
Converts the given logicalValue to a pixel position.
bool frame
whether the spin box has a frame
void save()
Saves the current painter state (pushes the state onto a stack).
static const char *const qt_cleanlooks_arrow_up_xpm[]
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
QString elidedText(const QString &text, Qt::TextElideMode mode, int width, int flags=0) const
If the string text is wider than width, returns an elided version of the string (i.
StandardPixmap
This enum describes the available standard pixmaps.
static const char *const qt_scrollbar_button_down[]
static QPixmap * find(const QString &key)
void setHsv(int h, int s, int v, int a=255)
Sets a HSV color value; h is the hue, s is the saturation, v is the value and a is the alpha componen...
void setObjectName(const QString &name)
ColorGroup currentColorGroup() const
Returns the palette's current color group.
void setWidth(int w)
Sets the width to the given width.
void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const
Reimplemented Function
QRect boundingRect(QChar) const
Returns the rectangle that is covered by ink if character ch were to be drawn at the origin of the co...
QGradientStops stops() const
Returns the stop points for this gradient.
QColor darker(int f=200) const
Returns a darker (or lighter) color, but does not change this object.
static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor=50)
int lineWidth
the line width for drawing the frame
The QStyleOptionProgressBarV2 class is used to describe the parameters necessary for drawing a progre...
int width() const
Returns the width.
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...
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=0, const QWidget *widget=0) const
Returns an icon for the given standardIcon.
void drawRects(const QRectF *rects, int rectCount)
Draws the first rectCount of the given rectangles using the current pen and brush.
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.
QFontMetrics fontMetrics() const
Returns the font metrics for the painter if the painter is active.
ushort value
Returns the value color component of this color.
void setBrush(ColorRole cr, const QBrush &brush)
Sets the brush for the given color role to the specified brush for all groups in the palette...
void drawDial(const QStyleOptionSlider *option, QPainter *painter)
static void qt_cleanlooks_draw_gradient(QPainter *painter, const QRect &rect, const QColor &gradientStart, const QColor &gradientStop, Direction direction=TopDown, QBrush bgBrush=QBrush())
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.
static const int windowsItemFrame
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
virtual QPalette standardPalette() const
Returns the style's standard palette.
The QStyleOption class stores the parameters used by QStyle functions.
ushort saturation
Returns the saturation color component of this color.
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.
QCleanlooksStyle()
Constructs a QCleanlooksStyle object.
QSize size() const
Returns the size of the rectangle.
Mode
This enum type describes the mode for which a pixmap is intended to be used.
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
The QComboBox widget is a combined button and popup list.
const QBrush & mid() const
Returns the mid brush of the current color group.
virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given primitive element with the provided painter using the style options specified by opti...
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.
void setSize(const QSize &s)
Sets the size of the rectangle to the given size.
The QImage class provides a hardware-independent image representation that allows direct access to th...
void transpose()
Swaps the width and height values.
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
int pixelMetric(PixelMetric pm, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
The QGroupBox widget provides a group box frame with a title.
The QRegion class specifies a clip region for a painter.
The QStyleOptionTabBarBase class is used to describe the base of a tab bar, i.e.
static const char *const qt_cleanlooks_arrow_down_xpm[]
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...
void setBlue(int blue)
Sets the blue color component of this color to blue.
The QFontInfo class provides general information about fonts.
void setX(int x)
Sets the left edge of the rectangle to the given x coordinate.
FrameFeatures features
a bitwise OR of the features that describe this frame.
static const char *const qt_scrollbar_button_arrow_right[]
static const char *const qt_cleanlooks_checkbox_checked[]
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
static const char *const dock_widget_restore_xpm[]
QSize size() const
Returns the size of the image, i.
static const char *const qt_cleanlooks_menuitem_checkbox_checked[]
void moveCenter(const QPoint &p)
Moves the rectangle, leaving the center point at the given position.
int styleHint(StyleHint hint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const
Reimplemented Function
Q_CORE_EXPORT QTextStream & center(QTextStream &s)
QPoint topRight() const
Returns the position of the rectangle's top-right corner.
const QBrush & brush() const
Returns the painter's current brush.
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
#define QT_NO_PROGRESSBAR
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.
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.
Q_GUI_EXPORT_INLINE int qGray(int r, int g, int b)
static void qt_cleanlooks_draw_mdibutton(QPainter *painter, const QStyleOptionTitleBar *option, const QRect &tmp, bool hover, bool sunken)
The QStyleHintReturnMask class provides style hints that return a QRegion.
int top() const
Returns the y-coordinate of the rectangle's top edge.
int width() const
Returns the width of the image.
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...
The QCleanlooksStyle class provides a widget style similar to the Clearlooks style available in GNOME...
ushort blue
Returns the blue color component of this color.
void setClipRegion(const QRegion &, Qt::ClipOperation op=Qt::ReplaceClip)
Sets the clip region to the given region using the specified clip operation.
static const char *const qt_spinbox_button_arrow_up[]
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.
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.
static const char *const qt_scrollbar_button_arrow_down[]
QPalette standardPalette() const
Reimplemented Function
const QBrush & highlightedText() const
Returns the highlighted text brush of the current color group.
int midLineWidth
the mid-line width for drawing the frame
T qstyleoption_cast(const QStyleOption *opt)
QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *widget=0) const
Reimplemented Function
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
int x() const
Returns the x-coordinate of the rectangle's left edge.
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...
static bool insert(const QString &key, const QPixmap &pixmap)
Inserts a copy of the pixmap pixmap associated with the key into the cache.
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.
void setStops(const QGradientStops &stops)
Replaces the current set of stop points with the given stopPoints.
virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given element with the provided painter with the style options specified by option...
static const char *const workspace_minimize[]
void setAlpha(int alpha)
Sets the alpha of this color to alpha.
~QCleanlooksStyle()
Destroys the QCleanlooksStyle object.
The QStyleOptionGroupBox class describes the parameters for drawing a group box.
The QStyleOptionComboBox class is used to describe the parameter for drawing a combobox.
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.
qreal pointSizeF() const
Returns the point size of the matched window system font.
int height() const
Returns the height.
Qt::LayoutDirection direction
the text layout direction that should be used when drawing text in the control
qreal widthF() const
Returns the pen width with floating point precision.
if(void) toggleToolbarShown
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 QTextOption class provides a description of general rich text properties.
void getRect(int *x, int *y, int *w, int *h) const
Extracts the position of the rectangle's top-left corner to *x and *y, and its dimensions to *width a...
int height() const
Returns the height of the image.
The QStyleOptionFrameV2 class is used to describe the parameters necessary for drawing a frame in Qt ...
int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
void drawRect(const QRectF &rect)
Draws the current rectangle with the current pen and brush.
static const int windowsItemHMargin
int y() const
Returns the y coordinate of this point.
void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags=Qt::AutoColor)
const QStyle * proxy() const
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...
int styleHint(StyleHint hint, const QStyleOption *option=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const
Reimplemented Function
The QStyleOptionTab class is used to describe the parameters for drawing a tab bar.
void setPointSizeF(qreal)
Sets the point size to pointSize.
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
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...
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 drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
Reimplemented Function
QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget=0) const
Reimplemented Function
int x() const
Returns the x coordinate of this point.
static const char *const qt_titlebar_context_help[]
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.
QRgb rgba() const
Returns the RGB value of the color, including its alpha.
The QWindowsStyle class provides a Microsoft Windows-like look and feel.
void moveTop(int pos)
Moves the rectangle vertically, leaving the rectangle's top edge at the given y coordinate.
static const int windowsItemVMargin
The QStyleOptionProgressBar class is used to describe the parameters necessary for drawing a progress...
int height() const
Returns the height of the font.
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
QColor lighter(int f=150) const
Returns a lighter (or darker) color, but does not change this object.
void drawPrimitive(PrimitiveElement elem, const QStyleOption *option, QPainter *painter, const QWidget *widget=0) const
Reimplemented Function
void setStart(const QPointF &start)
Sets the start point of this linear gradient in logical coordinates to start.
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 titleBarState
the state of the title bar
static bool isRightToLeft()
Returns true if the application's layout direction is Qt::RightToLeft; otherwise returns false...
ushort green
Returns the green color component of this color.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QRect rect
the area that should be used for various calculations and painting
QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const
Reimplemented Function
QStyle::SubControls subControls
This variable holds a bitwise OR of the sub-controls to be drawn for the complex control.
QRgb rgb() const
Returns the RGB value of the color.
void unpolish(QWidget *widget)
Reimplemented Function
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
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) 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 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.
Qt::LayoutDirection direction
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.
static const int windowsRightBorder
The QPalette class contains color groups for each widget state.
The QIcon class provides scalable icons in different modes and states.