44 #if !defined(QT_NO_STYLE_PLASTIQUE) || defined(QT_PLUGIN) 90 #include <private/qstylehelper_p.h> 455 QMutableVectorIterator<QGradientStop>
it(stops);
457 while (it.hasNext()) {
459 tmpColor = it.
value().second;
464 switch (gradient->type()) {
478 qWarning(
"QPlastiqueStyle::qBrushLight() - unknown gradient type" 479 " - falling back to QLinearGradient");
502 *rgb++ = tmpColor.
rgba();
521 QMutableVectorIterator<QGradientStop>
it(stops);
522 while (it.hasNext()) {
527 switch (gradient->type()) {
541 qWarning(
"QPlastiqueStyle::qBrushLight() - unknown gradient type" 542 " - falling back to QLinearGradient");
583 QMutableVectorIterator<QGradientStop>
it(stops);
584 while (it.hasNext()) {
589 switch (gradient->type()) {
603 qWarning(
"QPlastiqueStyle::qBrushDark() - unknown gradient type" 604 " - falling back to QLinearGradient");
732 const int maxFactor = 100;
734 tmp.
setRed((tmp.
red() * factor) / maxFactor + (colorB.
red() * (maxFactor - factor)) / maxFactor);
735 tmp.
setGreen((tmp.
green() * factor) / maxFactor + (colorB.
green() * (maxFactor - factor)) / maxFactor);
736 tmp.
setBlue((tmp.
blue() * factor) / maxFactor + (colorB.
blue() * (maxFactor - factor)) / maxFactor);
741 const QColor &gradientStop)
768 gradient.setColorAt(1, gradientStop);
800 painter->
setPen(borderColor);
813 painter->
setPen(alphaCornerColor);
829 painter->
setPen(gradientStartColor);
881 QColor mdiButtonGradientStartColor;
882 QColor mdiButtonGradientStopColor;
884 mdiButtonGradientStartColor =
QColor((hover || sunken) ? 0x7d8bb1 : 0x55689a);
885 mdiButtonGradientStopColor =
QColor((hover || sunken) ? 0x939ebe : 0x7381ab);
887 mdiButtonGradientStartColor =
QColor((hover || sunken) ? 0x9e9e9e : 0x818181);
888 mdiButtonGradientStopColor =
QColor((hover || sunken) ? 0xababab : 0x929292);
892 mdiButtonGradientStartColor, mdiButtonGradientStopColor);
894 QColor mdiButtonBorderColor;
896 mdiButtonBorderColor = (hover || sunken) ?
QColor(0x627097) :
QColor(0x324577);
898 mdiButtonBorderColor = (hover || sunken) ?
QColor(0x838383) :
QColor(0x5e5e5e);
900 painter->
setPen(
QPen(mdiButtonBorderColor, 1));
902 const QLine lines[4] = {
909 const QPoint points[4] = {
917 #ifndef QT_NO_DOCKWIDGET 922 int width = textWidth ? *textWidth : fontMetrics.
width(text);
924 if (width > rect.
width()) {
929 int width = fontMetrics.
width(leftHalf + ellipsis + rightHalf);
930 if (width < rect.
width()) {
931 title = leftHalf + ellipsis + rightHalf;
936 width = fontMetrics.
width(leftHalf + ellipsis + rightHalf);
937 if (width < rect.
width()) {
938 title = leftHalf + ellipsis + rightHalf;
950 #if !defined(QT_NO_DOCKWIDGET) || !defined(QT_NO_SPLITTER) 965 handle.setColor(1, alphaCornerColor.
rgba());
969 const int spacing = 2;
972 int nchunks = rect.
width() / (handle.width() + spacing);
973 for (
int i = 0; i < nchunks; ++i)
976 int nchunks = rect.
height() / (handle.height() + spacing);
977 for (
int i = 0; i < nchunks; ++i)
992 #ifndef QT_NO_PROGRESSBAR 1059 #ifndef QT_NO_LINEEDIT 1064 #endif // QT_NO_LINEEDIT 1066 frameOpt.
rect = rect;
1071 frameOpt.
rect.
adjust(reverse ? -2 : 0, 0, reverse ? 0 : 2, 0);
1127 const QLine lines[4] = {
1158 #ifndef QT_NO_TABWIDGET 1177 switch (twf->shape) {
1180 tabBarRect =
QRect(twf->rect.right() - twf->leftCornerWidgetSize.width() - twf->tabBarSize.width() + 1, twf->rect.top(), twf->tabBarSize.width(), borderThickness);
1182 tabBarRect =
QRect(twf->rect.left() + twf->leftCornerWidgetSize.width(), twf->rect.top(), twf->tabBarSize.width(), borderThickness);
1185 tabBarRect =
QRect(twf->rect.left(), twf->rect.top() + twf->leftCornerWidgetSize.height(), borderThickness, twf->tabBarSize.height());
1188 tabBarRect =
QRect(twf->rect.right() - borderThickness + 1, twf->rect.top() + twf->leftCornerWidgetSize.height(),
1189 borderThickness, twf->tabBarSize.height());
1193 tabBarRect =
QRect(twf->rect.right() - twf->leftCornerWidgetSize.width() - twf->tabBarSize.width() + 1,
1194 twf->rect.bottom() - borderThickness + 1, twf->tabBarSize.width(), borderThickness);
1196 tabBarRect =
QRect(twf->rect.left() + twf->leftCornerWidgetSize.width(),
1197 twf->rect.bottom() - borderThickness + 1, twf->tabBarSize.width(), borderThickness);
1204 region -= tabBarRect;
1244 lines.
append(bottomLine);
1249 points.
append(leftBottomOuterCorner);
1250 points.
append(rightBottomOuterCorner);
1251 points.
append(rightTopOuterCorner);
1252 points.
append(leftTopOuterCorner);
1261 lines.
append(innerLeftLine);
1262 lines.
append(innerTopLine);
1269 lines.
append(innerRightLine);
1270 lines.
append(innerBottomLine);
1277 points.
append(leftBottomInnerCorner1);
1278 points.
append(leftBottomInnerCorner2);
1279 points.
append(rightBottomInnerCorner1);
1280 points.
append(rightBottomInnerCorner2);
1281 points.
append(rightTopInnerCorner1);
1282 points.
append(rightTopInnerCorner2);
1283 points.
append(leftTopInnerCorner1);
1284 points.
append(leftTopInnerCorner2);
1291 #endif // QT_NO_TABWIDGET 1292 #ifndef QT_NO_TABBAR 1304 region -= tbb->tabBarRect;
1308 QLine bottomLine =
QLine(tbb->rect.bottomLeft(), tbb->rect.bottomRight());
1334 #endif // QT_NO_TABBAR 1335 #ifndef QT_NO_GROUPBOX 1337 if (
const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
1341 painter->
setPen(borderColor);
1350 #endif // QT_NO_GROUPBOX 1360 #ifndef QT_NO_LINEEDIT 1365 if (
const QStyleOptionFrame *lineEdit = qstyleoption_cast<const QStyleOptionFrame *>(option)) {
1368 #ifndef QT_NO_SPINBOX 1370 if (qobject_cast<const QAbstractSpinBox *>(widget->
parentWidget()))
1384 const QLine lines[4] = {
1390 filledRect.
right() - 1, filledRect.
top()),
1395 if (lineEdit->lineWidth != 0)
1401 #endif // QT_NO_LINEEDIT 1407 painter->
setPen(borderColor);
1409 painter->
setPen(alphaCornerColor);
1410 const QPoint points[4] = {
1422 painter->
setPen(alphaCornerColor);
1434 painter->
setPen(alphaCornerColor);
1447 #endif // QT3_SUPPORT 1448 #ifndef QT_NO_MAINWINDOW 1450 if ((widget && qobject_cast<const QMainWindow *>(widget->
parentWidget()))
1459 painter->
setPen(alphaCornerColor);
1469 painter->
setPen(alphaCornerColor);
1476 #endif // QT_NO_MAINWINDOW 1479 if (!usedAntialiasing)
1482 if (!usedAntialiasing)
1491 #ifndef QT_NO_TOOLBAR 1498 rect.
adjust(2, 0, -2, 0);
1519 int nchunks = cacheRect.height() / handle.
height();
1520 int indent = (cacheRect.height() - (nchunks * handle.
height())) / 2;
1521 for (
int i = 0; i < nchunks; ++i)
1522 cachePainter.
drawImage(
QPoint(cacheRect.left() + 3, cacheRect.top() + indent + i * handle.
height()),
1525 int nchunks = cacheRect.width() / handle.
width();
1526 int indent = (cacheRect.width() - (nchunks * handle.
width())) / 2;
1527 for (
int i = 0; i < nchunks; ++i)
1528 cachePainter.
drawImage(
QPoint(cacheRect.left() + indent + i * handle.
width(), cacheRect.top() + 3),
1539 painter->
setPen(alphaCornerColor);
1552 #endif // QT_NO_TOOLBAR 1554 if (
const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
1564 QPen oldPen = p->pen();
1571 p->setBrushOrigin(rect.left() + 1, rect.top() + 1);
1583 QBrush buttonGradientBrush;
1584 QBrush leftLineGradientBrush;
1585 QBrush rightLineGradientBrush;
1586 QBrush sunkenButtonGradientBrush;
1587 QBrush sunkenLeftLineGradientBrush;
1588 QBrush sunkenRightLineGradientBrush;
1591 buttonGradientBrush = buttonBrush;
1592 sunkenButtonGradientBrush =
qBrushDark(buttonBrush, 108);
1593 leftLineGradientBrush =
qBrushLight(buttonBrush, 105);
1594 rightLineGradientBrush =
qBrushDark(buttonBrush, 105);
1595 sunkenLeftLineGradientBrush =
qBrushDark(buttonBrush, 110);
1596 sunkenRightLineGradientBrush =
qBrushDark(buttonBrush, 106);
1606 buttonGradient.setColorAt(0.0, buttonBrush.
color().
lighter(104));
1607 buttonGradient.setColorAt(1.0, buttonBrush.
color().
darker(110));
1609 buttonGradientBrush =
QBrush(buttonGradient);
1613 buttonGradient2.setColorAt(1.0, buttonBrush.
color().
darker(103));
1614 sunkenButtonGradientBrush =
QBrush(buttonGradient2);
1618 buttonGradient3.setColorAt(1.0, buttonBrush.
color());
1619 leftLineGradientBrush =
QBrush(buttonGradient3);
1623 buttonGradient4.setColorAt(1.0, buttonBrush.
color().
darker(110));
1624 rightLineGradientBrush =
QBrush(buttonGradient4);
1628 buttonGradient5.setColorAt(1.0, buttonBrush.
color().
darker(107));
1629 sunkenLeftLineGradientBrush =
QBrush(buttonGradient5);
1633 buttonGradient6.setColorAt(1.0, buttonBrush.
color().
darker(103));
1634 sunkenRightLineGradientBrush =
QBrush(buttonGradient6);
1638 p->fillRect(fillRect,
1640 : buttonGradientBrush, rect));
1644 : buttonGradientBrush, rect), 105), 0));
1645 p->drawLine(
QPointF(rect.left() + 2, rect.top() + 1),
1646 QPointF(rect.right() - 2, rect.top() + 1));
1650 : buttonGradientBrush, rect), 105), 0));
1651 p->drawLine(
QPointF(rect.left() + 2, rect.bottom() - 1),
1652 QPointF(rect.right() - 2, rect.bottom() - 1));
1656 : leftLineGradientBrush, rect), 1));
1657 p->drawLine(
QPointF(rect.left() + 1, rect.top() + 2),
1658 QPointF(rect.left() + 1, rect.bottom() - 2));
1662 : rightLineGradientBrush, rect), 1));
1663 p->drawLine(
QPointF(rect.right() - 1, rect.top() + 2),
1664 QPointF(rect.right() - 1, rect.bottom() - 2));
1667 if (hover && !sunken) {
1669 QBrush hoverOuter = hover;
1674 p->setPen(
QPen(hoverOuter, 0));
1675 lines[0] =
QLine(rect.left() + 1, rect.top() + 1, rect.right() - 1, rect.top() + 1);
1676 lines[1] =
QLine(rect.left() + 1, rect.bottom() - 1, rect.right() - 1, rect.bottom() - 1);
1677 p->drawLines(lines, 2);
1679 QBrush hoverInner = hover;
1681 p->setPen(
QPen(hoverInner, 0));
1682 lines[0] =
QLine(rect.left() + 1, rect.top() + 2, rect.right() - 1, rect.top() + 2);
1683 lines[1] =
QLine(rect.left() + 1, rect.bottom() - 2, rect.right() - 1, rect.bottom() - 2);
1684 p->drawLines(lines, 2);
1686 QBrush hoverSide = hover;
1688 p->setPen(
QPen(hoverSide, 0));
1689 lines[0] =
QLine(rect.left() + 1, rect.top() + 2, rect.left() + 1, rect.bottom() - 2);
1690 lines[1] =
QLine(rect.right() - 1, rect.top() + 2, rect.right() - 1, rect.bottom() - 2);
1691 p->drawLines(lines, 2);
1700 if (
const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
1708 p->setPen(
QPen(border, 0));
1709 const QLine lines[4] = {
1710 QLine(rect.left() + 1, rect.top(), rect.right() - 1, rect.top()),
1711 QLine(rect.left() + 1, rect.bottom(), rect.right() - 1, rect.bottom()),
1712 QLine(rect.left(), rect.top() + 1, rect.left(), rect.bottom() - 1),
1713 QLine(rect.right(), rect.top() + 1, rect.right(), rect.bottom() - 1) };
1714 p->drawLines(lines, 4);
1718 p->setPen(
QPen(corner, 0));
1719 const QPoint points[4] = {
1720 rect.topLeft(), rect.topRight(),
1721 rect.bottomLeft(), rect.bottomRight() };
1722 p->drawPoints(points, 4);
1727 QLinearGradient gradient(rect.center().x(), rect.top(), rect.center().x(), rect.bottom());
1729 gradient.setColorAt(1, baseBrush.
color().
darker(105));
1730 baseBrush = gradient;
1732 p->fillRect(rect.adjusted(1, 1, -1, -1), baseBrush);
1738 p->setPen(
QPen(pen, 0));
1739 p->drawRect(rect.adjusted(1, 1, -2, -2));
1741 p->setPen(
QPen(pen, 0));
1742 p->drawRect(rect.adjusted(2, 2, -3, -3));
1746 p->drawRect(rect.adjusted(2, 2, -3, -3));
1750 bool on = button->state &
State_On;
1754 if (on || (enabled && sunken) || unchanged) {
1761 p->setPen(
QPen(pointBrush, 3));
1762 const QLine lines[2] = {
1763 QLine(rect.left() + 4, rect.top() + 4, rect.right() - 3, rect.bottom() - 3),
1764 QLine(rect.right() - 3, rect.top() + 4, rect.left() + 4, rect.bottom() - 3) };
1765 p->drawLines(lines, 2);
1773 if (
const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(option)) {
1782 p->setPen(
QPen(border, 0));
1786 QLinearGradient gradient(rect.center().x(), rect.top(), rect.center().x(), rect.bottom());
1788 gradient.setColorAt(1, baseBrush.
color().
darker(105));
1789 baseBrush = gradient;
1791 p->setBrush(baseBrush);
1792 p->drawEllipse(
QRectF(rect).adjusted(1, 1, -1, -1));
1798 p->setPen(
QPen(pen, 0));
1801 p->drawEllipse(
QRectF(rect).adjusted(2, 2, -2, -2));
1805 bool on = button->state &
State_On;
1808 if (on || (enabled && sunken)) {
1813 p->setBrush(pointBrush);
1814 p->drawEllipse(
QRectF(rect).adjusted(3, 3, -3, -3));
1821 #ifndef QT_NO_DOCKWIDGET 1833 option->
rect.
center().
y() - height / 2, 3, height);
1837 #endif // QT_NO_DOCKWIDGET 1840 button.QStyleOption::operator=(*option);
1872 if (widget && widget->
inherits(
"Q3DockWindow")) {
1877 option->
rect.
left(), titleBarStop);
1893 if (widget && widget->
inherits(
"Q3DockWindow")) {
1906 if (widget && widget->
inherits(
"Q3DockWindow")) {
1909 option->
rect.
left() + 1, titleBarStop);
1911 option->
rect.
right() - 1, titleBarStop);
1949 QRect fullRect(center.
x() - 4, center.
y() - 4, 9, 9);
1950 painter->
setPen(borderColor);
1952 const QLine lines[4] = {
1953 QLine(fullRect.left() + 1, fullRect.top(),
1954 fullRect.right() - 1, fullRect.top()),
1955 QLine(fullRect.left() + 1, fullRect.bottom(),
1956 fullRect.right() - 1, fullRect.bottom()),
1957 QLine(fullRect.left(), fullRect.top() + 1,
1958 fullRect.left(), fullRect.bottom() - 1),
1959 QLine(fullRect.right(), fullRect.top() + 1,
1960 fullRect.right(), fullRect.bottom() - 1) };
1964 painter->
setPen(alphaCornerColor);
1965 const QPoint points[4] = {
1967 fullRect.topRight(),
1968 fullRect.bottomLeft(),
1969 fullRect.bottomRight() };
1973 QRect adjustedRect = fullRect;
1974 QRect gradientRect(adjustedRect.
left() + 1, adjustedRect.
top() + 1,
1975 adjustedRect.
right() - adjustedRect.
left() - 1,
1976 adjustedRect.
bottom() - adjustedRect.
top() - 1);
1985 painter->
setPen(alphaTextColor);
1986 painter->
drawLine(center.
x() - 2, center.
y(), center.
x() + 2, center.
y());
1988 painter->
drawLine(center.
x(), center.
y() - 2, center.
x(), center.
y() + 2);
2020 QColor lightShadowGradientStartColor = highlightedGradientStartColor.
lighter(105);
2021 QColor lightShadowGradientStopColor = highlightedGradientStopColor.
lighter(105);
2029 #ifndef QT_NO_TABBAR 2031 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(option)) {
2045 bool mouseOver = (tab->state &
State_MouseOver) && !selected && !disabled;
2051 int lowerTop = selected ? 0 : 3;
2054 && !leftCornerWidget;
2055 bool reverseShadow =
false;
2059 if ((atBeginning && !selected) || (selected && leftCornerWidget && ((tab->position ==
QStyleOptionTab::Beginning) || onlyTab))) {
2091 switch (tab->shape) {
2093 vectorUp =
QPoint(0, -1);
2094 vectorDown =
QPoint(0, 1);
2097 vectorLeft =
QPoint(1, 0);
2098 vectorRight =
QPoint(-1, 0);
2099 reverseShadow =
true;
2101 vectorLeft =
QPoint(-1, 0);
2102 vectorRight =
QPoint(1, 0);
2106 topLeft = tab->rect.topRight();
2107 topRight = tab->rect.topLeft();
2108 bottomLeft = tab->rect.bottomRight();
2109 bottomRight = tab->rect.bottomLeft();
2111 topLeft = tab->rect.topLeft();
2112 topRight = tab->rect.topRight();
2113 bottomLeft = tab->rect.bottomLeft();
2114 bottomRight = tab->rect.bottomRight();
2118 baseColor1 = border;
2119 baseColor2 = innerTopLeft;
2122 vectorUp =
QPoint(-1, 0);
2123 vectorDown =
QPoint(1, 0);
2124 vectorLeft =
QPoint(0, -1);
2125 vectorRight =
QPoint(0, 1);
2127 topLeft = tab->rect.topLeft();
2128 topRight = tab->rect.bottomLeft();
2129 bottomLeft = tab->rect.topRight();
2130 bottomRight = tab->rect.bottomRight();
2132 baseColor1 = border;
2133 baseColor2 = innerTopLeft;
2137 vectorDown =
QPoint(-1, 0);
2138 vectorLeft =
QPoint(0, -1);
2139 vectorRight =
QPoint(0, 1);
2141 topLeft = tab->rect.topRight();
2142 topRight = tab->rect.bottomRight();
2143 bottomLeft = tab->rect.topLeft();
2144 bottomRight = tab->rect.bottomLeft();
2146 baseColor1 = border;
2147 baseColor2 = innerBottomRight;
2151 vectorDown =
QPoint(0, -1);
2154 vectorLeft =
QPoint(1, 0);
2155 vectorRight =
QPoint(-1, 0);
2156 reverseShadow =
true;
2158 topLeft = tab->rect.bottomRight();
2159 topRight = tab->rect.bottomLeft();
2160 bottomLeft = tab->rect.topRight();
2161 bottomRight = tab->rect.topLeft();
2163 vectorLeft =
QPoint(-1, 0);
2164 vectorRight =
QPoint(1, 0);
2166 topLeft = tab->rect.bottomLeft();
2167 topRight = tab->rect.bottomRight();
2168 bottomLeft = tab->rect.topLeft();
2169 bottomRight = tab->rect.topRight();
2172 baseColor1 = border;
2173 baseColor2 = innerBottomRight;
2181 topRight += vectorLeft;
2182 bottomRight += vectorLeft;
2189 QPoint adjustTopLineLeft = (vectorRight * (marginLeft + (previousSelected ? 0 : 1))) +
2190 (vectorDown * lowerTop);
2191 QPoint adjustTopLineRight = (vectorDown * lowerTop);
2192 if (atBeginning || selected)
2193 adjustTopLineLeft += vectorRight;
2194 if (atEnd || selected)
2195 adjustTopLineRight += 2 * vectorLeft;
2197 topLine =
QLine(topLeft + adjustTopLineLeft, topRight + adjustTopLineRight);
2202 QPoint adjustLeftLineTop = (vectorRight * marginLeft) + (vectorDown * (lowerTop + 1));
2203 QPoint adjustLeftLineBottom = (vectorRight * marginLeft) + (vectorUp * borderThickness);
2204 if (atBeginning || selected)
2205 adjustLeftLineTop += vectorDown;
2206 if (atBeginning && selected)
2207 adjustLeftLineBottom += borderThickness * vectorDown;
2209 adjustLeftLineBottom += vectorUp;
2211 leftLine =
QLine(topLeft + adjustLeftLineTop, bottomLeft + adjustLeftLineBottom);
2216 QPoint adjustRightLineTop = vectorDown * (2 + lowerTop);
2217 QPoint adjustRightLineBottom = vectorUp * borderThickness;
2219 adjustRightLineBottom += vectorUp;
2221 rightLine =
QLine(topRight + adjustRightLineTop, bottomRight + adjustRightLineBottom);
2225 QPoint startPoint = topLine.
p1() + vectorDown + vectorLeft;
2227 startPoint += vectorDown;
2234 fillRect =
QRect(startPoint, endPoint + vectorLeft + vectorDown * 3).
normalized();
2240 points.
append(rightLine.
p2() + vectorDown);
2241 points.
append(rightLine.
p2() + vectorDown + vectorDown);
2242 points.
append(rightLine.
p2() + vectorDown + vectorDown + vectorRight);
2244 points.
append(leftLine.
p2() + vectorDown);
2245 points.
append(leftLine.
p2() + vectorDown + vectorDown);
2246 points.
append(leftLine.
p2() + vectorDown + vectorDown + vectorLeft);
2250 QBrush buttonGradientBrush;
2253 buttonGradientBrush = buttonBrush;
2258 buttonGradient.setColorAt(1.0, buttonBrush.
color().
darker(110));
2259 buttonGradientBrush =
QBrush(buttonGradient);
2262 painter->
fillRect(fillRect, buttonGradientBrush);
2267 QPoint rightCornerDot = topRight + vectorLeft + (lowerTop + 1)*vectorDown;
2268 QPoint leftCornerDot = topLeft + (marginLeft + 1)*vectorRight + (lowerTop + 1)*vectorDown;
2269 QPoint bottomRightConnectToBase = rightLine.
p2() + vectorRight + vectorDown;
2270 QPoint bottomLeftConnectToBase = leftLine.
p2() + vectorLeft + vectorDown;
2283 QLine secondHoverLine =
QLine(topLine.
p1() + vectorDown * 2 + vectorLeft, topLine.
p2() + vectorDown * 2 + vectorRight);
2284 painter->
setPen(highlightedLightInnerBorderColor);
2285 painter->
drawLine(secondHoverLine);
2291 if (!previousSelected)
2293 if (atEnd || selected) {
2295 points.
append(rightCornerDot);
2297 if (atBeginning || selected)
2298 points.
append(leftCornerDot);
2300 points.
append(bottomRightConnectToBase);
2301 points.
append(bottomLeftConnectToBase);
2303 if (lines.
size() > 0) {
2307 if (points.
size() > 0) {
2314 if (atBeginning || selected)
2315 points.
append(topLine.
p1() + vectorLeft);
2316 if (!previousSelected)
2317 points.
append(leftLine.
p1() + vectorUp);
2318 if (atEnd || selected) {
2319 points.
append(topLine.
p2() + vectorRight);
2320 points.
append(rightLine.
p1() + vectorUp);
2324 points.
append(bottomRightConnectToBase + vectorLeft);
2326 points.
append(bottomLeftConnectToBase + vectorRight);
2332 QPoint p1 = bottomLeftConnectToBase + vectorDown;
2338 if (points.
size() > 0) {
2344 QLine innerTopLine =
QLine(topLine.
p1() + vectorDown, topLine.
p2() + vectorDown);
2347 topLineGradient.
setColorAt(0, lightShadowGradientStartColor);
2348 topLineGradient.setColorAt(1, lightShadowGradientStopColor);
2355 QLine innerLeftLine =
QLine(leftLine.
p1() + vectorRight + vectorDown, leftLine.
p2() + vectorRight);
2356 QLine innerRightLine =
QLine(rightLine.
p1() + vectorLeft + vectorDown, rightLine.
p2() + vectorLeft);
2359 innerRightLine =
QLine(innerRightLine.p1() + vectorUp, innerRightLine.p2());
2360 innerLeftLine =
QLine(innerLeftLine.
p1() + vectorUp, innerLeftLine.
p2());
2363 if (selected || atBeginning) {
2364 QBrush leftLineGradientBrush;
2365 QRect rect =
QRect(innerLeftLine.
p1(), innerLeftLine.
p2()).normalized();
2368 leftLineGradientBrush =
qBrushLight(buttonBrush, 105);
2372 buttonGradient3.setColorAt(1.0, buttonBrush.
color());
2373 leftLineGradientBrush =
QBrush(buttonGradient3);
2377 painter->
setPen(
QPen(leftLineGradientBrush, 0));
2388 if (atEnd || selected) {
2390 QBrush rightLineGradientBrush;
2391 QRect rect =
QRect(innerRightLine.p1(), innerRightLine.p2()).normalized();
2394 rightLineGradientBrush =
qBrushDark(buttonBrush, 105);
2398 buttonGradient4.setColorAt(1.0, buttonBrush.
color().
darker(110));
2399 rightLineGradientBrush =
QBrush(buttonGradient4);
2402 painter->
setPen(
QPen(rightLineGradientBrush, 0));
2415 QLine baseLine =
QLine(bottomLeft + marginLeft * 2 * vectorRight, bottomRight);
2421 if (atEnd && !selected) {
2422 baseLine =
QLine(baseLine.
p1(), baseLine.
p2() + vectorRight);
2426 adjustedRight += vectorLeft;
2427 baseLine =
QLine(baseLine.
p1(), baseLine.
p2() + vectorLeft);
2429 if (previousSelected) {
2430 adjustedLeft += vectorRight;
2431 baseLine =
QLine(baseLine.
p1() + vectorRight, baseLine.
p2());
2434 adjustedLeft += vectorRight;
2440 if (atEnd && !selected)
2443 if (atBeginning && !selected)
2444 adjustedLeft = vectorRight;
2446 adjustedLeft =
QPoint(0, 0);
2449 painter->
drawLine(bottomLeft + vectorUp + adjustedLeft, baseLine.
p2() + vectorUp);
2451 QPoint endPoint = bottomRight + vectorUp;
2452 if (atEnd && !selected)
2456 if (atBeginning && !selected) {
2464 painter->
drawPoint(endPoint + vectorRight);
2467 if (atBeginning && !selected) {
2468 painter->
drawPoint(baseLine.
p1() + 2 * vectorLeft);
2479 #endif // QT_NO_TABBAR 2480 #ifndef QT_NO_PROGRESSBAR 2483 QRect rect = bar->rect;
2489 painter->
setPen(borderColor);
2504 painter->
setPen(alphaCornerColor);
2516 painter->
setPen(gradientStartColor.darker(105));
2524 painter->
setPen(bar->palette.base().color());
2533 if (bar->minimum == 0 && bar->maximum == 0)
2538 QRect rect = bar->rect;
2544 painter->
setPen(bar->palette.text().color());
2546 bool vertical =
false;
2547 bool inverted =
false;
2548 bool bottomToTop =
false;
2552 inverted = bar2->invertedAppearance;
2553 bottomToTop = bar2->bottomToTop;
2569 int progressIndicatorPos = (bar->progress -
qreal(bar->minimum)) /
qMax(
qreal(1.0),
qreal(bar->maximum) - bar->minimum) * rect.
width();
2571 bool flip = (!vertical && (((bar->direction ==
Qt::RightToLeft) && !inverted)
2572 || ((bar->direction ==
Qt::LeftToRight) && inverted))) || (vertical && ((!inverted && !bottomToTop) || (inverted && bottomToTop)));
2574 int indicatorPos = rect.
width() - progressIndicatorPos;
2575 if (indicatorPos >= 0 && indicatorPos <= rect.
width()) {
2576 painter->
setPen(bar->palette.base().color());
2578 }
else if (indicatorPos > rect.
width()) {
2579 painter->
setPen(bar->palette.text().color());
2581 painter->
setPen(bar->palette.base().color());
2584 if (progressIndicatorPos >= 0 && progressIndicatorPos <= rect.
width()) {
2586 }
else if (progressIndicatorPos > rect.
width()) {
2587 painter->
setPen(bar->palette.base().color());
2589 painter->
setPen(bar->palette.text().color());
2597 if (!leftRect.
isNull()) {
2598 painter->
setPen(flip ? bar->palette.text().color() : bar->palette.base().color());
2609 QRect rect = bar->rect;
2610 bool vertical =
false;
2611 bool inverted =
false;
2612 bool indeterminate = (bar->minimum == 0 && bar->maximum == 0);
2613 if (!indeterminate && bar->progress == -1)
2621 inverted = bar2->invertedAppearance;
2634 int maxWidth = rect.
width() - 4;
2636 qint64 progress = qMax<qint64>(bar->progress, bar->minimum);
2637 double vc6_workaround = ((progress -
qint64(bar->minimum)) /
qMax(
double(1.0), double(
qint64(bar->maximum) -
qint64(bar->minimum))) * maxWidth);
2638 int width = indeterminate ? maxWidth :
qMax(
int(vc6_workaround), minWidth);
2644 if (!indeterminate) {
2651 int slideWidth = ((rect.
width() - 4) * 2) / 3;
2652 int step = ((
d->animateStep * slideWidth) /
ProgressBarFps) % slideWidth;
2653 if ((((
d->animateStep * slideWidth) /
ProgressBarFps) % (2 * slideWidth)) >= slideWidth)
2654 step = slideWidth - step;
2656 slideWidth / 2, rect.
height() - 4);
2660 painter->
setPen(highlightedDarkInnerBorderColor);
2665 if (width == minWidth) {
2669 if (indeterminate) {
2671 progressBar.
right() - 2, progressBar.
top()));
2676 progressBar.
right() - 2, progressBar.
top()));
2682 if (indeterminate) {
2684 progressBar.
left(), progressBar.
bottom() - 2));
2687 progressBar.
left(), progressBar.
bottom() - 1));
2692 if (width == minWidth) {
2696 if (indeterminate) {
2698 progressBar.
left() + 2, progressBar.
top()));
2700 progressBar.
left() + 2, progressBar.
bottom()));
2703 progressBar.
left() + 2, progressBar.
top()));
2705 progressBar.
left() + 2, progressBar.
bottom()));
2708 if (indeterminate) {
2716 progressBar.
left(), progressBar.
bottom() - 2));
2719 if (points.
size() > 0) {
2727 painter->
setPen(alphaInnerColor);
2729 if (indeterminate) {
2743 if (indeterminate) {
2765 option, rect.
size());
2772 QRect pixmapRect(0, 0, cache.width(), cache.height());
2776 while (leftEdge < cache.width() + 1) {
2781 rectColor = rectColor.
lighter(105);
2782 lineColor = lineColor.
lighter(105);
2787 cachePainter.
setPen(lineColor);
2788 const QLine cacheLines[2] = {
2789 QLine(pixmapRect.left() + leftEdge - 1, pixmapRect.top(),
2790 pixmapRect.left() + leftEdge + 9, pixmapRect.top()),
2791 QLine(pixmapRect.left() + leftEdge - 1, pixmapRect.bottom(),
2792 pixmapRect.left() + leftEdge + 9, pixmapRect.bottom()) };
2794 cachePainter.
fillRect(
QRect(pixmapRect.left() + leftEdge, pixmapRect.top(),
2795 10, pixmapRect.height()), rectColor);
2805 progressBar.
adjust(0, 1, 0, 1);
2806 if (!indeterminate) {
2811 painter->
drawPixmap(progressBar.
left() - 25 - step + width % 20, progressBar.
top(), cache);
2819 #endif // QT_NO_PROGRESSBAR 2822 if (
const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(option)) {
2843 headerGradientStart, headerGradientStop);
2845 cachePainter.setPen(borderColor);
2846 cachePainter.drawRect(pixmapRect.adjusted(0, 0, -1, -1));
2847 cachePainter.setPen(alphaCornerColor);
2849 const QPoint points[4] = {
2850 pixmapRect.topLeft(), pixmapRect.topRight(),
2851 pixmapRect.bottomLeft(), pixmapRect.bottomRight() };
2852 cachePainter.drawPoints(points, 4);
2857 cachePainter.setPen(lightLine);
2858 lines[0] =
QLine(pixmapRect.left() + 2, pixmapRect.top() + 1,
2859 pixmapRect.right() - 2, pixmapRect.top() + 1);
2860 lines[1] =
QLine(pixmapRect.left() + 1, pixmapRect.top() + 2,
2861 pixmapRect.left() + 1, pixmapRect.bottom() - 2);
2862 cachePainter.drawLines(lines, 2);
2864 cachePainter.setPen(darkLine);
2865 lines[0] =
QLine(pixmapRect.left() + 2, pixmapRect.bottom() - 1,
2866 pixmapRect.right() - 2, pixmapRect.bottom() - 1);
2867 lines[1] =
QLine(pixmapRect.right() - 1, pixmapRect.bottom() - 2,
2868 pixmapRect.right() - 1, pixmapRect.top() + 2);
2869 cachePainter.drawLines(lines, 2);
2881 if (
const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
2893 if (!menuItem->text.isEmpty()) {
2894 painter->
setFont(menuItem->font);
2896 menuItem->palette, menuItem->state &
State_Enabled, menuItem->text,
2898 w = menuItem->fontMetrics.width(menuItem->text) + 5;
2901 painter->
setPen(alphaCornerColor);
2903 painter->
drawLine(menuItem->rect.left() + 5 + (reverse ? 0 : w), menuItem->rect.center().y(),
2904 menuItem->rect.right() - 5 - (reverse ? w : 0), menuItem->rect.center().y());
2912 bool checked = menuItem->checked;
2929 checkRect =
visualRect(menuItem->direction, menuItem->rect, checkRect);
2933 button.
rect = checkRect;
2934 button.
state = menuItem->state;
2937 button.
palette = menuItem->palette;
2940 if (menuItem->icon.isNull()) {
2942 button.
rect = checkRect;
2943 button.
state = menuItem->state;
2946 button.
palette = menuItem->palette;
2948 }
else if (checked) {
2949 int iconSize =
qMax(menuItem->maxIconWidth, 20);
2952 iconSize, iconSize);
2953 sunkenRect =
visualRect(menuItem->direction, menuItem->rect, sunkenRect);
2957 opt.
rect = sunkenRect;
2973 if (!menuItem->icon.isNull()) {
2982 int pixw = pixmap.
width();
2983 int pixh = pixmap.
height();
2985 QRect pmr(0, 0, pixw, pixh);
2988 if (checkable && checked)
2995 painter->
setPen(menuItem->palette.highlightedText().color());
3004 discol = textBrush.
color();
3008 int xpos = menuitem->
rect.
x() + xm;
3027 p->
drawText(vShortcutRect, text_flags, s.
mid(t + 1));
3045 int dim = (menuItem->rect.height() - 4) / 2;
3048 int xpos = menuItem->rect.left() + menuItem->rect.width() - 6 - 2 - dim;
3050 QRect(xpos, menuItem->rect.top() + menuItem->rect.height() / 2 - dim / 2, dim, dim));
3052 newMI.
rect = vSubMenuRect;
3065 #endif // QT_NO_MENU 3066 #ifndef QT_NO_MENUBAR 3078 QRect rect = pixmapRect;
3092 cachePainter.setPen(borderColor);
3093 cachePainter.drawRect(rect.
adjusted(0, 0, -1, -1));
3094 cachePainter.setPen(alphaCornerColor);
3096 const QPoint points[4] = {
3101 cachePainter.drawPoints(points, 4);
3107 cachePainter.setPen(gradientStartColor);
3112 cachePainter.drawLines(lines, 2);
3117 cachePainter.setPen(gradientStopColor.
darker(102));
3120 cachePainter.drawLines(lines, 2);
3129 if (
const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
3137 #ifndef QT_NO_MAINWINDOW 3139 if (widget && qobject_cast<const QMainWindow *>(widget->
parentWidget())) {
3147 #endif // QT_NO_MAINWINDOW 3149 #endif // QT_NO_MENUBAR 3151 #ifndef QT_NO_TOOLBOX 3153 if (
const QStyleOptionToolBox *toolBox = qstyleoption_cast<const QStyleOptionToolBox *>(option)) {
3156 int width = toolBox->rect.width();
3157 int diag = toolBox->rect.height() - 2;
3170 rightMost =
QPoint(toolBox->rect.right(), toolBox->rect.bottom() - 2);
3171 rightEdge =
QPoint(toolBox->rect.right() - width / 10, toolBox->rect.bottom() - 2);
3172 leftEdge =
QPoint(toolBox->rect.right() - width / 10 - diag, toolBox->rect.top());
3173 leftMost =
QPoint(toolBox->rect.left(), toolBox->rect.top());
3177 rightMost =
QPoint(toolBox->rect.left(), toolBox->rect.bottom() - 2);
3178 rightEdge =
QPoint(toolBox->rect.left() + width / 10, toolBox->rect.bottom() - 2);
3179 leftEdge =
QPoint(toolBox->rect.left() + width / 10 + diag, toolBox->rect.top());
3180 leftMost =
QPoint(toolBox->rect.right(), toolBox->rect.top());
3182 rightOne =
QPoint(-1, 0);
3188 painter->
setPen(borderColor);
3189 lines[0] =
QLine(rightMost, rightEdge);
3190 lines[1] =
QLine(rightEdge + leftOne, leftEdge);
3191 lines[2] =
QLine(leftEdge + leftOne, leftMost);
3193 painter->
setPen(toolBox->palette.base().color());
3194 lines[0] =
QLine(rightMost + downOne, rightEdge + downOne);
3195 lines[1] =
QLine(rightEdge + leftOne + downOne, leftEdge + downOne);
3196 lines[2] =
QLine(leftEdge + leftOne + downOne, leftMost + downOne);
3202 #endif // QT_NO_TOOLBOX 3203 #ifndef QT_NO_SPLITTER 3210 option->
rect.
center().
y() - height / 2, 3, height);
3219 #endif // QT_NO_SPLITTER 3220 #ifndef QT_NO_DOCKWIDGET 3222 if (
const QStyleOptionDockWidget *dockWidget = qstyleoption_cast<const QStyleOptionDockWidget *>(option)) {
3233 QRect rect = dockWidget->rect;
3235 if (verticalTitleBar) {
3254 QString title =
elliditide(dockWidget->title, dockWidget->fontMetrics, titleRect, &textWidth);
3268 if (widget && widget->
inherits(
"Q3DockWindowTitleBar")) {
3273 int nchunks = (r.
width() / handle.
width()) - 1;
3274 int indent = (r.
width() - (nchunks * handle.
width())) / 2;
3275 for (
int i = 0; i < nchunks; ++i) {
3283 titleRect.
width() / 2 - textWidth / 2 - margin, titleRect.
bottom());
3284 int nchunks = leftSide.
width() / handle.
width();
3285 int indent = (leftSide.width() - (nchunks * handle.
width())) / 2;
3286 for (
int i = 0; i < nchunks; ++i) {
3288 + i * handle.
width(),
3289 leftSide.center().y()
3295 QRect rightSide = titleRect.
adjusted(titleRect.
width() / 2 + textWidth / 2 + margin, 0, 0, 0);
3296 nchunks = rightSide.
width() / handle.
width();
3297 indent = (rightSide.
width() - (nchunks * handle.
width())) / 2;
3298 for (
int j = 0; j < nchunks; ++j) {
3309 painter->
setPen(dockWidget->palette.windowText().color());
3318 #endif // QT_NO_DOCKWIDGET 3319 #ifndef QT_NO_TOOLBAR 3321 if (
const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(option)) {
3333 painter->
setPen(alphaCornerColor);
3338 painter->
setPen(alphaCornerColor);
3349 painter->
setPen(alphaCornerColor);
3360 painter->
setPen(alphaCornerColor);
3367 painter->
setPen(alphaCornerColor);
3389 painter->
setPen(alphaCornerColor);
3396 painter->
setPen(alphaCornerColor);
3403 painter->
setPen(alphaCornerColor);
3410 painter->
setPen(alphaCornerColor);
3425 #endif // QT_NO_TOOLBAR 3426 #ifndef QT_NO_SCROLLBAR 3428 if (
const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
3439 QRect pixmapRect(0, 0, cache.width(), cache.height());
3445 QLinearGradient gradient(pixmapRect.center().x(), pixmapRect.top() + 2,
3446 pixmapRect.center().x(), pixmapRect.bottom() - 2);
3449 gradient.setColorAt(1, gradientStopColor);
3451 gradient.setColorAt(0, gradientStartColor.lighter(105));
3452 gradient.setColorAt(1, gradientStopColor);
3454 addLinePainter.fillRect(pixmapRect.left() + 2, pixmapRect.top() + 2,
3455 pixmapRect.right() - 3, pixmapRect.bottom() - 3,
3472 addButton.
setColor(3, gradientStartColor.lighter(105).rgba());
3475 addButton.
setColor(5, scrollBar->palette.text().color().rgba());
3476 addLinePainter.drawImage(pixmapRect, addButton);
3481 arrow.
setColor(1, scrollBar->palette.foreground().color().rgba());
3484 addLinePainter.translate(1, 1);
3485 addLinePainter.drawImage(
QPoint(pixmapRect.center().x() - 2, pixmapRect.center().y() - 3), arrow);
3488 arrow.
setColor(1, scrollBar->palette.foreground().color().rgba());
3491 addLinePainter.translate(1, 1);
3492 addLinePainter.drawImage(
QPoint(pixmapRect.center().x() - 3, pixmapRect.center().y() - 2), arrow);
3494 addLinePainter.end();
3502 if (
const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
3518 QColor color = scrollBar->palette.base().color().
darker(sunken ? 125 : 100);
3523 QColor edgeColor = scrollBar->palette.base().color().
darker(125);
3538 groovePainter.
end();
3545 if (
const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
3546 QRect scrollBarSubLine = scrollBar->rect;
3558 button1.
setRect(scrollBarSubLine.
left(), scrollBarSubLine.
top(), scrollBarExtent, scrollBarSubLine.
height());
3559 button2.
setRect(scrollBarSubLine.
right() - (scrollBarExtent - 1), scrollBarSubLine.
top(), scrollBarExtent, scrollBarSubLine.
height());
3561 button1.
setRect(scrollBarSubLine.
left(), scrollBarSubLine.
top(), scrollBarSubLine.
width(), scrollBarExtent);
3562 button2.
setRect(scrollBarSubLine.
left(), scrollBarSubLine.
bottom() - (scrollBarExtent - 1), scrollBarSubLine.
width(), scrollBarExtent);
3570 QRect pixmapRect(0, 0, cache.width(), cache.height());
3578 QRect(pixmapRect.left() + 2, pixmapRect.top() + 2,
3579 pixmapRect.right() - 3, pixmapRect.bottom() - 3),
3584 QRect(pixmapRect.left() + 2, pixmapRect.top() + 2,
3585 pixmapRect.right() - 3, pixmapRect.bottom() - 3),
3586 gradientStartColor.lighter(105),
3598 subButton.setColor(1, alphaCornerColor.
rgba());
3599 subButton.setColor(2, borderColor.
rgba());
3601 subButton.setColor(3, gradientStopColor.
rgba());
3602 subButton.setColor(4, gradientStopColor.
rgba());
3604 subButton.setColor(3, gradientStartColor.lighter(105).rgba());
3605 subButton.setColor(4, gradientStopColor.
rgba());
3607 subButton.setColor(5, scrollBar->palette.text().color().rgba());
3608 subLinePainter.drawImage(pixmapRect, subButton);
3613 arrow.
setColor(1, scrollBar->palette.foreground().color().rgba());
3616 subLinePainter.translate(1, 1);
3617 subLinePainter.drawImage(
QPoint(pixmapRect.center().x() - 2, pixmapRect.center().y() - 3), arrow);
3620 arrow.
setColor(1, scrollBar->palette.foreground().color().rgba());
3623 subLinePainter.translate(1, 1);
3624 subLinePainter.drawImage(
QPoint(pixmapRect.center().x() - 3, pixmapRect.center().y() - 2), arrow);
3626 subLinePainter.end();
3634 if (
const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
3654 pixmapRect.right(), pixmapRect.center().y());
3657 pixmapRect.center().x(), pixmapRect.bottom());
3660 gradient.
setColorAt(0, gradientStartColor.lighter(110));
3661 gradient.setColorAt(1, gradientStopColor.
lighter(105));
3663 gradient.setColorAt(0, gradientStartColor.lighter(105));
3664 gradient.setColorAt(1, gradientStopColor);
3666 sliderPainter.fillRect(pixmapRect.adjusted(2, 2, -2, -2), gradient);
3668 sliderPainter.fillRect(pixmapRect.adjusted(2, 2, -2, -2), option->
palette.
background());
3671 sliderPainter.setPen(borderColor);
3672 sliderPainter.drawRect(pixmapRect.adjusted(0, 0, -1, -1));
3673 sliderPainter.setPen(alphaCornerColor);
3675 QPoint(pixmapRect.left(), pixmapRect.top()),
3676 QPoint(pixmapRect.left(), pixmapRect.bottom()),
3677 QPoint(pixmapRect.right(), pixmapRect.top()),
3678 QPoint(pixmapRect.right(), pixmapRect.bottom()) };
3679 sliderPainter.drawPoints(points, 4);
3682 sliderPainter.setPen(sunken ? gradientStartColor.lighter(110) : gradientStartColor.lighter(105));
3683 lines[0] =
QLine(pixmapRect.left() + 1, pixmapRect.top() + 1,
3684 pixmapRect.right() - 1, pixmapRect.top() + 1);
3685 lines[1] =
QLine(pixmapRect.left() + 1, pixmapRect.top() + 2,
3686 pixmapRect.left() + 1, pixmapRect.bottom() - 2);
3687 sliderPainter.drawLines(lines, 2);
3689 sliderPainter.setPen(sunken ? gradientStopColor.
lighter(105) : gradientStopColor);
3690 lines[0] =
QLine(pixmapRect.left() + 1, pixmapRect.bottom() - 1,
3691 pixmapRect.right() - 1, pixmapRect.bottom() - 1);
3692 lines[1] =
QLine(pixmapRect.right() - 1, pixmapRect.top() + 2,
3693 pixmapRect.right() - 1, pixmapRect.bottom() - 1);
3694 sliderPainter.drawLines(lines, 2);
3697 if ((horizontal && scrollBar->rect.width() > sliderMinLength)
3698 || (!horizontal && scrollBar->rect.height() > sliderMinLength)) {
3702 pattern.
setColor(2, (sunken ? gradientStartColor.lighter(110) : gradientStartColor.lighter(105)).rgba());
3705 sliderPainter.drawImage(pixmapRect.center().x() - pattern.
width() / 2 + 1,
3706 pixmapRect.center().y() - 4,
3709 sliderPainter.drawImage(pixmapRect.center().x() - 4,
3710 pixmapRect.center().y() - pattern.
height() / 2 + 1,
3714 sliderPainter.end();
3723 #ifndef QT_NO_COMBOBOX 3725 if (
const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
3727 if (!comboBox->editable) {
3731 painter->
setPen(
QPen(comboBox->palette.buttonText(), 0));
3733 }
else if (!comboBox->currentIcon.isNull()) {
3737 editRect.
adjust(0, 2, -2, -2);
3739 editRect.
adjust(2, 2, 0, -2);
3742 if (!comboBox->currentIcon.isNull()) {
3745 QPixmap pixmap = comboBox->currentIcon.pixmap(comboBox->iconSize, mode);
3746 QRect iconRect(editRect);
3747 iconRect.
setWidth(comboBox->iconSize.width() + 5);
3750 iconRect.
size(), editRect);
3788 #ifndef QT_NO_SLIDER 3790 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
3800 groove = horizontal ? grooveRegion.
adjusted(0, 5, 0, -5) : grooveRegion.
adjusted(5, 0, -5, 0);
3811 p->setPen(borderColor);
3812 const QLine lines[4] = {
3821 p->drawLines(lines, 4);
3823 p->setPen(alphaCornerColor);
3824 const QPoint points[4] = {
3829 p->drawPoints(points, 4);
3831 p->setPen(borderColor);
3832 const QLine lines[4] = {
3841 p->drawLines(lines, 4);
3843 p->setPen(alphaCornerColor);
3844 const QPoint points[4] = {
3849 p->drawPoints(points, 4);
3856 if (ticksAbove && !ticksBelow)
3871 if (ticksAbove && !ticksBelow) {
3872 path.
moveTo(
QPoint(pixmapRect.right(), pixmapRect.bottom()));
3873 path.
lineTo(
QPoint(pixmapRect.right(), pixmapRect.bottom() - 10));
3874 path.
lineTo(
QPoint(pixmapRect.right() - 5, pixmapRect.bottom() - 14));
3875 path.
lineTo(
QPoint(pixmapRect.left() + 1, pixmapRect.bottom() - 10));
3876 path.
lineTo(
QPoint(pixmapRect.left() + 1, pixmapRect.bottom()));
3877 path.
lineTo(
QPoint(pixmapRect.right(), pixmapRect.bottom()));
3879 path.
moveTo(
QPoint(pixmapRect.right(), pixmapRect.top() + 1));
3880 path.
lineTo(
QPoint(pixmapRect.right(), pixmapRect.top() + 10));
3881 path.
lineTo(
QPoint(pixmapRect.right() - 5, pixmapRect.top() + 14));
3882 path.
lineTo(
QPoint(pixmapRect.left() + 1, pixmapRect.top() + 10));
3883 path.
lineTo(
QPoint(pixmapRect.left() + 1, pixmapRect.top() + 1));
3884 path.
lineTo(
QPoint(pixmapRect.right(), pixmapRect.top() + 1));
3888 pixmapRect.center().x(), pixmapRect.bottom());
3890 gradient.
setColorAt(0, gradientStartColor.lighter(110));
3891 gradient.setColorAt(1, gradientStopColor.
lighter(110));
3893 gradient.setColorAt(0, gradientStartColor);
3894 gradient.setColorAt(1, gradientStopColor);
3896 handlePainter.fillPath(path, gradient);
3898 handlePainter.fillPath(path, slider->palette.background());
3902 if (ticksAbove && !ticksBelow) {
3903 path.
moveTo(
QPoint(pixmapRect.right(), pixmapRect.top() + 1));
3904 path.
lineTo(
QPoint(pixmapRect.right() - 10, pixmapRect.top() + 1));
3905 path.
lineTo(
QPoint(pixmapRect.right() - 14, pixmapRect.top() + 5));
3906 path.
lineTo(
QPoint(pixmapRect.right() - 10, pixmapRect.bottom()));
3907 path.
lineTo(
QPoint(pixmapRect.right(), pixmapRect.bottom()));
3908 path.
lineTo(
QPoint(pixmapRect.right(), pixmapRect.top() + 1));
3910 path.
moveTo(
QPoint(pixmapRect.left() + 1, pixmapRect.top() + 1));
3911 path.
lineTo(
QPoint(pixmapRect.left() + 10, pixmapRect.top() + 1));
3912 path.
lineTo(
QPoint(pixmapRect.left() + 14, pixmapRect.top() + 5));
3913 path.
lineTo(
QPoint(pixmapRect.left() + 10, pixmapRect.bottom()));
3914 path.
lineTo(
QPoint(pixmapRect.left() + 1, pixmapRect.bottom()));
3915 path.
lineTo(
QPoint(pixmapRect.left() + 1, pixmapRect.top() + 1));
3919 pixmapRect.center().x(), pixmapRect.bottom());
3921 gradient.setColorAt(1, gradientStopColor);
3922 handlePainter.fillPath(path, gradient);
3924 handlePainter.fillPath(path, slider->palette.background());
3936 image.
setColor(2, gradientStartColor.rgba());
3942 handlePainter.drawImage(pixmapRect, image);
3943 handlePainter.end();
3951 fropt.QStyleOption::operator=(*slider);
3959 painter->
setPen(borderColor);
3962 int interval = slider->tickInterval;
3963 if (interval <= 0) {
3964 interval = slider->singleStep;
3969 interval = slider->pageStep;
3974 int v = slider->minimum;
3977 while (v <= slider->maximum + 1) {
3978 if (v == slider->maximum + 1 && interval == 1)
3980 const int v_ =
qMin(v, slider->maximum);
3983 ? slider->rect.width()
3984 : slider->rect.height()) - len,
3985 slider->upsideDown) + len / 2;
3987 int extra = 2 - ((v_ == slider->minimum || v_ == slider->maximum) ? 1 : 0);
3991 lines.
append(
QLine(pos, slider->rect.top() + extra,
3992 pos, slider->rect.top() + tickSize));
3995 lines.
append(
QLine(pos, slider->rect.bottom() - extra,
3996 pos, slider->rect.bottom() - tickSize));
4000 lines.
append(
QLine(slider->rect.left() + extra, pos,
4001 slider->rect.left() + tickSize, pos));
4004 lines.
append(
QLine(slider->rect.right() - extra, pos,
4005 slider->rect.right() - tickSize, pos));
4010 int nextInterval = v + interval;
4011 if (nextInterval < v)
4020 #endif // QT_NO_SLIDER 4021 #ifndef QT_NO_SPINBOX 4023 if (
const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
4032 QRect buttonRect = upRect | downRect;
4050 d->drawPartialFrame(painter,
4068 const QLine lines[4] = {
4085 const QLine lines[4] = {
4106 QBrush buttonGradientBrush;
4107 QBrush leftLineGradientBrush;
4108 QBrush rightLineGradientBrush;
4109 QBrush sunkenButtonGradientBrush;
4110 QBrush sunkenLeftLineGradientBrush;
4111 QBrush sunkenRightLineGradientBrush;
4114 buttonGradientBrush = buttonBrush;
4115 sunkenButtonGradientBrush =
qBrushDark(buttonBrush, 108);
4116 leftLineGradientBrush =
qBrushLight(buttonBrush, 105);
4117 rightLineGradientBrush =
qBrushDark(buttonBrush, 105);
4118 sunkenLeftLineGradientBrush =
qBrushDark(buttonBrush, 110);
4119 sunkenRightLineGradientBrush =
qBrushDark(buttonBrush, 106);
4124 buttonGradient.setColorAt(1.0, buttonBrush.
color().
darker(110));
4125 buttonGradientBrush =
QBrush(buttonGradient);
4129 buttonGradient2.setColorAt(1.0, buttonBrush.
color().
darker(103));
4130 sunkenButtonGradientBrush =
QBrush(buttonGradient2);
4134 buttonGradient3.setColorAt(1.0, buttonBrush.
color());
4135 leftLineGradientBrush =
QBrush(buttonGradient3);
4139 buttonGradient4.setColorAt(1.0, buttonBrush.
color().
darker(110));
4140 rightLineGradientBrush =
QBrush(buttonGradient4);
4144 buttonGradient5.setColorAt(1.0, buttonBrush.
color().
darker(107));
4145 sunkenLeftLineGradientBrush =
QBrush(buttonGradient5);
4149 buttonGradient6.setColorAt(1.0, buttonBrush.
color().
darker(103));
4150 sunkenRightLineGradientBrush =
QBrush(buttonGradient6);
4156 : buttonGradientBrush, upRect));
4159 : buttonGradientBrush, downRect));
4163 : buttonGradientBrush, upRect), 105), 0));
4166 upRect.
right() - 2, upRect.
top() + 1);
4169 upRect.
left() + 2, upRect.
top() + 1);
4172 : buttonGradientBrush, downRect), 105), 0));
4175 downRect.
right() - 1, downRect.
top() + 1);
4178 downRect.
left() + 1, downRect.
top() + 1);
4183 : leftLineGradientBrush, upRect), 1));
4192 : leftLineGradientBrush, downRect), 1));
4203 : buttonGradientBrush, upRect), 105), 0));
4212 : buttonGradientBrush, downRect), 105), 0));
4223 : rightLineGradientBrush, upRect), 1));
4232 : rightLineGradientBrush, downRect), 1));
4253 center = upRect.
center();
4258 painter->
drawLine(center.
x(), center.
y() - 2, center.
x(), center.
y() + 2);
4259 painter->
drawLine(center.
x() - 2, center.
y(), center.
x() + 2, center.
y());
4269 center = downRect.
center();
4274 painter->
drawLine(center.
x() - 2, center.
y(), center.
x() + 2, center.
y());
4286 offset = upSunken ? 1 : 0;
4287 QRect upArrowRect(upRect.
center().
x() - 3 + offset, upRect.
center().
y() - 2 + offset, 7, 4);
4288 centerX = upArrowRect.
center().
x();
4289 painter->
drawPoint(centerX, upArrowRect.top());
4290 const QLine lines[3] = {
4291 QLine(centerX - 1, upArrowRect.top() + 1, centerX + 1, upArrowRect.top() + 1),
4292 QLine(centerX - 2, upArrowRect.top() + 2, centerX + 2, upArrowRect.top() + 2),
4293 QLine(centerX - 3, upArrowRect.top() + 3, centerX + 3, upArrowRect.top() + 3) };
4303 offset = downSunken ? 1 : 0;
4304 QRect downArrowRect(downRect.
center().
x() - 3 + offset, downRect.
center().
y() - 2 + offset + 1, 7, 4);
4305 centerX = downArrowRect.
center().
x();
4306 const QLine lines[3] = {
4307 QLine(centerX - 3, downArrowRect.top(), centerX + 3, downArrowRect.top()),
4308 QLine(centerX - 2, downArrowRect.top() + 1, centerX + 2, downArrowRect.top() + 1),
4309 QLine(centerX - 1, downArrowRect.top() + 2, centerX + 1, downArrowRect.top() + 2) };
4311 painter->
drawPoint(centerX, downArrowRect.top() + 3);
4317 #endif // QT_NO_SPINBOX 4318 #ifndef QT_NO_COMBOBOX 4320 if (
const QStyleOptionComboBox *comboBox = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
4321 bool sunken = comboBox->state &
State_On;
4323 int menuButtonWidth = 16;
4324 int xoffset = sunken ? (reverse ? -1 : 1) : 0;
4325 int yoffset = sunken ? 1 : 0;
4326 QRect rect = comboBox->rect;
4330 if (comboBox->editable) {
4334 QBrush buttonGradientBrush;
4335 QBrush leftLineGradientBrush;
4336 QBrush rightLineGradientBrush;
4337 QBrush sunkenButtonGradientBrush;
4338 QBrush sunkenLeftLineGradientBrush;
4339 QBrush sunkenRightLineGradientBrush;
4342 buttonGradientBrush = button;
4343 sunkenButtonGradientBrush =
qBrushDark(button, 108);
4345 rightLineGradientBrush =
qBrushDark(button, 105);
4346 sunkenLeftLineGradientBrush =
qBrushDark(button, 110);
4347 sunkenRightLineGradientBrush =
qBrushDark(button, 106);
4352 buttonGradient.setColorAt(1.0, button.
color().
darker(110));
4353 buttonGradientBrush =
QBrush(buttonGradient);
4357 buttonGradient2.setColorAt(1.0, button.
color().
darker(103));
4358 sunkenButtonGradientBrush =
QBrush(buttonGradient2);
4362 buttonGradient3.setColorAt(1.0, button.
color());
4363 leftLineGradientBrush =
QBrush(buttonGradient3);
4367 buttonGradient4.setColorAt(1.0, button.
color().
darker(110));
4368 rightLineGradientBrush =
QBrush(buttonGradient4);
4372 buttonGradient5.setColorAt(1.0, button.
color().
darker(107));
4373 sunkenLeftLineGradientBrush =
QBrush(buttonGradient5);
4377 buttonGradient6.setColorAt(1.0, button.
color().
darker(103));
4378 sunkenRightLineGradientBrush =
QBrush(buttonGradient6);
4390 d->drawPartialFrame(painter,
4405 const QLine lines[3] = {
4407 buttonRect.
right() - 2, buttonRect.
top()),
4414 const QPoint points[2] = {
4424 const QPoint points[4] = {
4432 const QLine lines[3] = {
4434 buttonRect.
left() + 2, buttonRect.
top()),
4438 buttonRect.
left() + 2, buttonRect.
bottom()) };
4441 const QPoint points[2] = {
4451 const QPoint points[4] = {
4464 : buttonGradientBrush, option->
rect));
4468 : buttonGradientBrush, option->
rect), 105), 0));
4479 : buttonGradientBrush, option->
rect), 105), 0));
4490 : leftLineGradientBrush, option->
rect), 1));
4501 : rightLineGradientBrush, option->
rect), 1));
4512 buttonOption.QStyleOption::operator=(*comboBox);
4523 painter->
drawLine(rect.
right() - menuButtonWidth + xoffset, rect.
top() + 1,
4524 rect.
right() - menuButtonWidth + xoffset, rect.
bottom() - 1);
4526 painter->
drawLine(rect.
left() + menuButtonWidth + xoffset, rect.
top() + 1,
4527 rect.
left() + menuButtonWidth + xoffset, rect.
bottom() - 1);
4533 int left = !reverse ? rect.
right() - menuButtonWidth : rect.
left();
4534 int right = !reverse ? rect.
right() : rect.
left() + menuButtonWidth;
4535 QRect arrowRect((left + right) / 2 - 3 + xoffset,
4536 rect.
center().
y() - 1 + yoffset, 7, 4);
4538 const QLine lines[3] = {
4539 QLine(arrowRect.topLeft(), arrowRect.topRight()),
4540 QLine(arrowRect.left() + 1, arrowRect.top() + 1,
4541 arrowRect.right() - 1, arrowRect.top() + 1),
4542 QLine(arrowRect.left() + 2, arrowRect.top() + 2,
4543 arrowRect.right() - 2, arrowRect.top() + 2) };
4545 painter->
drawPoint(arrowRect.center().x(), arrowRect.bottom());
4560 #endif // QT_NO_COMBOBOX 4562 if (
const QStyleOptionTitleBar *titleBar = qstyleoption_cast<const QStyleOptionTitleBar *>(option)) {
4564 bool active = (titleBar->titleBarState &
State_Active);
4565 QRect fullRect = titleBar->rect;
4568 QColor titleBarGradientStart(active ? 0x3b508a : 0x6e6e6e);
4569 QColor titleBarGradientStop(active ? 0x5d6e9e : 0x818181);
4570 QColor titleBarFrameBorder(0x393939);
4571 QColor titleBarAlphaCorner(active ? 0x4b5e7f : 0x6a6a6a);
4572 QColor titleBarInnerTopLine(active ? 0x8e98ba : 0xa4a4a4);
4573 QColor titleBarInnerInnerTopLine(active ? 0x57699b : 0x808080);
4574 QColor leftCorner(active ? 0x6f7ea8 : 0x8e8e8e);
4575 QColor rightCorner(active ? 0x44537d : 0x676767);
4576 QColor textColor(active ? 0x282e40 : 0x282e40);
4577 QColor textAlphaColor(active ? 0x3f4862 : 0x3f4862);
4580 if (widget && widget->
inherits(
"Q3DockWindowTitleBar")) {
4582 dockwidget.QStyleOption::operator=(*option);
4583 dockwidget.
title = titleBar->text;
4586 #endif // QT3_SUPPORT 4591 titleBarGradientStart,
4592 titleBarGradientStop);
4595 painter->
setPen(titleBarFrameBorder);
4599 const QLine lines[3] = {
4604 const QPoint points[2] = {
4611 painter->
setPen(titleBarAlphaCorner);
4613 const QPoint points[4] = {
4622 painter->
setPen(titleBarInnerTopLine);
4626 painter->
setPen(titleBarInnerInnerTopLine);
4630 painter->
setPen(leftCorner);
4632 painter->
setPen(rightCorner);
4636 painter->
setPen(titleBarFrameBorder);
4639 const QPoint points[2] = {
4644 painter->
setPen(rightCorner);
4646 painter->
setPen(titleBarAlphaCorner);
4648 const QPoint points[4] = {
4662 painter->
setPen(titleBar->palette.text().color());
4673 painter->
setPen(titleBar->palette.highlightedText().color());
4674 painter->
drawText(textRect, titleBar->text, option);
4687 int xoffset = minButtonRect.
width() / 3;
4688 int yoffset = minButtonRect.
height() / 3;
4690 QRect minButtonIconRect(minButtonRect.
left() + xoffset, minButtonRect.
top() + yoffset,
4691 minButtonRect.
width() - xoffset * 2, minButtonRect.
height() - yoffset * 2);
4693 painter->
setPen(textColor);
4695 const QLine lines[2] = {
4696 QLine(minButtonIconRect.center().x() - 2,
4697 minButtonIconRect.center().y() + 3,
4698 minButtonIconRect.center().x() + 3,
4699 minButtonIconRect.center().y() + 3),
4700 QLine(minButtonIconRect.center().x() - 2,
4701 minButtonIconRect.center().y() + 4,
4702 minButtonIconRect.center().x() + 3,
4703 minButtonIconRect.center().y() + 4) };
4706 painter->
setPen(textAlphaColor);
4708 const QLine lines[2] = {
4709 QLine(minButtonIconRect.center().x() - 3,
4710 minButtonIconRect.center().y() + 3,
4711 minButtonIconRect.center().x() - 3,
4712 minButtonIconRect.center().y() + 4),
4713 QLine(minButtonIconRect.center().x() + 4,
4714 minButtonIconRect.center().y() + 3,
4715 minButtonIconRect.center().x() + 4,
4716 minButtonIconRect.center().y() + 4) };
4731 int xoffset = maxButtonRect.
width() / 3;
4732 int yoffset = maxButtonRect.
height() / 3;
4734 QRect maxButtonIconRect(maxButtonRect.
left() + xoffset, maxButtonRect.
top() + yoffset,
4735 maxButtonRect.
width() - xoffset * 2, maxButtonRect.
height() - yoffset * 2);
4737 painter->
setPen(textColor);
4738 painter->
drawRect(maxButtonIconRect.adjusted(0, 0, -1, -1));
4739 painter->
drawLine(maxButtonIconRect.left() + 1, maxButtonIconRect.top() + 1,
4740 maxButtonIconRect.right() - 1, maxButtonIconRect.top() + 1);
4741 painter->
setPen(textAlphaColor);
4742 const QPoint points[4] = {
4743 maxButtonIconRect.topLeft(), maxButtonIconRect.topRight(),
4744 maxButtonIconRect.bottomLeft(), maxButtonIconRect.bottomRight() };
4756 int xoffset = closeButtonRect.
width() / 3;
4757 int yoffset = closeButtonRect.
height() / 3;
4759 QRect closeIconRect(closeButtonRect.
left() + xoffset, closeButtonRect.
top() + yoffset,
4760 closeButtonRect.
width() - xoffset * 2, closeButtonRect.
height() - yoffset * 2);
4762 painter->
setPen(textAlphaColor);
4764 const QLine lines[4] = {
4765 QLine(closeIconRect.left() + 1, closeIconRect.top(),
4766 closeIconRect.right(), closeIconRect.bottom() - 1),
4767 QLine(closeIconRect.left(), closeIconRect.top() + 1,
4768 closeIconRect.right() - 1, closeIconRect.bottom()),
4769 QLine(closeIconRect.right() - 1, closeIconRect.top(),
4770 closeIconRect.left(), closeIconRect.bottom() - 1),
4771 QLine(closeIconRect.right(), closeIconRect.top() + 1,
4772 closeIconRect.left() + 1, closeIconRect.bottom()) };
4774 const QPoint points[4] = {
4775 closeIconRect.topLeft(), closeIconRect.topRight(),
4776 closeIconRect.bottomLeft(), closeIconRect.bottomRight() };
4779 painter->
setPen(textColor);
4781 const QLine lines[2] = {
4782 QLine(closeIconRect.left() + 1, closeIconRect.top() + 1,
4783 closeIconRect.right() - 1, closeIconRect.bottom() - 1),
4784 QLine(closeIconRect.left() + 1, closeIconRect.bottom() - 1,
4785 closeIconRect.right() - 1, closeIconRect.top() + 1) };
4801 int xoffset = int(normalButtonRect.
width() / 3.5);
4802 int yoffset = int(normalButtonRect.
height() / 3.5);
4804 QRect normalButtonIconRect(normalButtonRect.
left() + xoffset, normalButtonRect.
top() + yoffset,
4805 normalButtonRect.
width() - xoffset * 2, normalButtonRect.
height() - yoffset * 2);
4807 QRect frontWindowRect = normalButtonIconRect.
adjusted(0, 3, -3, 0);
4808 painter->
setPen(textColor);
4809 painter->
drawRect(frontWindowRect.adjusted(0, 0, -1, -1));
4810 painter->
drawLine(frontWindowRect.left() + 1, frontWindowRect.top() + 1,
4811 frontWindowRect.right() - 1, frontWindowRect.top() + 1);
4812 painter->
setPen(textAlphaColor);
4814 const QPoint points[4] = {
4815 frontWindowRect.topLeft(), frontWindowRect.topRight(),
4816 frontWindowRect.bottomLeft(), frontWindowRect.bottomRight() };
4820 QRect backWindowRect = normalButtonIconRect.
adjusted(3, 0, 0, -3);
4821 QRegion clipRegion = backWindowRect;
4822 clipRegion -= frontWindowRect;
4825 painter->
setPen(textColor);
4827 painter->
drawLine(backWindowRect.
left() + 1, backWindowRect.
top() + 1,
4828 backWindowRect.
right() - 1, backWindowRect.
top() + 1);
4829 painter->
setPen(textAlphaColor);
4831 const QPoint points[4] = {
4853 QColor(hover ? 0x939ebe : 0x7381ab));
4856 QColor(hover ? 0xababab : 0x929292));
4864 painter->
drawImage(contextHelpButtonRect, image);
4875 int xoffset = shadeButtonRect.
width() / 3;
4876 int yoffset = shadeButtonRect.
height() / 3;
4878 QRect shadeButtonIconRect(shadeButtonRect.
left() + xoffset, shadeButtonRect.
top() + yoffset,
4879 shadeButtonRect.
width() - xoffset * 2, shadeButtonRect.
height() - yoffset * 2);
4882 path.
lineTo(shadeButtonIconRect.center().x(), shadeButtonIconRect.bottom() - shadeButtonIconRect.height() / 2);
4883 path.lineTo(shadeButtonIconRect.bottomRight());
4884 path.lineTo(shadeButtonIconRect.bottomLeft());
4886 painter->
setPen(textAlphaColor);
4899 int xoffset = unshadeButtonRect.
width() / 3;
4900 int yoffset = unshadeButtonRect.
height() / 3;
4902 QRect unshadeButtonIconRect(unshadeButtonRect.
left() + xoffset, unshadeButtonRect.
top() + yoffset,
4903 unshadeButtonRect.
width() - xoffset * 2, unshadeButtonRect.
height() - yoffset * 2);
4905 int midY = unshadeButtonIconRect.
bottom() - unshadeButtonIconRect.height() / 2;
4907 path.
lineTo(unshadeButtonIconRect.right(), midY);
4908 path.
lineTo(unshadeButtonIconRect.center().x(), unshadeButtonIconRect.bottom());
4909 path.
lineTo(unshadeButtonIconRect.left(), midY);
4911 painter->
setPen(textAlphaColor);
4925 if (!titleBar->icon.isNull()) {
4926 titleBar->icon.paint(painter, iconRect);
4929 tool.
palette = titleBar->palette;
4931 tool.
rect = iconRect;
4942 if (
const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(option))
4945 #endif // QT_NO_DIAL 4965 #ifndef QT_NO_SLIDER 4967 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
4971 newSize.
rheight() += tickSize;
4973 newSize.
rwidth() += tickSize;
4977 newSize.
rheight() += tickSize;
4979 newSize.
rwidth() += tickSize;
4983 #endif // QT_NO_SLIDER 4984 #ifndef QT_NO_SCROLLBAR 4986 if (
const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
4990 newSize =
QSize(scrollBarExtent * 3 + scrollBarSliderMinimum, scrollBarExtent);
4992 newSize =
QSize(scrollBarExtent, scrollBarExtent * 3 + scrollBarSliderMinimum);
4996 #endif // QT_NO_SCROLLBAR 4997 #ifndef QT_NO_SPINBOX 5004 #ifndef QT_NO_TOOLBUTTON 5010 #ifndef QT_NO_COMBOBOX 5018 if (
const QStyleOptionMenuItem *menuItem = qstyleoption_cast<const QStyleOptionMenuItem *>(option)) {
5020 newSize.
setHeight(menuItem->text.isEmpty() ? 2 : menuItem->fontMetrics.height());
5044 #ifndef QT_NO_PROGRESSBAR 5048 return option->
rect;
5049 #endif // QT_NO_PROGRESSBAR 5066 #ifndef QT_NO_SLIDER 5068 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
5071 switch (subControl) {
5076 int centerY = slider->rect.center().y() - rect.
height() / 2;
5078 centerY += tickSize;
5080 centerY -= tickSize;
5085 int centerX = slider->rect.center().x() - rect.
width() / 2;
5087 centerX += tickSize;
5089 centerX -= tickSize;
5094 QPoint grooveCenter = slider->rect.center();
5097 --grooveCenter.
ry();
5099 grooveCenter.
ry() += tickSize;
5101 grooveCenter.
ry() -= tickSize;
5104 --grooveCenter.
rx();
5106 grooveCenter.
rx() += tickSize;
5108 grooveCenter.
rx() -= tickSize;
5118 #endif // QT_NO_SLIDER 5119 #ifndef QT_NO_SCROLLBAR 5121 if (
const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
5123 int sliderMaxLength = ((scrollBar->orientation ==
Qt::Horizontal) ?
5124 scrollBar->rect.width() : scrollBar->rect.height()) - (scrollBarExtent * 3);
5129 if (scrollBar->maximum != scrollBar->minimum) {
5130 uint valueRange = scrollBar->maximum - scrollBar->minimum;
5131 sliderLength = (scrollBar->pageStep * sliderMaxLength) / (valueRange + scrollBar->pageStep);
5133 if (sliderLength < sliderMinLength || valueRange >
INT_MAX / 2)
5134 sliderLength = sliderMinLength;
5135 if (sliderLength > sliderMaxLength)
5136 sliderLength = sliderMaxLength;
5138 sliderLength = sliderMaxLength;
5143 scrollBar->sliderPosition,
5144 sliderMaxLength - sliderLength,
5145 scrollBar->upsideDown);
5147 QRect scrollBarRect = scrollBar->rect;
5149 switch (subControl) {
5152 rect.
setRect(scrollBarRect.
left(), scrollBarRect.
top(), scrollBarRect.
width() - scrollBarExtent, scrollBarRect.
height());
5154 rect.
setRect(scrollBarRect.
left(), scrollBarRect.
top(), scrollBarRect.
width(), scrollBarRect.
height() - scrollBarExtent);
5159 rect.
setRect(scrollBarRect.
right() - (scrollBarExtent - 1), scrollBarRect.
top(), scrollBarExtent, scrollBarRect.
height());
5161 rect.
setRect(scrollBarRect.
left(), scrollBarRect.
bottom() - (scrollBarExtent - 1), scrollBarRect.
width(), scrollBarExtent);
5166 rect.
setRect(scrollBarRect.
left() + scrollBarExtent, scrollBarRect.
top(),
5167 sliderStart - (scrollBarRect.
left() + scrollBarExtent), scrollBarRect.
height());
5169 rect.
setRect(scrollBarRect.
left(), scrollBarRect.
top() + scrollBarExtent,
5170 scrollBarRect.
width(), sliderStart - (scrollBarRect.
left() + scrollBarExtent));
5175 rect.
setRect(sliderStart + sliderLength, 0,
5176 sliderMaxLength - sliderStart - sliderLength + scrollBarExtent, scrollBarRect.
height());
5178 rect.
setRect(0, sliderStart + sliderLength,
5179 scrollBarRect.
width(), sliderMaxLength - sliderStart - sliderLength + scrollBarExtent);
5183 rect = scrollBarRect.
adjusted(scrollBarExtent, 0, -2 * scrollBarExtent, 0);
5185 rect = scrollBarRect.
adjusted(0, scrollBarExtent, 0, -2 * scrollBarExtent);
5190 rect.
setRect(sliderStart, 0, sliderLength, scrollBarRect.
height());
5192 rect.
setRect(0, sliderStart, scrollBarRect.
width(), sliderLength);
5198 rect =
visualRect(scrollBar->direction, scrollBarRect, rect);
5201 #endif // QT_NO_SCROLLBAR 5202 #ifndef QT_NO_SPINBOX 5204 if (
const QStyleOptionSpinBox *spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(option)) {
5205 int center = spinBox->rect.height() / 2;
5206 switch (subControl) {
5210 rect =
visualRect(spinBox->direction, spinBox->rect, rect);
5211 rect.
setRect(spinBox->rect.right() - 16, spinBox->rect.top(), 17, center + 1);
5212 rect =
visualRect(spinBox->direction, spinBox->rect, rect);
5217 rect =
visualRect(spinBox->direction, spinBox->rect, rect);
5218 rect.
setRect(spinBox->rect.right() - 16, spinBox->rect.top() +
center, 17, spinBox->rect.height() -
center);
5219 rect =
visualRect(spinBox->direction, spinBox->rect, rect);
5223 rect = spinBox->rect.
adjusted(0, 0, -16, 0);
5225 rect = spinBox->rect;
5228 rect =
visualRect(spinBox->direction, spinBox->rect, rect);
5235 #endif // QT_NO_SPINBOX 5236 #ifndef QT_NO_COMBOBOX 5238 switch (subControl) {
5246 if (
const QStyleOptionComboBox *box = qstyleoption_cast<const QStyleOptionComboBox *>(option)) {
5250 if (box->editable) {
5255 option->
rect.
width() - 16 - 2 * frameWidth,
5270 #endif // QT_NO_COMBOBOX 5272 if (
const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(option)) {
5275 const int indent = 3;
5276 const int controlTopMargin = 4;
5277 const int controlBottomMargin = 3;
5278 const int controlWidthMargin = 1;
5279 const int controlHeight = tb->rect.
height() - controlTopMargin - controlBottomMargin;
5280 const int delta = controlHeight + controlWidthMargin;
5291 ret.
adjust(delta, 0, -delta, 0);
5293 ret.
adjust(0, 0, -delta, 0);
5295 ret.
adjust(0, 0, -delta, 0);
5297 ret.
adjust(0, 0, -delta, 0);
5299 ret.
adjust(0, 0, -delta, 0);
5300 ret.
adjusted(indent, 0, -indent, 0);
5338 ret.
setRect(tb->rect.right() - indent - offset, tb->rect.top() + controlTopMargin,
5339 controlHeight, controlHeight);
5343 ret.
setRect(tb->rect.left() + controlWidthMargin + indent, tb->rect.top() + controlTopMargin,
5344 controlHeight, controlHeight);
5350 ret =
visualRect(tb->direction, tb->rect, ret);
5371 mask->region = option->
rect;
5454 #ifndef QT_NO_SCROLLBAR 5456 if (
const QStyleOptionSlider *scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
5464 if (scrollBarAddLine.
contains(pos)) {
5470 if (scrollBarSubPage.
contains(pos)) {
5476 if (scrollBarAddPage.
contains(pos)) {
5482 if (scrollBarSubLine.
contains(pos)) {
5488 #endif // QT_NO_SCROLLBAR 5514 #ifndef QT_NO_SLIDER 5526 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(option)) {
5535 #endif // QT_NO_SLIDER 5583 if (qobject_cast<const QMenu *>(widget)) {
5595 if (widget && widget->
inherits(
"Q3DockWindowTitleBar")) {
5615 bool isWindow =
false;
5618 }
else if (widget) {
5701 if (qobject_cast<QPushButton *>(widget)
5703 || qobject_cast<QComboBox *>(widget)
5706 || qobject_cast<QAbstractSpinBox *>(widget)
5708 || qobject_cast<QCheckBox *>(widget)
5710 || qobject_cast<QGroupBox *>(widget)
5712 || qobject_cast<QRadioButton *>(widget)
5714 || qobject_cast<QSplitterHandle *>(widget)
5717 || qobject_cast<QTabBar *>(widget)
5723 if (widget->
inherits(
"QWorkspaceTitleBar")
5724 || widget->
inherits(
"QDockSeparator")
5725 || widget->
inherits(
"QDockWidgetSeparator")
5726 || widget->
inherits(
"Q3DockWindowResizeHandle")) {
5732 || qobject_cast<QMenuBar *>(widget)
5737 #ifndef QT_NO_TOOLBAR 5739 || (widget && qobject_cast<QToolBar *>(widget->
parent()))
5745 #ifndef QT_NO_PROGRESSBAR 5750 #if defined QPlastique_MaskButtons 5751 if (qobject_cast<QPushButton *>(widget) || qobject_cast<QToolButton *>(widget))
5761 if (qobject_cast<QPushButton *>(widget)
5763 || qobject_cast<QComboBox *>(widget)
5766 || qobject_cast<QAbstractSpinBox *>(widget)
5768 || qobject_cast<QCheckBox *>(widget)
5770 || qobject_cast<QGroupBox *>(widget)
5773 || qobject_cast<QSplitterHandle *>(widget)
5776 || qobject_cast<QTabBar *>(widget)
5778 || qobject_cast<QRadioButton *>(widget)) {
5782 if (widget->
inherits(
"QWorkspaceTitleBar")
5783 || widget->
inherits(
"QDockSeparator")
5784 || widget->
inherits(
"QDockWidgetSeparator")
5785 || widget->
inherits(
"Q3DockWindowResizeHandle")) {
5791 || qobject_cast<QMenuBar *>(widget)
5794 || qobject_cast<QToolBox *>(widget)
5799 #ifndef QT_NO_TOOLBAR 5801 || (widget && qobject_cast<QToolBar *>(widget->
parent()))
5807 #ifndef QT_NO_PROGRESSBAR 5811 d->bars.removeAll(static_cast<QProgressBar*>(widget));
5815 #if defined QPlastique_MaskButtons 5816 if (qobject_cast<QPushButton *>(widget) || qobject_cast<QToolButton *>(widget))
5867 #define CT1(c) CT2(c, c) 5868 #define CT2(c1, c2) (((uint)c1 << 16) | (uint)c2) 5884 if ((control1 | control2) & ButtonMask)
5887 switch (
CT2(control1, control2)) {
5931 #ifndef QT_NO_PROGRESSBAR 5934 switch (event->
type()) {
5936 if (
QProgressBar *bar = qobject_cast<QProgressBar *>(watched)) {
5937 d->bars.append(bar);
5938 if (
d->bars.size() == 1) {
5947 if(!
d->bars.isEmpty()) {
5948 d->bars.removeAll(reinterpret_cast<QProgressBar*>(watched));
5949 if (
d->bars.isEmpty()) {
5951 d->progressBarAnimateTimer = 0;
5955 #if defined QPlastique_MaskButtons 5957 if (qobject_cast<QPushButton *>(watched) || qobject_cast<QToolButton *>(watched)) {
5961 region -=
QRect(rect.left(), rect.top(), 2, 1);
5962 region -=
QRect(rect.left(), rect.top() + 1, 1, 1);
5963 region -=
QRect(rect.left(), rect.bottom(), 2, 1);
5964 region -=
QRect(rect.left(), rect.bottom() - 1, 1, 1);
5965 region -=
QRect(rect.right() - 1, rect.top(), 2, 1);
5966 region -=
QRect(rect.right(), rect.top() + 1, 1, 1);
5967 region -=
QRect(rect.right() - 1, rect.bottom(), 2, 1);
5968 region -=
QRect(rect.right(), rect.bottom() - 1, 1, 1);
5976 #endif // QT_NO_PROGRESSBAR 5986 #ifndef QT_NO_PROGRESSBAR 5989 if (event->
timerId() ==
d->progressBarAnimateTimer) {
5997 #endif // QT_NO_PROGRESSBAR 6003 #endif // !defined(QT_NO_STYLE_PLASTIQUE) || defined(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)
int startTimer(int interval)
Starts a timer and returns a timer identifier, or returns zero if it could not start a timer...
void setTransform(const QTransform &transform, bool combine=false)
Sets the world transformation matrix.
The QPainter class performs low-level painting on widgets and other paint devices.
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.
void setPointSize(int)
Sets the point size to pointSize.
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...
static const char *const qt_plastique_slider_horizontalhandle_up[]
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
void polish(QApplication *)
Reimplemented Function
void setRgb(int r, int g, int b, int a=255)
Sets the RGB value to r, g, b and the alpha value to a.
void unpolish(QApplication *)
Reimplemented Function
const T * constData() const
QImage toImage() const
Converts the pixmap to a QImage.
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 QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Converts the given image to a pixmap using the specified flags to control the conversion.
bool eventFilter(QObject *watched, QEvent *event)
Reimplemented Function
int width(const QString &, int len=-1) const
Returns the width in pixels of the first len characters of text.
qreal alphaF() const
Returns the alpha color component of this color.
void drawPath(const QPainterPath &path)
Draws the given painter path using the current pen for outline and the current brush for filling...
The QLatin1Literal class provides a thin wrapper around string literals used in source code...
static QLinearGradient qMapGradientToRect(const QLinearGradient &gradient, const QRectF &rect)
static QBrush qBrushDark(QBrush brush, int dark)
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 ...
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
void setHeight(int h)
Sets the height of the rectangle to the given height.
static void qt_plastique_drawFrame(QPainter *painter, const QStyleOption *option, const QWidget *widget)
const QBrush & base() const
Returns the base brush of the current color group.
static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor=50)
static QBrush qMapBrushToRect(const QBrush &brush, const QRectF &rect)
SubControl
This enum describes the available sub controls.
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_plastique_slider_verticalhandle_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.
static void qt_plastique_drawShadedPanel(QPainter *painter, const QStyleOption *option, bool base, const QWidget *widget)
int width() const
Returns the width of the pixmap.
QPointer< QWidget > widget
The QLine class provides a two-dimensional vector using integer precision.
const QBrush & dark() const
Returns the dark brush of the current color group.
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...
SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget=0) const
Reimplemented Function
const QGradient * gradient() const
Returns the gradient describing this brush.
QStyle::State state
the style flags that are used when drawing the control
#define it(className, varName)
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
QPoint p1() const
Returns the line's start point.
static const char *const qt_toolbarhandle[]
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...
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.
ComplexControl
This enum describes the available complex controls.
QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const
Reimplemented Function
QPoint p2() const
Returns the line's end point.
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...
The QConicalGradient class is used in combination with QBrush to specify a conical gradient brush...
void chop(int n)
Removes n characters from the end of the string.
bool eventFilter(QObject *o, QEvent *e)
Reimplemented Function
The QPointF class defines a point in the plane using floating point precision.
void removeEventFilter(QObject *)
Removes an event filter object obj from this object.
QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const
Reimplemented Function
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).
QRect normalized() const
Returns a normalized rectangle; i.e., a rectangle that has a non-negative width and height...
PixelMetric
This enum describes the various available pixel metrics.
int left() const
Returns the x-coordinate of the rectangle's left edge.
QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt=0, const QWidget *widget=0) const
#define END_STYLE_PIXMAPCACHE
int width() const
Returns the width of the rectangle.
int progressBarAnimateTimer
int & ry()
Returns a reference to the y coordinate of this point.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
int styleHint(StyleHint hint, const QStyleOption *option=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const
Reimplemented Function
virtual ~QPlastiqueStylePrivate()
~QPlastiqueStyle()
Destructs the QPlastiqueStyle object.
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.
QStyle::SubControls activeSubControls
This variable holds a bitwise OR of the sub-controls that are active for the complex control...
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget) const
Reimplemented Function
void drawLine(const QLineF &line)
Draws a line defined by line.
ushort red
Returns the red color component of this color.
The QProgressBar widget provides a horizontal or vertical progress bar.
int height() const
Returns the height of the rectangle.
The QRadialGradient class is used in combination with QBrush to specify a radial gradient brush...
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)
The QObject class is the base class of all Qt objects.
virtual bool event(QEvent *)
This virtual function receives events to an object and should return true if the event e was recogniz...
static const char *const qt_scrollbar_slider_pattern_horizontal[]
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).
QPlastiqueStyle()
Constructs a QPlastiqueStyle object.
The QElapsedTimer class provides a fast way to calculate elapsed times.
void drawPoint(const QPointF &pt)
Draws a single point at the given position using the current pen's color.
static void qt_plastique_draw_frame(QPainter *painter, const QRect &rect, const QStyleOption *option, QFrame::Shadow shadow=QFrame::Plain)
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt, const QWidget *widget=0) const
Reimplemented Function
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.
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
void drawPartialFrame(QPainter *painter, const QStyleOptionComplex *option, const QRect &rect, const QWidget *widget) const
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)
StandardPixmap
This enum describes the available standard pixmaps.
static QPixmap * find(const QString &key)
qreal x() const
Returns the x-coordinate of this point.
static const char *const qt_simple_toolbarhandle[]
void setObjectName(const QString &name)
void lineTo(const QPointF &p)
Adds a straight line from the current position to the given endPoint.
QGradientStops stops() const
Returns the stop points for this gradient.
void timerEvent(QTimerEvent *event)
Reimplemented Function
void setCurrentColorGroup(ColorGroup cg)
Set the palette's current color group to cg.
QColor darker(int f=200) const
Returns a darker (or lighter) color, but does not change this object.
static const char *const qt_scrollbar_button_arrow_right[]
static const char *const qt_scrollbar_slider_pattern_vertical[]
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 polish(QWidget *widget)
Reimplemented Function
const QPen & pen() const
Returns the painter's current pen.
#define QT_BEGIN_NAMESPACE
This macro expands to.
static const char *const qt_plastique_slider_horizontalhandle[]
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)
The QRectF class defines a rectangle in the plane using floating point precision. ...
static const int windowsTabSpacing
static const int windowsRightBorder
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.
void drawComplexControl(ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
Reimplemented Function
static const char *const qt_scrollbar_button_arrow_left[]
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.
The QStyleOption class stores the parameters used by QStyle functions.
int size() const
Returns the number of characters in this string.
static const int blueFrameWidth
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QBrush qBrushLight(QBrush brush, int light)
Shadow
This enum type defines the types of shadow that are used to give a 3D effect to frames.
ContentsType
This enum describes the available contents types.
The QStyleOptionSpinBox class is used to describe the parameters necessary for drawing a spin box...
void initFrom(const QWidget *w)
const QFont & font() const
Returns the currently set font used for drawing text.
void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const
Reimplemented Function
static const int windowsItemVMargin
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.
int layoutSpacingImplementation(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option=0, const QWidget *widget=0) const
int maximum
the progress bar's maximum value
void setRight(int pos)
Sets the right edge of the rectangle to the given x coordinate.
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...
Q_CORE_EXPORT void qWarning(const char *,...)
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.
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
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
T findChild(const QString &aName=QString()) const
Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object.
const QTransform & deviceTransform() const
Returns the matrix that transforms from logical coordinates to device coordinates of the platform dep...
int pixelMetric(PixelMetric pm, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
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_scrollbar_button_down[]
Qt::BrushStyle style() const
Returns the brush style.
QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
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...
static const int windowsArrowHMargin
void setBlue(int blue)
Sets the blue color component of this color to blue.
The QFontInfo class provides general information about fonts.
static const int windowsItemHMargin
FrameFeatures features
a bitwise OR of the features that describe this frame.
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
static void qt_plastique_draw_mdibutton(QPainter *painter, const QStyleOptionTitleBar *option, const QRect &tmp, bool hover, bool sunken)
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
static const int windowsSepHeight
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.
QList< QProgressBar * > bars
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
void setColor(const QColor &color)
Sets the brush color to 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.
const QBrush & shadow() const
Returns the shadow brush of the current color group.
static const bool AnimateBusyProgressBar
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.
const QBrush & windowText() const
Returns the window text (general foreground) brush of the current color group.
uchar * bits()
Returns a pointer to the first pixel data.
void setTexture(const QPixmap &pixmap)
Sets the brush pixmap to pixmap.
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 const char *const qt_scrollbar_button_arrow_up[]
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...
#define Q_DECLARE_PUBLIC(Class)
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.
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.
static const int ProgressBarFps
void setAlphaF(qreal alpha)
Sets the alpha of this color to alpha.
The QTimerEvent class contains parameters that describe a timer event.
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.
The QGradient class is used in combination with QBrush to specify gradient fills. ...
const QBrush & highlightedText() const
Returns the highlighted text brush of the current color group.
int midLineWidth
the mid-line width for drawing the frame
static void qt_plastique_draw_handle(QPainter *painter, const QStyleOption *option, const QRect &rect, Qt::Orientation orientation, const QWidget *widget)
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...
static const bool AnimateProgressBar
int x() const
Returns the x-coordinate of the rectangle's left edge.
QObject * parent() const
Returns a pointer to the parent object.
static QString elliditide(const QString &text, const QFontMetrics &fontMetrics, const QRect &rect, int *textWidth=0)
static const char *const qt_scrollbar_button_left[]
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 installEventFilter(QObject *)
Installs an event filter filterObj on this object.
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.
static void qt_plastique_draw_gradient(QPainter *painter, const QRect &rect, const QColor &gradientStart, const QColor &gradientStop)
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...
void setAlpha(int alpha)
Sets the alpha of this color to alpha.
The QStyleOptionComboBox class is used to describe the parameter for drawing a combobox.
int & rheight()
Returns a reference to the height.
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.
static const char *const qt_titlebar_context_help[]
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.
static const int windowsItemFrame
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
qint64 cacheKey() const
Returns a number that identifies this QPixmap.
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.
The QLineEdit widget is a one-line text editor.
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...
The QPlastiqueStyle class provides a widget style similar to the Plastik style available in KDE...
The QStyleOptionTab class is used to describe the parameters for drawing a tab bar.
qreal top() const
Returns the y-coordinate of the rectangle's top edge.
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.
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget=0) const
Reimplemented Function
ControlElement
This enum represents a control element.
The QStyleOptionSlider class is used to describe the parameters needed for drawing a slider...
void setWrapMode(WrapMode wrap)
Sets the option's text wrap mode to the given mode.
The QSize class defines the size of a two-dimensional object using integer point precision.
static void qBrushSetAlphaF(QBrush *brush, qreal alpha)
void setFont(const QFont &f)
Sets the painter's font to the given font.
bool isIdentity() const
Returns true if the matrix is the identity matrix, otherwise returns false.
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
RenderHints renderHints() const
Returns a flag that specifies the rendering hints that are set for this painter.
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...
QRgb rgba() const
Returns the RGB value of the color, including its alpha.
qreal bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
QRegion subtracted(const QRegion &r) const
Returns a region which is r subtracted from this region.
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.
int minimum
the progress bar's minimum value
void unpolish(QWidget *widget)
Reimplemented Function
static const char *const qt_plastique_slider_verticalhandle[]
static const char *const qt_scrollbar_button_arrow_down[]
QString & remove(int i, int len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
static const char *const qt_scrollbar_button_up[]
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
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 translate(int dx, int dy)
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position...
const QBrush & button() const
Returns the button brush of the current color group.
int titleBarState
the state of the title bar
const QMatrix & worldMatrix() const
Returns the world transformation matrix.
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
QPointF center() const
Returns the center point of the rectangle.
QPalette standardPalette() const
Reimplemented Function
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
ushort green
Returns the green color component of this color.
static const int windowsCheckMarkWidth
const QBrush & window() const
Returns the window (general background) brush of the current color group.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
QRect rect
the area that should be used for various calculations and painting
static float pointSize(const QFontDef &fd, int dpi)
QStyle::SubControls subControls
This variable holds a bitwise OR of the sub-controls to be drawn for the complex control.
int & rwidth()
Returns a reference to the width.
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.
static const char *const qt_scrollbar_button_right[]
SubElement
This enum represents a sub-area of a widget.
The QList class is a template class that provides lists.
int styleHint(StyleHint sh, const QStyleOption *opt=0, const QWidget *w=0, QStyleHintReturn *shret=0) const
Reimplemented Function
QPalette resolve(const QPalette &) const
Returns a new QPalette that has attributes copied from other.
void killTimer(int id)
Kills the timer with timer identifier, id.
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.
The QIcon class provides scalable icons in different modes and states.