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);
2639 bool reverse = (!vertical && (bar->direction ==
Qt::RightToLeft)) || vertical;
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()) };
2793 cachePainter.drawLines(cacheLines, 2);
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);
2986 pmr.moveCenter(vCheckRect.
center());
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);
3259 handle.setColor(1, alphaCornerColor.
rgba());
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) {
3277 r.
center().
y() - handle.height() / 2),
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()
3290 - handle.height() / 2),
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) {
3300 rightSide.
center().
y() - handle.height() / 2),
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());
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)) {
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);
3671 sliderPainter.setPen(borderColor);
3672 sliderPainter.drawRect(pixmapRect.
adjusted(0, 0, -1, -1));
3673 sliderPainter.setPen(alphaCornerColor);
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);
3692 lines[1] =
QLine(pixmapRect.
right() - 1, pixmapRect.
top() + 2,
3694 sliderPainter.drawLines(lines, 2);
3697 if ((horizontal && scrollBar->rect.width() > sliderMinLength)
3698 || (!horizontal && scrollBar->rect.height() > sliderMinLength)) {
3701 pattern.setColor(1, alphaCornerColor.
rgba());
3702 pattern.setColor(2, (sunken ? gradientStartColor.lighter(110) : gradientStartColor.lighter(105)).rgba());
3705 sliderPainter.drawImage(pixmapRect.
center().
x() - pattern.width() / 2 + 1,
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);
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
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.
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...
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
const T * constData() const
const QBrush & highlight() const
Returns the highlight brush of the current color group.
int width(const QString &, int len=-1) const
Returns the width in pixels of the first len characters of text.
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.
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)
void setColor(int i, QRgb c)
Sets the color at the given index in the color table, to the given to colorValue. ...
void setColorAt(qreal pos, const QColor &color)
Creates a stop point at the given position with the given color.
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.
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.
const QGradient * gradient() const
Returns the gradient describing this brush.
QStyle::State state
the style flags that are used when drawing the control
QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
QPoint p1() const
Returns the line's start point.
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.
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...
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...
int left() const
Returns the x-coordinate of the rectangle's left edge.
int width() const
Returns the width of the rectangle.
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 void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole) const
Draws the given text in the specified rectangle using the provided painter and palette.
void drawLine(const QLineF &line)
Draws a line defined by line.
int height() const
Returns the height of the rectangle.
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
The QString class provides a Unicode character string.
QFontMetrics fontMetrics
the font metrics that should be used when drawing text in the control
static const char *const qt_scrollbar_slider_pattern_horizontal[]
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 drawPoint(const QPointF &pt)
Draws a single point at the given position using the current pen's color.
void save()
Saves the current painter state (pushes the state onto a stack).
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
static QPixmap * find(const QString &key)
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[]
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...
const QPen & pen() const
Returns the painter's current pen.
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.
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.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QBrush qBrushLight(QBrush brush, int light)
const QFont & font() const
Returns the currently set font used for drawing text.
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.
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...
void setSize(const QSize &s)
Sets the size of the rectangle to the given size.
The QImage class provides a hardware-independent image representation that allows direct access to th...
void transpose()
Swaps the width and height values.
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
The QRegion class specifies a clip region for a painter.
static const char *const qt_scrollbar_button_down[]
QPixmap texture() const
Returns the custom brush pattern, or a null pixmap if no custom brush pattern has been set...
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...
The QFontInfo class provides general information about fonts.
static const int windowsItemHMargin
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
QPoint topRight() const
Returns the position of the rectangle's top-right corner.
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
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.
int top() const
Returns the y-coordinate of the rectangle's top edge.
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...
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
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.
const QBrush & highlightedText() const
Returns the highlighted text brush of the current color group.
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)
static const bool AnimateProgressBar
int x() const
Returns the x-coordinate of the rectangle's left edge.
static const char *const qt_scrollbar_button_left[]
static QString elliditide(const QString &text, const QFontMetrics &fontMetrics, const QRect &rect, int *textWidth=0)
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...
static void qt_plastique_draw_gradient(QPainter *painter, const QRect &rect, const QColor &gradientStart, const QColor &gradientStop)
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.
void setPen(const QColor &color)
Sets the painter's pen to have style Qt::SolidLine, width 0 and the specified color.
int height() const
Returns the height.
Qt::LayoutDirection direction
the text layout direction that should be used when drawing text in the control
The QRect class defines a rectangle in the plane using integer precision.
static const int windowsItemFrame
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 pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const
Reimplemented Function
int y() const
Returns the y coordinate of this point.
void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags=Qt::AutoColor)
const QStyle * proxy() const
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
The QPixmap class is an off-screen image representation that can be used as a paint device...
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.
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.
The QStyleOptionSlider class is used to describe the parameters needed for drawing a slider...
The QSize class defines the size of a two-dimensional object using integer point precision.
static void qBrushSetAlphaF(QBrush *brush, qreal alpha)
void setFont(const QFont &f)
Sets the painter's font to the given font.
const QBrush & buttonText() const
Returns the button text foreground brush of the current color group.
int x() const
Returns the x coordinate of this point.
QRgb rgba() const
Returns the RGB value of the color, including its alpha.
QRegion subtracted(const QRegion &r) const
Returns a region which is r subtracted from this region.
static const char *const qt_scrollbar_button_arrow_down[]
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...
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.
const QBrush & button() const
Returns the button brush of the current color group.
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)
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
static const char *const qt_scrollbar_button_right[]
QPalette resolve(const QPalette &) const
Returns a new QPalette that has attributes copied from other.
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.