7#if QT_CONFIG(style_fusion) || defined(QT_PLUGIN)
12#if QT_CONFIG(pushbutton)
15#if QT_CONFIG(abstractbutton)
23#if QT_CONFIG(mainwindow)
27#if QT_CONFIG(groupbox)
31#if QT_CONFIG(scrollbar)
37#if QT_CONFIG(abstractslider)
43#if QT_CONFIG(splitter)
46#if QT_CONFIG(progressbar)
53#include <private/qstylehelper_p.h>
54#include <private/qdrawhelper_p.h>
55#include <private/qapplication_p.h>
56#include <private/qwidget_p.h>
74static const int groupBoxBottomMargin = 0;
75static const int groupBoxTopMargin = 3;
77#if QT_CONFIG(imageformat_xpm)
78static const char *
const qt_titlebar_context_help[] = {
97 const int maxFactor = 100;
99 tmp.
setRed((tmp.
red() * factor) / maxFactor + (colorB.red() * (maxFactor - factor)) / maxFactor);
100 tmp.
setGreen((tmp.
green() * factor) / maxFactor + (colorB.green() * (maxFactor - factor)) / maxFactor);
101 tmp.
setBlue((tmp.
blue() * factor) / maxFactor + (colorB.blue() * (maxFactor - factor)) / maxFactor);
108 int x =
rect.center().x();
109 int y =
rect.center().y();
152 const int arrowMax =
qMin(arrowHeight, arrowWidth);
154 const int size =
qMin(arrowMax, rectMax);
158 % HexString<uint>(
type)
159 % HexString<uint>(
color.rgba()),
163 QPainter cachePainter(&cachePixmap);
167 arrowRect.setHeight(arrowHeight *
size / arrowWidth);
169 arrowRect = arrowRect.transposed();
170 arrowRect.moveTo((
rect.width() - arrowRect.width()) / 2.0,
171 (
rect.height() - arrowRect.height()) / 2.0);
173 std::array<QPointF, 3> triangle;
176 triangle = {arrowRect.topLeft(), arrowRect.topRight(),
QPointF(arrowRect.center().x(), arrowRect.bottom())};
179 triangle = {arrowRect.topLeft(), arrowRect.bottomLeft(),
QPointF(arrowRect.right(), arrowRect.center().y())};
182 triangle = {arrowRect.topRight(), arrowRect.bottomRight(),
QPointF(arrowRect.left(), arrowRect.center().y())};
185 triangle = {arrowRect.bottomLeft(), arrowRect.bottomRight(),
QPointF(arrowRect.center().x(), arrowRect.top())};
190 cachePainter.setBrush(
color);
192 cachePainter.drawPolygon(triangle.data(),
int(triangle.size()));
204 qMin(255, (
int)(
option->palette.button().color().saturation())),
205 qMin(255, (
int)(
option->palette.button().color().value()*0.7)));
210 QColor titleBarHighlight(255, 255, 255, 60);
217 QColor mdiButtonGradientStartColor;
218 QColor mdiButtonGradientStopColor;
220 mdiButtonGradientStartColor =
QColor(0, 0, 0, 40);
221 mdiButtonGradientStopColor =
QColor(255, 255, 255, 60);
224 titleBarHighlight = highlight.
darker(130);
227 gradient.
setColorAt(0, mdiButtonGradientStartColor);
228 gradient.
setColorAt(1, mdiButtonGradientStopColor);
229 QColor mdiButtonBorderColor(active ?
option->palette.highlight().color().darker(180): dark.darker(110));
232 const QLine lines[4] = {
264QFusionStylePrivate::QFusionStylePrivate()
285QFusionStyle::QFusionStyle() :
QCommonStyle(*new QFusionStylePrivate)
295QFusionStyle::QFusionStyle(QFusionStylePrivate &dd) :
QCommonStyle(dd)
302QFusionStyle::~QFusionStyle()
327void QFusionStyle::drawPrimitive(PrimitiveElement elem,
332 Q_D (
const QFusionStyle);
338 const QColor highlightedOutline =
d->highlightedOutline(
option->palette);
340 const QColor tabFrameColor =
d->tabFrameColor(
option->palette);
344#if QT_CONFIG(groupbox)
346 case PE_FrameGroupBox:
348 QPixmap pixmap(
":/qt-project.org/styles/commonstyle/images/fusion_groupbox.png"_L1);
353 case PE_IndicatorBranch: {
354 if (!(
option->state & State_Children))
356 if (
option->state & State_Open)
365 case PE_FrameTabBarBase:
366 if (
const QStyleOptionTabBarBase *tbb
367 = qstyleoption_cast<const QStyleOptionTabBarBase *>(
option)) {
370 switch (tbb->shape) {
373 region -= tbb->selectedTabRect;
381 painter->
drawLine(tbb->rect.left(), tbb->rect.top(), tbb->rect.left(), tbb->rect.bottom());
385 tbb->rect.right(), tbb->rect.bottom());
402 case PE_PanelScrollAreaCorner: {
404 QColor alphaOutline = outline;
411 case PE_IndicatorArrowUp:
412 case PE_IndicatorArrowDown:
413 case PE_IndicatorArrowRight:
414 case PE_IndicatorArrowLeft:
416 if (
option->rect.width() <= 1 ||
option->rect.height() <= 1)
418 QColor arrowColor =
option->palette.windowText().color();
422 case PE_IndicatorArrowDown:
425 case PE_IndicatorArrowRight:
428 case PE_IndicatorArrowLeft:
437 case PE_IndicatorItemViewItemCheck:
440 button.QStyleOption::operator=(*option);
441 button.state &= ~State_MouseOver;
445 case PE_IndicatorHeaderArrow:
448 QColor arrowColor =
header->palette.windowText().color();
449 arrowColor.setAlpha(180);
452#if defined(Q_OS_LINUX)
467 case PE_IndicatorButtonDropDown:
471 case PE_IndicatorToolBarSeparator:
474 const int margin = 6;
475 if (
option->state & State_Horizontal) {
479 rect.bottomLeft().y() - margin,
481 rect.topLeft().y() + margin);
484 rect.bottomLeft().y() - margin,
486 rect.topLeft().y() + margin);
492 rect.topRight().x() - margin,
497 rect.topRight().x() - margin,
505 copy.state |= State_Raised;
511 thePen.setCosmetic(
false);
536 case PE_FrameDockWidget:
554 case PE_PanelButtonTool:
556 if ((
option->state & State_Enabled ||
option->state & State_On) || !(
option->state & State_AutoRaise)) {
558 if (
option->state & State_MouseOver)
566 case PE_IndicatorDockWidgetResizeHandle:
569 bool horizontal =
option->
state & State_Horizontal;
570 dockWidgetHandle.state.setFlag(State_Horizontal, !horizontal);
591 case PE_FrameLineEdit:
594 bool hasFocus =
option->state & State_HasFocus;
607 QColor softHighlight = highlightedOutline;
620 case PE_IndicatorCheckBox:
627 QColor pressedColor = mergedColors(
option->palette.base().color(),
option->palette.windowText().color(), 85);
639 if (
option->state & State_HasFocus &&
option->state & State_KeyboardFocusChange)
644 const qreal checkMarkPadding = 1 +
rect.width() * 0.13;
646 if (
checkbox->state & State_NoChange) {
648 checkMarkColor.setAlpha(80);
650 checkMarkColor.setAlpha(140);
652 checkMarkColor.setAlpha(180);
655 painter->
drawRect(
rect.adjusted(checkMarkPadding, checkMarkPadding, -checkMarkPadding, -checkMarkPadding));
657 }
else if (
checkbox->state & State_On) {
660 penWidth = qMax<qreal>(penWidth, 0.13 *
rect.height());
661 penWidth = qMin<qreal>(penWidth, 0.20 *
rect.height());
662 QPen checkPen =
QPen(checkMarkColor, penWidth);
663 checkMarkColor.setAlpha(210);
671 path.moveTo(checkMarkPadding + rectHeight * 0.11, rectHeight * 0.47);
672 path.lineTo(rectHeight * 0.5, rectHeight - checkMarkPadding);
673 path.lineTo(rectHeight - checkMarkPadding, checkMarkPadding);
679 case PE_IndicatorRadioButton:
682 QColor pressedColor = mergedColors(
option->palette.base().color(),
option->palette.windowText().color(), 85);
687 const qreal outlineRadius = (
rect.width() + (
rect.width() + 1) % 2) / 2.0 - 1;
688 circle.
addEllipse(circleCenter, outlineRadius, outlineRadius);
690 if (
option->state & State_HasFocus &&
option->state & State_KeyboardFocusChange)
694 if (
state & (State_On )) {
696 const qreal checkmarkRadius = outlineRadius / 2.32;
697 circle.
addEllipse(circleCenter, checkmarkRadius, checkmarkRadius);
701 checkMarkColor.setAlpha(180);
708 case PE_IndicatorToolBarHandle:
711 if (
option->state & State_Horizontal) {
712 for (
int i = -3 ;
i < 2 ;
i += 3) {
713 for (
int j = -8 ;
j < 10 ;
j += 3) {
719 for (
int i = -6 ;
i < 12 ;
i += 3) {
720 for (
int j = -3 ;
j < 2 ;
j += 3) {
728 case PE_FrameDefaultButton:
730 case PE_FrameFocusRect:
733 if (!(fropt->state & State_KeyboardFocusChange))
740 QColor fillcolor = highlightedOutline;
743 fillcolor.setAlpha(30);
745 gradient.
setColorAt(0, fillcolor.lighter(160));
752 case PE_PanelButtonCommand:
754 bool isDefault =
false;
756 bool isDown = (
option->state & State_Sunken) || (
option->state & State_On);
764 if (isFlat && !isDown) {
768 const QLine lines[4] = {
780 QPoint(
r.right() - 1,
r.bottom() - 1),
782 QPoint(
r.left() + 1,
r.bottom() - 1),
792 bool hasFocus = (
option->state & State_HasFocus &&
option->state & State_KeyboardFocusChange);
795 QColor darkOutline = outline;
796 if (hasFocus | isDefault) {
797 darkOutline = highlightedOutline;
801 buttonColor = mergedColors(buttonColor, highlightedOutline.
lighter(130), 90);
804 r =
rect.adjusted(0, 1, -1, 0);
807 p->translate(0.5, -0.5);
809 QLinearGradient gradient = qt_fusion_gradient(
rect, (isEnabled &&
option->state & State_MouseOver ) ? buttonColor : buttonColor.darker(104));
811 p->setBrush(isDown ?
QBrush(buttonColor.
darker(110)) : gradient);
812 p->drawRoundedRect(
r, 2.0, 2.0);
816 p->setPen(!isEnabled ?
QPen(darkOutline.lighter(115)) :
QPen(darkOutline));
817 p->drawRoundedRect(
r, 2.0, 2.0);
819 p->setPen(
d->innerContrastLine());
820 p->drawRoundedRect(
r.adjusted(1, 1, -1, -1), 2.0, 2.0);
825 case PE_FrameTabWidget:
828#if QT_CONFIG(tabwidget)
829 if (
const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(
option)) {
835 rect.adjust(0, 0, 0, -1);
837 alphaShadow.setAlpha(15);
855 case PE_FrameStatusBarItem:
878 Q_D (
const QFusionStyle);
881 QColor highlightedOutline =
d->highlightedOutline(
option->palette);
882 QColor shadow =
d->darkShade();
885 case CE_ComboBoxLabel:
887 QRect editRect =
proxy()->subControlRect(CC_ComboBox,
cb, SC_ComboBoxEditField,
widget);
890 if (!
cb->currentIcon.isNull()) {
894 QRect iconRect(editRect);
895 iconRect.setWidth(
cb->iconSize.width() + 4);
898 iconRect.size(), editRect);
904 editRect.translate(-4 -
cb->iconSize.width(), 0);
906 editRect.translate(
cb->iconSize.width() + 4, 0);
908 if (!
cb->currentText.isEmpty() && !
cb->editable) {
909 proxy()->drawItemText(
painter, editRect.adjusted(1, 0, -1, 0),
910 visualAlignment(
cb->direction,
cb->textAlignment),
911 cb->palette,
cb->state & State_Enabled,
cb->currentText,
920 if (
option->rect.width() > 1 &&
option->rect.height() > 1) {
922 if (
option->state & State_Horizontal) {
923 for (
int j = -6 ;
j< 12 ;
j += 3) {
928 for (
int i = -6;
i< 12 ;
i += 3) {
936#if QT_CONFIG(rubberband)
938 if (qstyleoption_cast<const QStyleOptionRubberBand *>(
option)) {
946 qMin(highlight.
blue()/2 + 110, 255));
949 gradient.
setColorAt(0, dimHighlight.lighter(120));
956 if (
option->rect.width() > 2 &&
option->rect.height() > 2) {
970 for (
int i = -6;
i< 12 ;
i += 3) {
971 for (
int j = -6 ;
j< 12 ;
j += 3) {
981#if QT_CONFIG(toolbar)
983 if (
const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(
option)) {
991 if (!(
option->state & State_Horizontal))
998 QColor light =
d->lightShade();
999 QColor shadow =
d->darkShade();
1003 if (toolBar->positionOfLine == QStyleOptionToolBar::End
1004 || toolBar->positionOfLine == QStyleOptionToolBar::OnlyOne) {
1022 if (toolBar->positionOfLine == QStyleOptionToolBar::End
1023 || toolBar->positionOfLine == QStyleOptionToolBar::Middle) {
1029 if (toolBar->positionOfLine == QStyleOptionToolBar::Beginning
1030 || toolBar->positionOfLine == QStyleOptionToolBar::OnlyOne) {
1043 if (toolBar->positionOfLine == QStyleOptionToolBar::End) {
1057 if (toolBar->positionOfLine == QStyleOptionToolBar::Middle
1058 || toolBar->positionOfLine == QStyleOptionToolBar::End) {
1064 if (toolBar->positionOfLine == QStyleOptionToolBar::End) {
1077 if (toolBar->positionOfLine == QStyleOptionToolBar::Middle
1078 || toolBar->positionOfLine == QStyleOptionToolBar::End) {
1083 if (toolBar->positionOfLine == QStyleOptionToolBar::End
1084 || toolBar->positionOfLine == QStyleOptionToolBar::OnlyOne) {
1103 case CE_DockWidgetTitle:
1106 bool verticalTitleBar = dwOpt->verticalTitleBar;
1109 if (verticalTitleBar) {
1114 r.top() + titleRect.
left() -
rect.left(),
1122 if (!dwOpt->title.isEmpty()) {
1129 dwOpt->state & State_Enabled, titleText,
1135 case CE_HeaderSection:
1140 const bool isSectionDragTarget = headerV2 ? headerV2->isSectionDragTarget :
false;
1155 if (isSectionDragTarget) {
1156 gradientStopColor = gradientStartColor.
darker(130);
1157 gradientStartColor = gradientStartColor.
darker(130);
1159 QLinearGradient gradient(pixmapRect.topLeft(), pixmapRect.bottomLeft());
1161 if (
option->palette.window().gradient()) {
1164 QColor midColor1 = mergedColors(gradientStartColor, gradientStopColor, 60);
1165 QColor midColor2 = mergedColors(gradientStartColor, gradientStopColor, 40);
1169 gradient.
setColorAt(0.92, gradientStopColor);
1170 gradient.
setColorAt(1, gradientStopColor.darker(104));
1172 cachePainter.fillRect(pixmapRect, gradient);
1173 cachePainter.setPen(
d->innerContrastLine());
1175 cachePainter.drawLine(pixmapRect.topLeft(), pixmapRect.topRight());
1176 cachePainter.setPen(
d->outline(
option->palette));
1177 cachePainter.drawLine(pixmapRect.bottomLeft(), pixmapRect.bottomRight());
1182 cachePainter.setPen(
QColor(0, 0, 0, 40));
1183 cachePainter.drawLine(pixmapRect.topRight(), pixmapRect.bottomRight() +
QPoint(0, -1));
1184 cachePainter.setPen(
d->innerContrastLine());
1185 cachePainter.drawLine(pixmapRect.topRight() +
QPoint(-1, 0), pixmapRect.bottomRight() +
QPoint(-1, -1));
1187 cachePainter.setPen(
d->outline(
option->palette));
1188 cachePainter.drawLine(pixmapRect.topRight(), pixmapRect.bottomRight());
1197 case CE_ProgressBarGroove:
1219 case CE_ProgressBarContents:
1223 const auto indeterminate = (bar->minimum == 0 && bar->maximum == 0);
1224 const auto complete = bar->progress == bar->maximum;
1226 const auto inverted = bar->invertedAppearance;
1243 }
else if (reverse) {
1245 m.translate(-
rect.width(), 0);
1250 const auto progress =
qMax(bar->progress, bar->minimum);
1252 const auto progressSteps =
qint64(progress) - bar->minimum;
1253 const auto progressBarWidth = progressSteps *
rect.width() / totalSteps;
1254 int width = indeterminate ?
rect.width() : progressBarWidth;
1261 outline = highlightedoutline;
1268 if (indeterminate || bar->progress > bar->minimum) {
1272 QColor highlightedGradientStartColor = highlight.
lighter(120);
1273 QColor highlightedGradientStopColor = highlight;
1275 gradient.
setColorAt(0, highlightedGradientStartColor);
1276 gradient.
setColorAt(1, highlightedGradientStopColor);
1282 if (!complete && !indeterminate)
1286 if (!indeterminate && !complete)
1295 if (!indeterminate) {
1296#if QT_CONFIG(animation)
1297 (
const_cast<QFusionStylePrivate*
>(
d))->stopAnimation(
option->styleObject);
1300 highlightedGradientStartColor.setAlpha(120);
1303#if QT_CONFIG(animation)
1314 if (!indeterminate && !complete) {
1316 innerShadow.setAlpha(35);
1325 case CE_ProgressBarLabel:
1331 QColor alternateTextColor =
d->highlightedText(
option->palette);
1335 const auto inverted = bar->invertedAppearance;
1338 const auto progressSteps =
qint64(bar->progress) - bar->minimum;
1339 const auto progressIndicatorPos = progressSteps * (vertical ?
rect.height() :
rect.width()) / totalSteps;
1342 if (progressIndicatorPos >= 0 && progressIndicatorPos <=
rect.height()) {
1344 leftRect.setHeight(progressIndicatorPos);
1345 rightRect.setY(progressIndicatorPos);
1347 leftRect.setHeight(
rect.height() - progressIndicatorPos);
1348 rightRect.setY(
rect.height() - progressIndicatorPos);
1352 if (progressIndicatorPos >= 0 && progressIndicatorPos <=
rect.width()) {
1354 leftRect.setWidth(
rect.width() - progressIndicatorPos);
1355 rightRect.setX(
rect.width() - progressIndicatorPos);
1357 leftRect.setWidth(progressIndicatorPos);
1358 rightRect.setX(progressIndicatorPos);
1363 const auto firstIsAlternateColor = (vertical && !inverted) || (!vertical && reverse);
1365 painter->
setPen(firstIsAlternateColor ? alternateTextColor : textColor);
1367 painter->
setPen(firstIsAlternateColor ? textColor : alternateTextColor);
1374 case CE_MenuBarItem:
1379 item.rect = mbi->rect.adjusted(0, 1, 0, -3);
1385 bool act = mbi->state & State_Selected && mbi->state & State_Sunken;
1386 bool dis = !(mbi->state & State_Enabled);
1399 if (!
proxy()->styleHint(SH_UnderlineShortcut, mbi,
widget))
1404 QColor shadow = mergedColors(
option->palette.window().color().darker(120),
1416 QColor highlightOutline = highlightedOutline;
1417 QColor highlight =
option->palette.highlight().color();
1421 if (!menuItem->text.isEmpty()) {
1423 proxy()->drawItemText(
painter, menuItem->rect.adjusted(margin, 0, -margin, 0),
1425 menuItem->palette, menuItem->state & State_Enabled, menuItem->text,
1427 w = menuItem->fontMetrics.horizontalAdvance(menuItem->text) + margin;
1431 qreal y = menuItem->rect.center().y() + 0.5f;
1437 const bool selected = menuItem->state & State_Selected && menuItem->state & State_Enabled;
1445 const bool checked = menuItem->checked;
1446 const bool sunken = menuItem->state & State_Sunken;
1447 const bool enabled = menuItem->state & State_Enabled;
1449 const int checkColHOffset = QFusionStylePrivate::menuItemHMargin +
windowsItemFrame - 1;
1451 int checkcol = qMax<int>(menuItem->rect.height() * 0.79,
1453 bool ignoreCheckMark =
false;
1456 qobject_cast<const QComboBox*>(
widget) ||
1458 (
option->styleObject &&
option->styleObject->property(
"_q_isComboBoxPopupItem").toBool()))
1459 ignoreCheckMark =
true;
1461 if (!ignoreCheckMark || menuItem->state & (State_On | State_Off)) {
1464 const qreal boxWidth = checkcol - 2 * boxMargin;
1466 option->rect.center().y() - boxWidth/2 + 1, boxWidth,
1468 checkRect.setWidth(checkRect.height());
1469 checkRect =
visualRect(menuItem->direction, menuItem->rect, checkRect);
1473 if (menuItem->state & State_On || checked || sunken) {
1482 const int adjustment = checkRect.height() * 0.3;
1483 painter->
drawEllipse(checkRect.adjusted(adjustment, adjustment, -adjustment, -adjustment));
1487 if (menuItem->icon.isNull()) {
1489 box.QStyleOption::operator=(*option);
1491 if (checked || menuItem->state & State_On)
1492 box.state |= State_On;
1494 box.state |= State_Off;
1500 if (menuItem->icon.isNull())
1503 checkcol = menuItem->maxIconWidth;
1507 const bool dis = !(menuItem->state & State_Enabled);
1508 const bool act = menuItem->state & State_Selected;
1514 QRect(menuitem->rect.x() + checkColHOffset, menuitem->rect.y(),
1515 checkcol, menuitem->rect.height()));
1516 if (!menuItem->icon.isNull()) {
1524#if QT_CONFIG(combobox)
1534 pmr.moveCenter(vCheckRect.center());
1536 if (!ignoreCheckMark && checkable && checked) {
1539 QColor activeColor = mergedColors(
option->palette.window().color(),
1540 option->palette.highlight().color());
1550 painter->
setPen(menuItem->palette.highlightedText().color());
1555 menuitem->rect.getRect(&
x, &
y, &
w, &
h);
1558 discol = menuitem->palette.text().color();
1561 const int xm = checkColHOffset + checkcol + QFusionStylePrivate::menuItemHMargin;
1562 const int xpos = menuitem->rect.x() + xm;
1565 w - xm - QFusionStylePrivate::menuRightBorder - menuitem->reservedShortcutWidth + 2,
1573 if (!
proxy()->styleHint(SH_UnderlineShortcut, menuitem,
widget))
1576 if (tabIndex >= 0) {
1580 const QString textToDraw =
s.
mid(tabIndex + 1).toString();
1582 p->setPen(menuitem->palette.light().color());
1583 p->drawText(vShortcutRect.adjusted(1, 1, 1, 1), text_flags, textToDraw);
1586 p->drawText(vShortcutRect, text_flags, textToDraw);
1606 p->setPen(menuitem->palette.light().color());
1607 p->drawText(vTextRect.adjusted(1, 1, 1, 1), text_flags, textToDraw);
1610 p->drawText(vTextRect, text_flags, textToDraw);
1616 const int dim = (menuItem->rect.height() - 4) / 2;
1617 PrimitiveElement arrow;
1619 const int xpos = menuItem->rect.
left() + menuItem->rect.width() - 3 - dim;
1621 QRect(xpos, menuItem->rect.top() + menuItem->rect.height() / 2 - dim / 2, dim, dim));
1623 newMI.
rect = vSubMenuRect;
1624 newMI.state = !
enabled ? State_None : State_Enabled;
1627 newMI.palette.highlightedText().color());
1633 case CE_MenuHMargin:
1634 case CE_MenuVMargin:
1636 case CE_MenuEmptyArea:
1646 case CE_MenuBarEmptyArea:
1650 QColor shadow = mergedColors(
option->palette.window().color().darker(120),
1657#if QT_CONFIG(tabbar)
1658 case CE_TabBarTabShape:
1660 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(
option)) {
1665 bool selected = tab->state & State_Selected;
1666 bool lastTab = ((!rtlHorTabs && tab->position == QStyleOptionTab::End)
1668 && tab->position == QStyleOptionTab::Beginning));
1669 bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab;
1670 int tabOverlap = pixelMetric(PM_TabBarTabOverlap,
option,
widget);
1671 rect =
option->rect.adjusted(0, 0, (onlyOne || lastTab) ? 0 : tabOverlap, 0);
1685 switch (tab->shape) {
1689 rotMatrix.rotate(180);
1690 rotMatrix.translate(0, -
rect.height() + 1);
1691 rotMatrix.scale(-1, 1);
1695 rotMatrix.rotate(180 + 90);
1696 rotMatrix.scale(-1, 1);
1701 rotMatrix.rotate(90);
1702 rotMatrix.translate(0, -
rect.width() + 1);
1726 QColor tabFrameColor = tab->features & QStyleOptionTab::HasFrame ?
1727 d->tabFrameColor(
option->palette) :
1728 option->palette.window().color();
1734 fillGradient.setColorAt(0, tabFrameColor.
lighter(104));
1744 fillGradient.setColorAt(1, tabFrameColor);
1745 outlineGradient.setColorAt(1, outline);
1746 outlinePen =
QPen(outlineGradient, 1);
1748 fillGradient.setColorAt(0, tabFrameColor.
darker(108));
1749 fillGradient.setColorAt(0.85, tabFrameColor.
darker(108));
1750 fillGradient.setColorAt(1, tabFrameColor.
darker(116));
1785QPalette QFusionStyle::standardPalette ()
const
1797 Q_D (
const QFusionStyle);
1799#if QT_CONFIG(spinbox) || QT_CONFIG(slider)
1801 QColor gradientStopColor = buttonColor;
1803#if QT_CONFIG(slider)
1813 alphaCornerColor = mergedColors(
option->palette.window().color(), outline);
1826 frame.QStyleOption::operator=(*groupBox);
1838 finalRect.
adjust(ltr ? -4 : -2, 0, ltr ? 2 : 4, 0);
1841 finalRect.
adjust(-2, 0, 2, 0);
1843 region -= finalRect.adjusted(0, 0, 0, 3 -
textRect.
height() / 2);
1861 if (
groupBox->state & State_HasFocus) {
1863 fropt.QStyleOption::operator=(*groupBox);
1870 if (
groupBox->subControls & SC_GroupBoxCheckBox) {
1872 box.QStyleOption::operator=(*groupBox);
1879#if QT_CONFIG(spinbox)
1881 if (
const QStyleOptionSpinBox *
spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(
option)) {
1898 bool sunken = (
spinBox->state & State_Sunken);
1899 bool upIsActive = (
spinBox->activeSubControls == SC_SpinBoxUp);
1900 bool downIsActive = (
spinBox->activeSubControls == SC_SpinBoxDown);
1901 bool hasFocus = (
option->state & State_HasFocus);
1903 QStyleOptionSpinBox spinBoxCopy = *
spinBox;
1904 spinBoxCopy.
rect = pixmapRect;
1905 QRect upRect =
proxy()->subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxUp,
widget);
1906 QRect downRect =
proxy()->subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxDown,
widget);
1909 cachePainter.save();
1911 cachePainter.translate(0.5, 0.5);
1915 cachePainter.setBrush(
option->palette.base());
1916 cachePainter.drawRoundedRect(
r.adjusted(0, 0, -1, -1), 2, 2);
1919 cachePainter.setPen(
d->topShadow());
1920 cachePainter.drawLine(
QPoint(
r.left() + 2,
r.top() + 1),
QPoint(
r.right() - 2,
r.top() + 1));
1922 if (!upRect.isNull()) {
1925 const QRect updownRect = upRect.
adjusted(0, -2, 0, downRect.height() + 2);
1926 const QLinearGradient gradient = qt_fusion_gradient(updownRect, (isEnabled &&
option->state & State_MouseOver )
1927 ? buttonColor : buttonColor.darker(104));
1930 cachePainter.setBrush(gradient);
1932 cachePainter.save();
1933 cachePainter.setClipRect(updownRect);
1934 cachePainter.drawRoundedRect(
r.adjusted(0, 0, -1, -1), 2, 2);
1935 cachePainter.setPen(
QPen(
d->innerContrastLine()));
1937 cachePainter.drawRoundedRect(
r.adjusted(1, 1, -2, -2), 2, 2);
1938 cachePainter.restore();
1943 cachePainter.fillRect(upRect.adjusted(0, -1, 0, 0), gradientStopColor.darker(110));
1945 cachePainter.fillRect(upRect.adjusted(0, -1, 0, 0),
d->innerContrastLine());
1950 cachePainter.fillRect(downRect.adjusted(0, 0, 0, 1), gradientStopColor.darker(110));
1952 cachePainter.fillRect(downRect.adjusted(0, 0, 0, 1),
d->innerContrastLine());
1955 cachePainter.setPen(hasFocus ?
d->highlightedOutline(
option->palette) : outline);
1957 cachePainter.drawRoundedRect(
r.adjusted(0, 0, -1, -1), 2, 2);
1959 QColor softHighlight =
option->palette.highlight().color();
1961 cachePainter.setPen(softHighlight);
1962 cachePainter.drawRoundedRect(
r.adjusted(1, 1, -2, -2), 1.7, 1.7);
1964 cachePainter.restore();
1970 cachePainter.setPen(outline);
1972 cachePainter.drawLine(
QLineF(upRect.right(), upRect.top() - 0.5, upRect.right(), downRect.bottom() + 1.5));
1974 cachePainter.drawLine(
QLineF(upRect.left(), upRect.top() - 0.5, upRect.left(), downRect.bottom() + 1.5));
1977 if (upIsActive && sunken) {
1978 cachePainter.setPen(gradientStopColor.darker(130));
1979 cachePainter.drawLine(downRect.left() + 1, downRect.top(), downRect.right(), downRect.top());
1980 cachePainter.drawLine(upRect.left() + 1, upRect.top(), upRect.left() + 1, upRect.bottom());
1981 cachePainter.drawLine(upRect.left() + 1, upRect.top() - 1, upRect.right(), upRect.top() - 1);
1984 if (downIsActive && sunken) {
1985 cachePainter.setPen(gradientStopColor.darker(130));
1986 cachePainter.drawLine(downRect.left() + 1, downRect.top(), downRect.left() + 1, downRect.bottom() + 1);
1987 cachePainter.drawLine(downRect.left() + 1, downRect.top(), downRect.right(), downRect.top());
1988 cachePainter.setPen(gradientStopColor.darker(110));
1989 cachePainter.drawLine(downRect.left() + 1, downRect.bottom() + 1, downRect.right(), downRect.bottom() + 1);
1992 QColor disabledColor = mergedColors(arrowColor,
option->palette.button().color());
1994 int centerX = upRect.center().x();
1995 int centerY = upRect.center().y();
1999 cachePainter.drawLine(centerX - 1, centerY, centerX + 3, centerY);
2000 cachePainter.drawLine(centerX + 1, centerY - 2, centerX + 1, centerY + 2);
2002 centerX = downRect.center().x();
2003 centerY = downRect.center().y();
2005 cachePainter.drawLine(centerX - 1, centerY, centerX + 3, centerY);
2009 qt_fusion_draw_arrow(
Qt::UpArrow, &cachePainter,
option, upRect.adjusted(0, 0, 0, 1),
2025 const int buttonMargin = 5;
2026 bool active = (titleBar->titleBarState & State_Active);
2027 QRect fullRect = titleBar->rect;
2029 QColor highlight =
option->palette.highlight().color();
2031 QColor titleBarFrameBorder(active ? highlight.
darker(180): outline.darker(110));
2033 QColor textColor(active ? 0xffffff : 0xff000000);
2034 QColor textAlphaColor(active ? 0xffffff : 0xff000000 );
2042 gradient.
setColorAt(0, titlebarColor.lighter(114));
2043 gradient.
setColorAt(0.5, titlebarColor.lighter(102));
2044 gradient.
setColorAt(0.51, titlebarColor.darker(104));
2064 const QPoint points2[5] = {
2082 painter->
setPen(active? (titleBar->palette.text().color().lighter(120)) :
2093 QRect minButtonRect =
proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton,
widget);
2094 if (minButtonRect.isValid()) {
2095 bool hover = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_MouseOver);
2096 bool sunken = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_Sunken);
2097 qt_fusion_draw_mdibutton(
painter, titleBar, minButtonRect, hover, sunken);
2098 QRect minButtonIconRect = minButtonRect.
adjusted(buttonMargin ,buttonMargin , -buttonMargin, -buttonMargin);
2100 painter->
drawLine(minButtonIconRect.center().x() - 2, minButtonIconRect.center().y() + 3,
2101 minButtonIconRect.center().x() + 3, minButtonIconRect.center().y() + 3);
2102 painter->
drawLine(minButtonIconRect.center().x() - 2, minButtonIconRect.center().y() + 4,
2103 minButtonIconRect.center().x() + 3, minButtonIconRect.center().y() + 4);
2105 painter->
drawLine(minButtonIconRect.center().x() - 3, minButtonIconRect.center().y() + 3,
2106 minButtonIconRect.center().x() - 3, minButtonIconRect.center().y() + 4);
2107 painter->
drawLine(minButtonIconRect.center().x() + 4, minButtonIconRect.center().y() + 3,
2108 minButtonIconRect.center().x() + 4, minButtonIconRect.center().y() + 4);
2114 QRect maxButtonRect =
proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton,
widget);
2115 if (maxButtonRect.isValid()) {
2116 bool hover = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_MouseOver);
2117 bool sunken = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_Sunken);
2118 qt_fusion_draw_mdibutton(
painter, titleBar, maxButtonRect, hover, sunken);
2120 QRect maxButtonIconRect = maxButtonRect.
adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin);
2124 painter->
drawLine(maxButtonIconRect.left() + 1, maxButtonIconRect.top() + 1,
2125 maxButtonIconRect.right() - 1, maxButtonIconRect.top() + 1);
2128 maxButtonIconRect.topLeft(),
2129 maxButtonIconRect.topRight(),
2130 maxButtonIconRect.bottomLeft(),
2131 maxButtonIconRect.bottomRight()
2139 QRect closeButtonRect =
proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton,
widget);
2140 if (closeButtonRect.
isValid()) {
2141 bool hover = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_MouseOver);
2142 bool sunken = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_Sunken);
2143 qt_fusion_draw_mdibutton(
painter, titleBar, closeButtonRect, hover, sunken);
2144 QRect closeIconRect = closeButtonRect.
adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin);
2146 const QLine lines[4] = {
2147 QLine(closeIconRect.left() + 1, closeIconRect.top(),
2148 closeIconRect.right(), closeIconRect.bottom() - 1),
2149 QLine(closeIconRect.left(), closeIconRect.top() + 1,
2150 closeIconRect.right() - 1, closeIconRect.bottom()),
2151 QLine(closeIconRect.right() - 1, closeIconRect.top(),
2152 closeIconRect.left(), closeIconRect.bottom() - 1),
2153 QLine(closeIconRect.right(), closeIconRect.top() + 1,
2154 closeIconRect.left() + 1, closeIconRect.bottom())
2158 closeIconRect.topLeft(),
2159 closeIconRect.topRight(),
2160 closeIconRect.bottomLeft(),
2161 closeIconRect.bottomRight()
2167 closeIconRect.right() - 1, closeIconRect.bottom() - 1);
2168 painter->
drawLine(closeIconRect.left() + 1, closeIconRect.bottom() - 1,
2169 closeIconRect.right() - 1, closeIconRect.top() + 1);
2174 if ((titleBar->subControls & SC_TitleBarNormalButton) &&
2179 QRect normalButtonRect =
proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton,
widget);
2180 if (normalButtonRect.isValid()) {
2182 bool hover = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_MouseOver);
2183 bool sunken = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_Sunken);
2184 QRect normalButtonIconRect = normalButtonRect.
adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin);
2185 qt_fusion_draw_mdibutton(
painter, titleBar, normalButtonRect, hover, sunken);
2187 QRect frontWindowRect = normalButtonIconRect.
adjusted(0, 3, -3, 0);
2190 painter->
drawLine(frontWindowRect.left() + 1, frontWindowRect.top() + 1,
2191 frontWindowRect.right() - 1, frontWindowRect.top() + 1);
2194 frontWindowRect.topLeft(),
2195 frontWindowRect.topRight(),
2196 frontWindowRect.bottomLeft(),
2197 frontWindowRect.bottomRight()
2201 QRect backWindowRect = normalButtonIconRect.
adjusted(3, 0, 0, -3);
2202 QRegion clipRegion = backWindowRect;
2203 clipRegion -= frontWindowRect;
2208 painter->
drawLine(backWindowRect.left() + 1, backWindowRect.top() + 1,
2209 backWindowRect.right() - 1, backWindowRect.top() + 1);
2211 const QPoint points2[4] = {
2212 backWindowRect.topLeft(),
2213 backWindowRect.topRight(),
2214 backWindowRect.bottomLeft(),
2215 backWindowRect.bottomRight()
2223 if (titleBar->subControls & SC_TitleBarContextHelpButton
2225 QRect contextHelpButtonRect =
proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton,
widget);
2226 if (contextHelpButtonRect.isValid()) {
2227 bool hover = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_MouseOver);
2228 bool sunken = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_Sunken);
2229 qt_fusion_draw_mdibutton(
painter, titleBar, contextHelpButtonRect, hover, sunken);
2230#if QT_CONFIG(imageformat_xpm)
2244 QRect shadeButtonRect =
proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton,
widget);
2245 if (shadeButtonRect.isValid()) {
2246 bool hover = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_MouseOver);
2247 bool sunken = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_Sunken);
2248 qt_fusion_draw_mdibutton(
painter, titleBar, shadeButtonRect, hover, sunken);
2255 QRect unshadeButtonRect =
proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton,
widget);
2256 if (unshadeButtonRect.isValid()) {
2257 bool hover = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_MouseOver);
2258 bool sunken = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_Sunken);
2259 qt_fusion_draw_mdibutton(
painter, titleBar, unshadeButtonRect, hover, sunken);
2265 QRect iconRect =
proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu,
widget);
2266 if (iconRect.isValid()) {
2267 if (!titleBar->icon.isNull()) {
2268 titleBar->icon.paint(
painter, iconRect);
2271 QPixmap pm =
proxy()->standardIcon(SP_TitleBarMenuButton, &tool,
widget).pixmap(16, 16);
2272 tool.
rect = iconRect;
2282#if QT_CONFIG(slider)
2285 if (
const QStyleOptionSlider *
scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(
option)) {
2286 bool wasActive =
false;
2287 qreal expandScale = 1.0;
2288 qreal expandOffset = -1.0;
2291#if QT_CONFIG(animation)
2292 qreal opacity = 0.0;
2293 bool shouldExpand =
false;
2294 const qreal maxExpandScale = 13.0 / 9.0;
2301 QStyle::State oldState =
static_cast<QStyle::State
>(qvariant_cast<QStyle::State::Int>(
styleObject->
property(
"_q_stylestate")));
2306 bool transient = !
option->activeSubControls && !(
option->state & State_On);
2314 oldActiveControls !=
scrollBar->activeSubControls) {
2323#if QT_CONFIG(animation)
2332 d->startAnimation(anim);
2344#if QT_CONFIG(animation)
2349 if (oldActiveControls)
2356 shouldExpand = (
option->activeSubControls || wasActive);
2358 if (!anim && !oldActiveControls) {
2361 d->startAnimation(anim);
2364 expandScale = 1.0 + (maxExpandScale - 1.0) * anim->
currentValue();
2368 expandScale = maxExpandScale;
2378 bool sunken =
scrollBar->state & State_Sunken;
2386 QColor alphaOutline = outline;
2389 QColor arrowColor =
option->palette.windowText().color();
2393 const bool isDarkBg = bgColor.red() < 128 && bgColor.green() < 128 && bgColor.blue() < 128;
2397 rect.setY(
rect.y() + 4.5 - expandOffset);
2398 scrollBarSlider.setY(scrollBarSlider.y() + 4.5 - expandOffset);
2399 scrollBarGroove.setY(scrollBarGroove.y() + 4.5 - expandOffset);
2401 rect.setHeight(
rect.height() * expandScale);
2402 scrollBarGroove.setHeight(scrollBarGroove.height() * expandScale);
2404 rect.setX(
rect.x() + 4.5 - expandOffset);
2405 scrollBarSlider.setX(scrollBarSlider.x() + 4.5 - expandOffset);
2406 scrollBarGroove.setX(scrollBarGroove.x() + 4.5 - expandOffset);
2408 rect.setWidth(
rect.width() * expandScale);
2409 scrollBarGroove.setWidth(scrollBarGroove.width() * expandScale);
2414 if ((!transient ||
scrollBar->activeSubControls || wasActive) &&
scrollBar->subControls & SC_ScrollBarGroove) {
2420 if (!transient || !isDarkBg) {
2426 gradient.
setColorAt(0, bgColor.lighter(157));
2427 gradient.
setColorAt(0.1, bgColor.lighter(155));
2428 gradient.
setColorAt(0.9, bgColor.lighter(155));
2429 gradient.
setColorAt(1, bgColor.lighter(157));
2445 QColor subtleEdge = alphaOutline;
2453 QRect pixmapRect = scrollBarSlider;
2455 pixmapRect.center().x(), pixmapRect.bottom());
2457 gradient =
QLinearGradient(pixmapRect.left(), pixmapRect.center().y(),
2458 pixmapRect.right(), pixmapRect.center().y());
2462 QColor midColor2 = mergedColors(gradientStartColor, gradientStopColor, 40);
2466 highlightedGradient.setColorAt(0, gradientStartColor.darker(102));
2467 highlightedGradient.setColorAt(1, gradientStopColor.lighter(102));
2470 if (
scrollBar->subControls & SC_ScrollBarSlider) {
2472 QRect rect = scrollBarSlider.
adjusted(horizontal ? 1 : 2, horizontal ? 2 : 1, -1, -1);
2482 QRect pixmapRect = scrollBarSlider;
2484 if (
option->state & State_Sunken &&
scrollBar->activeSubControls & SC_ScrollBarSlider)
2486 else if (
option->state & State_MouseOver &&
scrollBar->activeSubControls & SC_ScrollBarSlider)
2493 painter->
drawRect(pixmapRect.adjusted(horizontal ? -1 : 0, horizontal ? 0 : -1, horizontal ? 0 : -1, horizontal ? -1 : 0));
2496 painter->
drawRect(scrollBarSlider.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0, -1, -1));
2511 if (!transient &&
scrollBar->subControls & SC_ScrollBarSubLine) {
2512 if ((
scrollBar->activeSubControls & SC_ScrollBarSubLine) && sunken)
2514 else if ((
scrollBar->activeSubControls & SC_ScrollBarSubLine))
2520 painter->
drawRect(scrollBarSubLine.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0, 0, 0));
2522 if (
option->state & State_Horizontal) {
2523 painter->
drawRect(scrollBarSubLine.adjusted(horizontal ? 0 : 1, 0, horizontal ? 1 : 0, horizontal ? -1 : 0));
2525 painter->
drawRect(scrollBarSubLine.adjusted(0, 0, horizontal ? 0 : -1, 0));
2528 QRect upRect = scrollBarSubLine.
adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0, horizontal ? -2 : -1, horizontal ? -1 : -2);
2535 if (
option->state & State_Horizontal)
2537 qt_fusion_draw_arrow(arrowType,
painter,
option, upRect, arrowColor);
2541 if (!transient &&
scrollBar->subControls & SC_ScrollBarAddLine) {
2542 if ((
scrollBar->activeSubControls & SC_ScrollBarAddLine) && sunken)
2544 else if ((
scrollBar->activeSubControls & SC_ScrollBarAddLine))
2550 painter->
drawRect(scrollBarAddLine.adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0, 0, 0));
2552 if (
option->state & State_Horizontal) {
2553 painter->
drawRect(scrollBarAddLine.adjusted(horizontal ? -1 : 0, 0, horizontal ? -1 : 0, horizontal ? -1 : 0));
2555 painter->
drawRect(scrollBarAddLine.adjusted(0, horizontal ? 0 : -1, horizontal ? 0 : -1, horizontal ? 0 : -1));
2564 if (
option->state & State_Horizontal)
2566 qt_fusion_draw_arrow(arrowType,
painter,
option, downRect, arrowColor);
2576 bool hasFocus =
option->state & State_HasFocus &&
option->state & State_KeyboardFocusChange;
2577 bool sunken = comboBox->state & State_On;
2578 bool isEnabled = (comboBox->state & State_Enabled);
2590 QRect pixmapRect(0, 0, comboBox->rect.width(), comboBox->rect.height());
2592 comboBoxCopy.
rect = pixmapRect;
2595 QRect downArrowRect =
proxy()->subControlRect(CC_ComboBox, &comboBoxCopy,
2596 SC_ComboBoxArrow,
widget);
2598 if (comboBox->editable) {
2600 buttonOption.QStyleOption::operator=(*comboBox);
2602 buttonOption.state = (comboBox->state & (State_Enabled | State_MouseOver | State_HasFocus))
2603 | State_KeyboardFocusChange;
2606 buttonOption.state |= State_Sunken;
2607 buttonOption.state &= ~State_MouseOver;
2610 if (comboBox->frame) {
2611 cachePainter.save();
2615 cachePainter.setBrush(buttonOption.palette.base());
2616 cachePainter.drawRoundedRect(
rect.adjusted(0, 0, -1, -1), 2, 2);
2617 cachePainter.restore();
2618 proxy()->drawPrimitive(PE_FrameLineEdit, &buttonOption, &cachePainter,
widget);
2622 cachePainter.save();
2623 cachePainter.setClipRect(downArrowRect.adjusted(0, 0, 1, 0));
2625 downArrowRect.left() - 6: downArrowRect.
right() + 6);
2626 proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter,
widget);
2627 cachePainter.restore();
2628 cachePainter.setPen(
QPen(hasFocus ?
option->palette.highlight() : outline.lighter(110), 1));
2633 cachePainter.drawLine(
QPoint(downArrowRect.right() - 1, downArrowRect.top() + borderSize ),
2634 QPoint(downArrowRect.right() - 1, downArrowRect.bottom() - borderSize));
2636 cachePainter.drawLine(
QPoint(downArrowRect.left() , downArrowRect.top() + borderSize),
2637 QPoint(downArrowRect.left() , downArrowRect.bottom() - borderSize));
2641 cachePainter.drawLine(
QPoint(downArrowRect.right(), downArrowRect.top() + 2),
2642 QPoint(downArrowRect.right(), downArrowRect.bottom() - 2));
2645 cachePainter.drawLine(
QPoint(downArrowRect.left(), downArrowRect.top() + 2),
2646 QPoint(downArrowRect.left(), downArrowRect.bottom() - 2));
2651 buttonOption.QStyleOption::operator=(*comboBox);
2653 buttonOption.state = comboBox->state & (State_Enabled | State_MouseOver | State_HasFocus | State_KeyboardFocusChange);
2655 buttonOption.state |= State_Sunken;
2656 buttonOption.state &= ~State_MouseOver;
2658 proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter,
widget);
2660 if (comboBox->subControls & SC_ComboBoxArrow) {
2662 QColor arrowColor =
option->palette.buttonText().color();
2673#if QT_CONFIG(slider)
2675 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(
option)) {
2688 shadowAlpha.setAlpha(10);
2689 if (
option->state & State_HasFocus &&
option->state & State_KeyboardFocusChange)
2690 outline =
d->highlightedOutline(
option->palette);
2693 if ((
option->subControls & SC_SliderGroove) && groove.isValid()) {
2697 qMin(255, (
int)(buttonColor.
value()*0.9)));
2699 groove.size(),
dpr);
2700 QRect pixmapRect(0, 0, groove.width(), groove.height());
2707 groovePainter.translate(0.5, 0.5);
2710 gradient.
setStart(pixmapRect.center().x(), pixmapRect.top());
2711 gradient.
setFinalStop(pixmapRect.center().x(), pixmapRect.bottom());
2714 gradient.
setStart(pixmapRect.left(), pixmapRect.center().y());
2715 gradient.
setFinalStop(pixmapRect.right(), pixmapRect.center().y());
2717 groovePainter.setPen(
QPen(outline));
2720 groovePainter.setBrush(gradient);
2721 groovePainter.drawRoundedRect(pixmapRect.adjusted(1, 1, -2, -2), 1, 1);
2722 groovePainter.end();
2729 if (!groovePixmapName.isEmpty())
2730 groovePixmapName +=
"_blue"_L1;
2736 gradient.
setStart(pixmapRect.center().x(), pixmapRect.top());
2737 gradient.
setFinalStop(pixmapRect.center().x(), pixmapRect.bottom());
2740 gradient.
setStart(pixmapRect.left(), pixmapRect.center().y());
2741 gradient.
setFinalStop(pixmapRect.right(), pixmapRect.center().y());
2745 QColor grooveOutline = outline;
2746 if (
qGray(grooveOutline.rgb()) >
qGray(highlightedoutline.rgb()))
2747 grooveOutline = highlightedoutline;
2750 groovePainter.translate(0.5, 0.5);
2751 groovePainter.setPen(
QPen(grooveOutline));
2753 gradient.
setColorAt(1, activeHighlight.lighter(130));
2754 groovePainter.setBrush(gradient);
2755 groovePainter.drawRoundedRect(pixmapRect.adjusted(1, 1, -2, -2), 1, 1);
2756 groovePainter.setPen(
d->innerContrastLine());
2758 groovePainter.drawRoundedRect(pixmapRect.adjusted(2, 2, -3, -3), 1, 1);
2759 groovePainter.end();
2763 if (slider->upsideDown)
2764 clipRect =
QRect(
handle.right(), groove.top(), groove.right() -
handle.right(), groove.height());
2766 clipRect =
QRect(groove.left(), groove.top(),
2767 handle.left() - slider->rect.left(), groove.height());
2769 if (slider->upsideDown)
2770 clipRect =
QRect(groove.left(),
handle.bottom(), groove.width(), groove.height() - (
handle.bottom() - slider->rect.top()));
2772 clipRect =
QRect(groove.left(), groove.top(), groove.width(),
handle.top() - groove.top());
2780 if (
option->subControls & SC_SliderTickmarks) {
2785 int available =
proxy()->pixelMetric(PM_SliderSpaceAvailable, slider,
widget);
2786 int interval = slider->tickInterval;
2787 if (interval <= 0) {
2788 interval = slider->singleStep;
2793 interval = slider->pageStep;
2798 int v = slider->minimum;
2800 QVector<QLine> lines;
2801 while (v <= slider->maximum + 1) {
2802 if (
v == slider->maximum + 1 && interval == 1)
2804 const int v_ =
qMin(
v, slider->maximum);
2805 int pos = sliderPositionFromValue(slider->minimum, slider->maximum,
2807 ? slider->rect.width()
2809 slider->upsideDown) +
len / 2;
2810 int extra = 2 - ((v_ == slider->minimum || v_ == slider->maximum) ? 1 : 0);
2814 lines +=
QLine(
pos, slider->rect.top() + extra,
2815 pos, slider->rect.top() + tickSize);
2818 lines +=
QLine(
pos, slider->rect.bottom() - extra,
2819 pos, slider->rect.bottom() - tickSize);
2823 lines +=
QLine(slider->rect.left() + extra,
pos,
2824 slider->rect.left() + tickSize,
pos);
2827 lines +=
QLine(slider->rect.right() - extra,
pos,
2828 slider->rect.right() - tickSize,
pos);
2832 int nextInterval =
v + interval;
2833 if (nextInterval <
v)
2841 if ((
option->subControls & SC_SliderHandle) ) {
2852 QLinearGradient gradient = qt_fusion_gradient(gradRect,
d->buttonColor(
option->palette),horizontal ? TopDown : FromLeft);
2855 handlePainter.translate(0.5, 0.5);
2858 handlePainter.setBrush(
QColor(0, 0, 0, 40));
2859 handlePainter.drawRect(horizontal ?
r.adjusted(-1, 2, 1, -2) :
r.adjusted(2, -1, -2, 1));
2861 handlePainter.setPen(
QPen(
d->outline(
option->palette)));
2862 if (
option->state & State_HasFocus &&
option->state & State_KeyboardFocusChange)
2863 handlePainter.setPen(
QPen(
d->highlightedOutline(
option->palette)));
2865 handlePainter.setBrush(gradient);
2866 handlePainter.drawRoundedRect(
r, 2, 2);
2868 handlePainter.setPen(
d->innerContrastLine());
2869 handlePainter.drawRoundedRect(
r.adjusted(1, 1, -1, -1), 2, 2);
2875 handlePainter.setPen(shadowAlpha);
2876 handlePainter.drawLine(
QPoint(
r.left() + 2,
r.bottom() + 1),
QPoint(
r.right() - 2,
r.bottom() + 1));
2877 handlePainter.drawLine(
QPoint(
r.right() + 1,
r.bottom() - 3),
QPoint(
r.right() + 1,
r.top() + 4));
2878 handlePainter.drawLine(
QPoint(
r.right() - 1,
r.bottom()),
QPoint(
r.right() + 1,
r.bottom() - 2));
2880 handlePainter.end();
2894 if (
const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(
option))
2895 QStyleHelper::drawDial(dial,
painter);
2911 case PM_SliderTickmarkOffset:
2914 case PM_HeaderMargin:
2915 case PM_ToolTipLabelFrameWidth:
2918 case PM_ButtonDefaultIndicator:
2919 case PM_ButtonShiftHorizontal:
2920 case PM_ButtonShiftVertical:
2923 case PM_MessageBoxIconSize:
2926 case PM_ListViewIconSize:
2929 case PM_ScrollBarSliderMin:
2932 case PM_TitleBarHeight:
2935 case PM_ScrollBarExtent:
2938 case PM_SliderThickness:
2939 case PM_SliderLength:
2942 case PM_DockWidgetTitleMargin:
2945 case PM_SpinBoxFrameWidth:
2948 case PM_MenuVMargin:
2949 case PM_MenuHMargin:
2950 case PM_MenuPanelWidth:
2953 case PM_MenuBarItemSpacing:
2956 case PM_MenuBarVMargin:
2957 case PM_MenuBarHMargin:
2958 case PM_MenuBarPanelWidth:
2961 case PM_ToolBarHandleExtent:
2964 case PM_ToolBarItemSpacing:
2967 case PM_ToolBarFrameWidth:
2968 case PM_ToolBarItemMargin:
2971 case PM_SmallIconSize:
2972 case PM_ButtonIconSize:
2975 case PM_DockWidgetTitleBarButtonMargin:
2978 case PM_TitleBarButtonSize:
2981 case PM_MaximumDragDistance:
2983 case PM_TabCloseIndicatorWidth:
2984 case PM_TabCloseIndicatorHeight:
2987 case PM_TabBarTabVSpace:
2990 case PM_TabBarTabOverlap:
2993 case PM_TabBarBaseOverlap:
2996 case PM_SubMenuOverlap:
2999 case PM_DockWidgetHandleExtent:
3000 case PM_SplitterWidth:
3003 case PM_IndicatorHeight:
3004 case PM_IndicatorWidth:
3005 case PM_ExclusiveIndicatorHeight:
3006 case PM_ExclusiveIndicatorWidth:
3009 case PM_ScrollView_ScrollBarSpacing:
3012 case PM_ScrollView_ScrollBarOverlap:
3017 case PM_DefaultFrameWidth:
3038 newSize -=
QSize(0, 2);
3043 int topMargin =
qMax(pixelMetric(PM_IndicatorHeight,
option,
widget),
option->fontMetrics.height()) + groupBoxTopMargin;
3044 newSize +=
QSize(10, topMargin);
3047 case CT_RadioButton:
3049 newSize +=
QSize(0, 1);
3052 newSize +=
QSize(2, 2);
3055 newSize +=
QSize(0, -3);
3058 newSize +=
QSize(2, 4);
3061 newSize +=
QSize(0, 4);
3063 case CT_MenuBarItem:
3064 newSize +=
QSize(8, 5);
3068 int w =
size.width();
3069 if (menuItem->text.contains(u
'\t'))
3070 w += menuItem->reservedShortcutWidth;
3075 QFont fontBold = menuItem->font;
3078 w += fmBold.horizontalAdvance(menuItem->text) - fm.horizontalAdvance(menuItem->text);
3082 const int checkcol = qMax<int>(menuItem->maxIconWidth,
3088 if (!menuItem->text.isEmpty()) {
3089 newSize.
setHeight(menuItem->fontMetrics.height());
3092 else if (!menuItem->icon.isNull()) {
3093#if QT_CONFIG(combobox)
3094 if (
const QComboBox *combo = qobject_cast<const QComboBox*>(
widget)) {
3104 newSize +=
QSize(4, 4);
3106 case CT_MdiControls:
3107 newSize -=
QSize(1, 0);
3131 || qobject_cast<QAbstractButton*>(
widget)
3134 || qobject_cast<QComboBox *>(
widget)
3137 || qobject_cast<QProgressBar *>(
widget)
3140 || qobject_cast<QScrollBar *>(
widget)
3143 || qobject_cast<QSplitterHandle *>(
widget)
3146 || qobject_cast<QAbstractSlider *>(
widget)
3149 || qobject_cast<QAbstractSpinBox *>(
widget)
3162void QFusionStyle::polish(
QPalette &pal)
3175 || qobject_cast<QAbstractButton*>(
widget)
3178 || qobject_cast<QComboBox *>(
widget)
3181 || qobject_cast<QProgressBar *>(
widget)
3184 || qobject_cast<QScrollBar *>(
widget)
3187 || qobject_cast<QSplitterHandle *>(
widget)
3190 || qobject_cast<QAbstractSlider *>(
widget)
3193 || qobject_cast<QAbstractSpinBox *>(
widget)
3219#if QT_CONFIG(slider)
3221 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(
option)) {
3223 switch (subControl) {
3224 case SC_SliderHandle: {
3229 int centerY = slider->rect.center().y() -
rect.height() / 2;
3232 centerY += tickSize;
3234 centerY -= tickSize - 1;
3236 rect.moveTop(centerY);
3240 int centerX = slider->rect.center().x() -
rect.width() / 2;
3243 centerX += tickSize;
3245 centerX -= tickSize - 1;
3247 rect.moveLeft(centerX);
3251 case SC_SliderGroove: {
3252 QPoint grooveCenter = slider->rect.center();
3256 rect.setHeight(grooveThickness);
3259 grooveCenter.ry() += tickSize;
3261 grooveCenter.ry() -= tickSize - 1;
3264 rect.setWidth(grooveThickness);
3267 grooveCenter.rx() += tickSize;
3269 grooveCenter.rx() -= tickSize - 1;
3272 rect.moveCenter(grooveCenter);
3281#if QT_CONFIG(spinbox)
3283 if (
const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(
option)) {
3284 int center = spinbox->rect.height() / 2;
3285 int fw = spinbox->frame ? 3 : 0;
3289 x = spinbox->rect.width() -
y - buttonWidth + 2;
3292 switch (subControl) {
3296 rect =
QRect(
x, fw, buttonWidth, center - fw);
3298 case SC_SpinBoxDown:
3302 rect =
QRect(
x, center, buttonWidth, spinbox->rect.bottom() - center - fw + 1);
3304 case SC_SpinBoxEditField:
3306 rect =
QRect(lx, fw, spinbox->rect.width() - 2*fw, spinbox->rect.height() - 2*fw);
3308 rect =
QRect(lx, fw,
rx -
qMax(fw - 1, 0), spinbox->rect.height() - 2*fw);
3311 case SC_SpinBoxFrame:
3312 rect = spinbox->rect;
3323 const int groupBoxTextAlignment =
groupBox->textAlignment;
3327 if (subControl == SC_GroupBoxFrame)
3329 else if (subControl == SC_GroupBoxContents) {
3332 int leftMarginExtension = 0;
3333 const int indicatorHeight =
option->subControls.testFlag(SC_GroupBoxCheckBox) ?
3335 const int topMargin =
qMax(indicatorHeight, fontMetricsHeight) +
3337 return frameRect.
adjusted(leftMarginExtension + margin, margin + topMargin, -margin, -margin - groupBoxBottomMargin);
3344 const int width = textSize.width()
3356 - (hasVerticalAlignment ?
proxy()->pixelMetric(PM_LayoutRightMargin,
groupBox,
widget) : 0));
3359 if (hasVerticalAlignment)
3365 if (subControl == SC_GroupBoxCheckBox) {
3366 rect.setWidth(indicatorWidth);
3367 rect.setHeight(indicatorHeight);
3368 rect.moveTop(textSize.height() > indicatorHeight ? (textSize.height() - indicatorHeight) / 2 : 0);
3369 rect.translate(1, 0);
3370 }
else if (subControl == SC_GroupBoxLabel) {
3371 rect.setSize(textSize);
3374 rect.translate(indicatorWidth + 5, 0);
3382 switch (subControl) {
3383 case SC_ComboBoxArrow: {
3391 case SC_ComboBoxEditField: {
3394 rect.setRect(
option->rect.left() + frameWidth,
option->rect.top() + frameWidth,
3396 option->rect.height() - 2 * frameWidth);
3398 if (!
box->editable) {
3399 rect.adjust(2, 0, 0, 0);
3400 if (
box->state & (State_Sunken | State_On))
3401 rect.translate(1, 1);
3413 SubControl sc = subControl;
3415 const int indent = 3;
3416 const int controlTopMargin = 3;
3417 const int controlBottomMargin = 3;
3418 const int controlWidthMargin = 2;
3419 const int controlHeight = tb->rect.
height() - controlTopMargin - controlBottomMargin ;
3420 const int delta = controlHeight + controlWidthMargin;
3427 case SC_TitleBarLabel:
3431 ret.adjust(delta, 0, -delta, 0);
3433 ret.adjust(0, 0, -delta, 0);
3435 ret.adjust(0, 0, -delta, 0);
3437 ret.adjust(0, 0, -delta, 0);
3439 ret.adjust(0, 0, -delta, 0);
3442 case SC_TitleBarContextHelpButton:
3446 case SC_TitleBarMinButton:
3449 else if (sc == SC_TitleBarMinButton)
3452 case SC_TitleBarNormalButton:
3457 else if (sc == SC_TitleBarNormalButton)
3460 case SC_TitleBarMaxButton:
3463 else if (sc == SC_TitleBarMaxButton)
3466 case SC_TitleBarShadeButton:
3469 else if (sc == SC_TitleBarShadeButton)
3472 case SC_TitleBarUnshadeButton:
3475 else if (sc == SC_TitleBarUnshadeButton)
3478 case SC_TitleBarCloseButton:
3481 else if (sc == SC_TitleBarCloseButton)
3483 ret.setRect(tb->rect.right() - indent -
offset, tb->rect.top() + controlTopMargin,
3484 controlHeight, controlHeight);
3486 case SC_TitleBarSysMenu:
3488 ret.setRect(tb->rect.left() + controlWidthMargin + indent, tb->rect.top() + controlTopMargin,
3489 controlHeight, controlHeight);
3548 case SH_Slider_SnapToValue:
3549 case SH_PrintDialog_RightAlignButtons:
3550 case SH_FontDialog_SelectAssociatedText:
3551 case SH_MenuBar_AltKeyNavigation:
3552 case SH_ComboBox_ListMouseTracking:
3553 case SH_Slider_StopMouseOverSlider:
3554 case SH_ScrollBar_MiddleClickAbsolutePosition:
3555 case SH_EtchDisabledText:
3556 case SH_TitleBar_AutoRaise:
3557 case SH_TitleBar_NoBorder:
3558 case SH_ItemView_ShowDecorationSelected:
3559 case SH_ItemView_ArrowKeysNavigateIntoChildren:
3560 case SH_ItemView_ChangeHighlightOnFocus:
3561 case SH_MenuBar_MouseTracking:
3562 case SH_Menu_MouseTracking:
3563 case SH_Menu_SupportsSections:
3566#if defined(QT_PLATFORM_UIKIT)
3567 case SH_ComboBox_UseNativePopup:
3571 case SH_ToolBox_SelectedPageTitleBold:
3572 case SH_ScrollView_FrameOnlyAroundContents:
3573 case SH_Menu_AllowActiveAndDisabled:
3574 case SH_MainWindow_SpaceBelowMenuBar:
3575 case SH_MessageBox_CenterButtons:
3576 case SH_RubberBand_Mask:
3579 case SH_ComboBox_Popup:
3581 return !cmb->editable;
3584 case SH_Table_GridLineColor:
3585 return option ?
option->palette.window().color().darker(120).rgba() : 0;
3587 case SH_MessageBox_TextInteractionFlags:
3589#if QT_CONFIG(wizard)
3590 case SH_WizardStyle:
3593 case SH_Menu_SubMenuPopupDelay:
3596 case SH_WindowFrame_Mask:
3613 case SH_GroupBox_TextLabelVerticalAlignment: {
3614 if (
const auto *
groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(
option)) {
3634 case SE_ProgressBarLabel:
3635 case SE_ProgressBarContents:
3636 case SE_ProgressBarGroove:
3638 case SE_PushButtonFocusRect:
3641 case SE_DockWidgetTitleBarText: {
3643 bool verticalTitleBar = titlebar->verticalTitleBar;
3644 if (verticalTitleBar) {
3645 r.adjust(0, 0, 0, -4);
3648 r.adjust(4, 0, 0, 0);
3650 r.adjust(0, 0, -4, 0);
3665QIcon QFusionStyle::iconFromTheme(StandardPixmap standardIcon)
const
3668#if QT_CONFIG(imageformat_png)
3671 const auto fullPrefix =
QStringLiteral(
":/qt-project.org/styles/fusionstyle/images/") + prefix;
3672 static constexpr auto dockTitleIconSizes = {10, 16, 20, 32, 48, 64};
3673 for (
int size : dockTitleIconSizes)
3677 switch (standardIcon) {
3678 case SP_TitleBarNormalButton:
3679 addIconFiles(u
"fusion_normalizedockup-",
icon);
3681 case SP_TitleBarMinButton:
3682 addIconFiles(u
"fusion_titlebar-min-",
icon);
3684 case SP_TitleBarCloseButton:
3685 case SP_DockWidgetCloseButton:
3686 addIconFiles(u
"fusion_closedock-",
icon);
3703 const auto icon = iconFromTheme(standardIcon);
3719 const auto icon = iconFromTheme(standardPixmap);
3727#include "moc_qfusionstyle_p.cpp"
void setCurrentTime(int msecs)
Qt::Orientation orientation
the orientation of the slider
int sliderPosition
the current slider position
int minimum
the sliders's minimum value
int maximum
the slider's maximum value
bool frame
whether the spin box draws itself with a frame
ButtonSymbols buttonSymbols
the current button symbol mode
virtual StepEnabled stepEnabled() const
Virtual function that determines whether stepping up and down is legal at any given time.
The QApplication class manages the GUI application's control flow and main settings.
const QGradient * gradient() const
Returns the gradient describing this brush.
const QColor & color() const
Returns the brush color.
The QColor class provides colors based on RGB, HSV or CMYK values.
int saturation() const noexcept
Returns the HSV saturation color component of this color.
QColor darker(int f=200) const noexcept
QRgb rgb() const noexcept
Returns the RGB value of the color.
void setGreen(int green)
Sets the green color component of this color to green.
QRgb rgba() const noexcept
Returns the RGB value of the color, including its alpha.
void setBlue(int blue)
Sets the blue color component of this color to blue.
int red() const noexcept
Returns the red color component of this color.
int hue() const noexcept
Returns the HSV hue color component of this color.
int blue() const noexcept
Returns the blue color component of this color.
int green() const noexcept
Returns the green color component of this color.
void setAlpha(int alpha)
Sets the alpha of this color to alpha.
void setHsv(int h, int s, int v, int a=255)
Sets a HSV color value; h is the hue, s is the saturation, v is the value and a is the alpha componen...
int value() const noexcept
Returns the value color component of this color.
QColor lighter(int f=150) const noexcept
QString name(NameFormat format=HexRgb) const
void setRed(int red)
Sets the red color component of this color to red.
The QComboBox widget combines a button with a dropdown list.
The QCommonStyle class encapsulates the common Look and Feel of a GUI.
int pixelMetric(PixelMetric m, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr) const override
\reimp
QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *widget=nullptr) const override
\reimp
QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget=nullptr) const override
\reimp
void unpolish(QWidget *widget) override
\reimp
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr) const override
QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr) const override
\reimp
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=nullptr) const override
\reimp
SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *w=nullptr) const override
\reimp
int styleHint(StyleHint sh, const QStyleOption *opt=nullptr, const QWidget *w=nullptr, QStyleHintReturn *shret=nullptr) const override
\reimp
QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const override
\reimp
void polish(QPalette &) override
\reimp
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *w=nullptr) const override
\reimp
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *w=nullptr) const override
\reimp
void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=nullptr) const override
\reimp
qreal pointSizeF() const
Returns the point size of the matched window system font.
\reentrant \inmodule QtGui
int height() const
Returns the height of the font.
QString elidedText(const QString &text, Qt::TextElideMode mode, int width, int flags=0) const
void setBold(bool)
If enable is true sets the font's weight to \l{Weight}{QFont::Bold}; otherwise sets the weight to \l{...
void setPointSizeF(qreal)
Sets the point size to pointSize.
int midLineWidth
the width of the mid-line
int lineWidth
the line width
void setStops(const QGradientStops &stops)
Replaces the current set of stop points with the given stopPoints.
void setColorAt(qreal pos, const QColor &color)
Creates a stop point at the given position with the given color.
QGradientStops stops() const
Returns the stop points for this gradient.
The QIcon class provides scalable icons in different modes and states.
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
Mode
This enum type describes the mode for which a pixmap is intended to be used.
QList< QSize > availableSizes(Mode mode=Normal, State state=Off) const
QPixmap pixmap(const QSize &size, Mode mode=Normal, State state=Off) const
Returns a pixmap with the requested size, mode, and state, generating one if necessary.
\inmodule QtCore\compares equality \compareswith equality QLine \endcompareswith
\inmodule QtCore\compares equality \compareswith equality QLineF \endcompareswith
void setFinalStop(const QPointF &stop)
void setStart(const QPointF &start)
bool isEmpty() const noexcept
qreal currentValue() const
QVariant property(const char *name) const
Returns the value of the object's name property.
bool setProperty(const char *name, const QVariant &value)
Sets the value of the object's name property to value.
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...
qreal devicePixelRatio() const
void addEllipse(const QRectF &rect)
Creates an ellipse within the specified boundingRectangle and adds it to the painter path as a closed...
The QPainter class performs low-level painting on widgets and other paint devices.
void drawPoint(const QPointF &pt)
Draws a single point at the given position using the current pen's color.
const QPen & pen() const
Returns the painter's current pen.
void drawRect(const QRectF &rect)
Draws the current rectangle with the current pen and brush.
void drawPath(const QPainterPath &path)
Draws the given painter path using the current pen for outline and the current brush for filling.
QPaintDevice * device() const
Returns the paint device on which this painter is currently painting, or \nullptr if the painter is n...
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 setPen(const QColor &color)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void drawLine(const QLineF &line)
Draws a line defined by line.
void restore()
Restores the current painter state (pops a saved state off the stack).
void rotate(qreal a)
Rotates the coordinate system clockwise.
const QBrush & brush() const
Returns the painter's current brush.
void setOpacity(qreal opacity)
QFontMetrics fontMetrics() const
Returns the font metrics for the painter if the painter is active.
void drawLines(const QLineF *lines, int lineCount)
Draws the first lineCount lines in the array lines using the current pen.
void save()
Saves the current painter state (pushes the state onto a stack).
void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags=Qt::AutoColor)
Draws the rectangular portion source of the given image into the target rectangle in the paint device...
void setFont(const QFont &f)
Sets the painter's font to the given font.
void drawText(const QPointF &p, const QString &s)
Draws the given text with the currently defined text direction, beginning at the given position.
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.
void drawEllipse(const QRectF &r)
Draws the ellipse defined by the given rectangle.
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
void drawPoints(const QPointF *points, int pointCount)
Draws the first pointCount points in the array points using the current pen's color.
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
void setRenderHint(RenderHint hint, bool on=true)
Sets the given render hint on the painter if on is true; otherwise clears the render hint.
void drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yRadius, Qt::SizeMode mode=Qt::AbsoluteSize)
void setClipRegion(const QRegion &, Qt::ClipOperation op=Qt::ReplaceClip)
Sets the clip region to the given region using the specified clip operation.
void setTransform(const QTransform &transform, bool combine=false)
The QPalette class contains color groups for each widget state.
const QBrush & windowText() const
Returns the window text (general foreground) brush of the current color group.
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
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.
static bool find(const QString &key, QPixmap *pixmap)
Looks for a cached pixmap associated with the given key in the cache.
static bool insert(const QString &key, const QPixmap &pixmap)
Inserts a copy of the pixmap pixmap associated with the key into the cache.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr qreal width() const noexcept
Returns the width of the rectangle.
constexpr void setWidth(qreal w) noexcept
Sets the width of the rectangle to the given finite width.
constexpr QRect toRect() const noexcept
Returns a QRect based on the values of this rectangle.
\inmodule QtCore\reentrant
constexpr void adjust(int x1, int y1, int x2, int y2) noexcept
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr bool isValid() const noexcept
Returns true if the rectangle is valid, otherwise returns false.
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr QRect adjusted(int x1, int y1, int x2, int y2) const noexcept
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr QPoint topRight() const noexcept
Returns the position of the rectangle's top-right corner.
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr QSize size() const noexcept
Returns the size of the rectangle.
constexpr QRect transposed() const noexcept
constexpr void translate(int dx, int dy) noexcept
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position.
constexpr int width() const noexcept
Returns the width of the rectangle.
QRect united(const QRect &other) const noexcept
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr QPoint center() const noexcept
Returns the center point of the rectangle.
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
The QRegion class specifies a clip region for a painter.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
constexpr void setWidth(int w) noexcept
Sets the width to the given width.
constexpr void setHeight(int h) noexcept
Sets the height to the given height.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString left(qsizetype n) const &
QString mid(qsizetype position, qsizetype n=-1) const &
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
The QStyleHintReturnMask class provides style hints that return a QRegion.
\variable QStyleOptionGraphicsItem::exposedRect
\variable QStyleOptionToolButton::features
\variable QStyleOptionMenuItem::menuItemType
\variable QStyleOption::palette
\variable QStyleOptionFocusRect::backgroundColor
\variable QStyleOptionFrame::features
\variable QStyleOptionButton::features
\variable QStyleOptionToolBox::selectedPosition
The QStyleOption class stores the parameters used by QStyle functions.
Qt::LayoutDirection direction
virtual QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const
Returns the area within the given rectangle in which to draw the specified pixmap according to the de...
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,...
static int sliderPositionFromValue(int min, int max, int val, int space, bool upsideDown=false)
Converts the given logicalValue to a pixel position.
SubControl
This enum describes the available sub controls.
int toInt(bool *ok=nullptr) const
Returns the variant as an int if the variant has userType() \l QMetaType::Int, \l QMetaType::Bool,...
uint toUInt(bool *ok=nullptr) const
Returns the variant as an unsigned int if the variant has userType() \l QMetaType::UInt,...
QRect toRect() const
Returns the variant as a QRect if the variant has userType() \l QMetaType::QRect; otherwise returns a...
QCache< int, Employee > cache
[0]
object setObjectName("A new object name")
drawPrimitive(PE_IndicatorCheckBox, &subopt, p, widget)
QStyleOptionButton subopt
[2]
const QStyleOptionButton * btn
[3]
void flip(QMatrix4x4 &matrix)
Q_WIDGETS_EXPORT qreal dpiScaled(qreal value, qreal dpi)
Q_WIDGETS_EXPORT qreal dpi(const QStyleOption *option)
QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size, qreal dpr)
QColor backgroundColor(const QPalette &pal, const QWidget *widget)
Combined button and popup list for selecting options.
QTextStream & center(QTextStream &stream)
Calls QTextStream::setFieldAlignment(QTextStream::AlignCenter) on stream and returns stream.
@ WindowContextHelpButtonHint
@ WindowMaximizeButtonHint
@ WindowMinimizeButtonHint
QRectF fillRect(QRect rect, int background)
static jboolean copy(JNIEnv *, jobject)
static QString header(const QString &name)
void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &c, int lineWidth, const QBrush *fill)
Q_WIDGETS_EXPORT void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargins &targetMargins, const QPixmap &pixmap, const QRect &sourceRect, const QMargins &sourceMargins, const QTileRules &rules=QTileRules(), QDrawBorderPixmap::DrawingHints hints=QDrawBorderPixmap::DrawingHints())
static void visualRect(QRectF *geom, Qt::LayoutDirection dir, const QRectF &contentsRect)
static QByteArray cacheKey(Args &&...args)
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
GLsizei const GLfloat * v
[13]
GLuint64 GLenum void * handle
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLfloat GLfloat GLfloat x1
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLenum GLuint GLintptr offset
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLsizei const GLint * box
GLfloat GLfloat GLfloat GLfloat h
GLfixed GLfixed GLint GLint GLfixed points
GLfixed GLfixed GLfixed y2
GLsizei const GLchar *const * path
GLfloat GLfloat GLfloat alpha
static QT_BEGIN_NAMESPACE qreal dpr(const QWindow *w)
static QRectF alignedRect(bool mirrored, Qt::Alignment alignment, const QSizeF &size, const QRectF &rectangle)
constexpr int qGray(int r, int g, int b)
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
#define QStringLiteral(str)
QPixmap styleCachePixmap(const QSize &size, qreal pixelRatio)
#define BEGIN_STYLE_PIXMAPCACHE(a)
#define END_STYLE_PIXMAPCACHE
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
#define QT_CONFIG(feature)
static const int windowsItemFrame
static const int windowsItemVMargin
QObject * styleObject(const QStyleOption *option)
QApplication app(argc, argv)
[0]
\inmodule QtCore \reentrant