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)
79static const char *
const fusion_dock_widget_close_xpm[] = {
102static const char *
const dock_widget_restore_xpm[] = {
125static const char *
const workspace_minimize[] = {
149static const char *
const qt_titlebar_context_help[] = {
166static QColor mergedColors(
const QColor &colorA,
const QColor &colorB,
int factor = 50)
168 const int maxFactor = 100;
170 tmp.
setRed((tmp.
red() * factor) / maxFactor + (colorB.
red() * (maxFactor - factor)) / maxFactor);
171 tmp.
setGreen((tmp.
green() * factor) / maxFactor + (colorB.
green() * (maxFactor - factor)) / maxFactor);
172 tmp.
setBlue((tmp.
blue() * factor) / maxFactor + (colorB.
blue() * (maxFactor - factor)) / maxFactor);
179 int x =
rect.center().x();
180 int y =
rect.center().y();
222 const int arrowMax =
qMin(arrowHeight, arrowWidth);
224 const int size =
qMin(arrowMax, rectMax);
234 QPainter cachePainter(&cachePixmap);
261 cachePainter.setBrush(
color);
263 cachePainter.drawPolygon(triangle.
data(),
int(triangle.
size()));
275 qMin(255, (
int)(
option->palette.button().color().saturation())),
276 qMin(255, (
int)(
option->palette.button().color().value()*0.7)));
281 QColor titleBarHighlight(255, 255, 255, 60);
288 QColor mdiButtonGradientStartColor;
289 QColor mdiButtonGradientStopColor;
291 mdiButtonGradientStartColor =
QColor(0, 0, 0, 40);
292 mdiButtonGradientStopColor =
QColor(255, 255, 255, 60);
295 titleBarHighlight = highlight.
darker(130);
298 gradient.
setColorAt(0, mdiButtonGradientStartColor);
299 gradient.
setColorAt(1, mdiButtonGradientStopColor);
300 QColor mdiButtonBorderColor(active ?
option->palette.highlight().color().darker(180): dark.darker(110));
303 const QLine lines[4] = {
335QFusionStylePrivate::QFusionStylePrivate()
356QFusionStyle::QFusionStyle() :
QCommonStyle(*new QFusionStylePrivate)
366QFusionStyle::QFusionStyle(QFusionStylePrivate &dd) :
QCommonStyle(dd)
373QFusionStyle::~QFusionStyle()
417void QFusionStyle::drawPrimitive(PrimitiveElement elem,
422 Q_D (
const QFusionStyle);
428 QColor highlightedOutline =
d->highlightedOutline(
option->palette);
434#if QT_CONFIG(groupbox)
436 case PE_FrameGroupBox:
438 QPixmap pixmap(
":/qt-project.org/styles/commonstyle/images/fusion_groupbox.png"_L1);
440 auto control = qobject_cast<const QGroupBox *>(
widget);
441 if (control && !control->isCheckable() && control->title().isEmpty()) {
443 topMargin = groupBoxTopMargin;
445 topMargin =
qMax(pixelMetric(PM_ExclusiveIndicatorHeight),
option->fontMetrics.height()) + groupBoxTopMargin;
452 case PE_IndicatorBranch: {
453 if (!(
option->state & State_Children))
455 if (
option->state & State_Open)
464 case PE_FrameTabBarBase:
465 if (
const QStyleOptionTabBarBase *tbb
466 = qstyleoption_cast<const QStyleOptionTabBarBase *>(
option)) {
469 switch (tbb->shape) {
472 region -= tbb->selectedTabRect;
480 painter->
drawLine(tbb->rect.left(), tbb->rect.top(), tbb->rect.left(), tbb->rect.bottom());
484 tbb->rect.right(), tbb->rect.bottom());
501 case PE_PanelScrollAreaCorner: {
503 QColor alphaOutline = outline;
510 case PE_IndicatorArrowUp:
511 case PE_IndicatorArrowDown:
512 case PE_IndicatorArrowRight:
513 case PE_IndicatorArrowLeft:
515 if (
option->rect.width() <= 1 ||
option->rect.height() <= 1)
517 QColor arrowColor =
option->palette.windowText().color();
521 case PE_IndicatorArrowDown:
524 case PE_IndicatorArrowRight:
527 case PE_IndicatorArrowLeft:
536 case PE_IndicatorItemViewItemCheck:
539 button.QStyleOption::operator=(*option);
540 button.state &= ~State_MouseOver;
544 case PE_IndicatorHeaderArrow:
547 QColor arrowColor =
header->palette.windowText().color();
551#if defined(Q_OS_LINUX)
566 case PE_IndicatorButtonDropDown:
570 case PE_IndicatorToolBarSeparator:
573 const int margin = 6;
574 if (
option->state & State_Horizontal) {
578 rect.bottomLeft().y() - margin,
580 rect.topLeft().y() + margin);
583 rect.bottomLeft().y() - margin,
585 rect.topLeft().y() + margin);
591 rect.topRight().x() - margin,
596 rect.topRight().x() - margin,
604 copy.state |= State_Raised;
610 thePen.setCosmetic(
false);
635 case PE_FrameDockWidget:
653 case PE_PanelButtonTool:
655 if ((
option->state & State_Enabled ||
option->state & State_On) || !(
option->state & State_AutoRaise)) {
657 if (
option->state & State_MouseOver)
665 case PE_IndicatorDockWidgetResizeHandle:
668 bool horizontal =
option->state & State_Horizontal;
669 dockWidgetHandle.
state.setFlag(State_Horizontal, !horizontal);
690 case PE_FrameLineEdit:
693 bool hasFocus =
option->state & State_HasFocus;
706 QColor softHighlight = highlightedOutline;
719 case PE_IndicatorCheckBox:
726 QColor pressedColor = mergedColors(
option->palette.base().color(),
option->palette.windowText().color(), 85);
738 if (
option->state & State_HasFocus &&
option->state & State_KeyboardFocusChange)
743 const qreal checkMarkPadding = 1 +
rect.width() * 0.13;
745 if (
checkbox->state & State_NoChange) {
754 painter->
drawRect(
rect.adjusted(checkMarkPadding, checkMarkPadding, -checkMarkPadding, -checkMarkPadding));
756 }
else if (
checkbox->state & State_On) {
759 penWidth = qMax<qreal>(penWidth, 0.13 *
rect.height());
760 penWidth = qMin<qreal>(penWidth, 0.20 *
rect.height());
761 QPen checkPen =
QPen(checkMarkColor, penWidth);
770 path.moveTo(checkMarkPadding + rectHeight * 0.11, rectHeight * 0.47);
771 path.lineTo(rectHeight * 0.5, rectHeight - checkMarkPadding);
772 path.lineTo(rectHeight - checkMarkPadding, checkMarkPadding);
778 case PE_IndicatorRadioButton:
781 QColor pressedColor = mergedColors(
option->palette.base().color(),
option->palette.windowText().color(), 85);
786 const qreal outlineRadius = (
rect.width() + (
rect.width() + 1) % 2) / 2.0 - 1;
787 circle.
addEllipse(circleCenter, outlineRadius, outlineRadius);
789 if (
option->state & State_HasFocus &&
option->state & State_KeyboardFocusChange)
793 if (
state & (State_On )) {
795 const qreal checkmarkRadius = outlineRadius / 2.32;
796 circle.
addEllipse(circleCenter, checkmarkRadius, checkmarkRadius);
807 case PE_IndicatorToolBarHandle:
810 if (
option->state & State_Horizontal) {
811 for (
int i = -3 ;
i < 2 ;
i += 3) {
812 for (
int j = -8 ;
j < 10 ;
j += 3) {
818 for (
int i = -6 ;
i < 12 ;
i += 3) {
819 for (
int j = -3 ;
j < 2 ;
j += 3) {
827 case PE_FrameDefaultButton:
829 case PE_FrameFocusRect:
832 if (!(fropt->state & State_KeyboardFocusChange))
839 QColor fillcolor = highlightedOutline;
851 case PE_PanelButtonCommand:
853 bool isDefault =
false;
855 bool isDown = (
option->state & State_Sunken) || (
option->state & State_On);
863 if (isFlat && !isDown) {
865 r =
option->rect.adjusted(0, 1, 0, -1);
867 const QLine lines[4] = {
879 QPoint(
r.right() - 1,
r.bottom() - 1),
881 QPoint(
r.left() + 1,
r.bottom() - 1),
891 bool hasFocus = (
option->state & State_HasFocus &&
option->state & State_KeyboardFocusChange);
894 QColor darkOutline = outline;
895 if (hasFocus | isDefault) {
896 darkOutline = highlightedOutline;
900 buttonColor = mergedColors(buttonColor, highlightedOutline.
lighter(130), 90);
903 r =
rect.adjusted(0, 1, -1, 0);
906 p->translate(0.5, -0.5);
908 QLinearGradient gradient = qt_fusion_gradient(
rect, (isEnabled &&
option->state & State_MouseOver ) ? buttonColor : buttonColor.darker(104));
910 p->setBrush(isDown ?
QBrush(buttonColor.
darker(110)) : gradient);
911 p->drawRoundedRect(
r, 2.0, 2.0);
916 p->drawRoundedRect(
r, 2.0, 2.0);
918 p->setPen(
d->innerContrastLine());
919 p->drawRoundedRect(
r.adjusted(1, 1, -1, -1), 2.0, 2.0);
924 case PE_FrameTabWidget:
927#if QT_CONFIG(tabwidget)
928 if (
const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(
option)) {
934 rect.adjust(0, 0, 0, -1);
936 alphaShadow.setAlpha(15);
954 case PE_FrameStatusBarItem:
977 Q_D (
const QFusionStyle);
980 QColor highlightedOutline =
d->highlightedOutline(
option->palette);
981 QColor shadow =
d->darkShade();
984 case CE_ComboBoxLabel:
986 QRect editRect =
proxy()->subControlRect(CC_ComboBox,
cb, SC_ComboBoxEditField,
widget);
989 if (!
cb->currentIcon.isNull()) {
993 QRect iconRect(editRect);
994 iconRect.setWidth(
cb->iconSize.width() + 4);
997 iconRect.size(), editRect);
1007 if (!
cb->currentText.isEmpty() && !
cb->editable) {
1009 visualAlignment(
cb->direction,
cb->textAlignment),
1010 cb->palette,
cb->state & State_Enabled,
cb->currentText,
1019 if (
option->rect.width() > 1 &&
option->rect.height() > 1) {
1021 if (
option->state & State_Horizontal) {
1022 for (
int j = -6 ;
j< 12 ;
j += 3) {
1027 for (
int i = -6;
i< 12 ;
i += 3) {
1035#if QT_CONFIG(rubberband)
1037 if (qstyleoption_cast<const QStyleOptionRubberBand *>(
option)) {
1045 qMin(highlight.
blue()/2 + 110, 255));
1048 gradient.
setColorAt(0, dimHighlight.lighter(120));
1055 if (
option->rect.width() > 2 &&
option->rect.height() > 2) {
1069 for (
int i = -6;
i< 12 ;
i += 3) {
1070 for (
int j = -6 ;
j< 12 ;
j += 3) {
1080#if QT_CONFIG(toolbar)
1082 if (
const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(
option)) {
1090 if (!(
option->state & State_Horizontal))
1097 QColor light =
d->lightShade();
1098 QColor shadow =
d->darkShade();
1102 if (toolBar->positionOfLine == QStyleOptionToolBar::End
1103 || toolBar->positionOfLine == QStyleOptionToolBar::OnlyOne) {
1121 if (toolBar->positionOfLine == QStyleOptionToolBar::End
1122 || toolBar->positionOfLine == QStyleOptionToolBar::Middle) {
1128 if (toolBar->positionOfLine == QStyleOptionToolBar::Beginning
1129 || toolBar->positionOfLine == QStyleOptionToolBar::OnlyOne) {
1142 if (toolBar->positionOfLine == QStyleOptionToolBar::End) {
1156 if (toolBar->positionOfLine == QStyleOptionToolBar::Middle
1157 || toolBar->positionOfLine == QStyleOptionToolBar::End) {
1163 if (toolBar->positionOfLine == QStyleOptionToolBar::End) {
1176 if (toolBar->positionOfLine == QStyleOptionToolBar::Middle
1177 || toolBar->positionOfLine == QStyleOptionToolBar::End) {
1182 if (toolBar->positionOfLine == QStyleOptionToolBar::End
1183 || toolBar->positionOfLine == QStyleOptionToolBar::OnlyOne) {
1202 case CE_DockWidgetTitle:
1205 bool verticalTitleBar = dwOpt->verticalTitleBar;
1208 if (verticalTitleBar) {
1213 r.top() + titleRect.
left() -
rect.left(),
1221 if (!dwOpt->title.isEmpty()) {
1228 dwOpt->state & State_Enabled, titleText,
1234 case CE_HeaderSection:
1255 gradientStopColor = gradientStartColor.
darker(130);
1256 gradientStartColor = gradientStartColor.
darker(130);
1258 QLinearGradient gradient(pixmapRect.topLeft(), pixmapRect.bottomLeft());
1260 if (
option->palette.window().gradient()) {
1263 QColor midColor1 = mergedColors(gradientStartColor, gradientStopColor, 60);
1264 QColor midColor2 = mergedColors(gradientStartColor, gradientStopColor, 40);
1268 gradient.
setColorAt(0.92, gradientStopColor);
1271 cachePainter.fillRect(pixmapRect, gradient);
1272 cachePainter.setPen(
d->innerContrastLine());
1274 cachePainter.drawLine(pixmapRect.topLeft(), pixmapRect.topRight());
1275 cachePainter.setPen(
d->outline(
option->palette));
1276 cachePainter.drawLine(pixmapRect.bottomLeft(), pixmapRect.bottomRight());
1281 cachePainter.setPen(
QColor(0, 0, 0, 40));
1282 cachePainter.drawLine(pixmapRect.topRight(), pixmapRect.bottomRight() +
QPoint(0, -1));
1283 cachePainter.setPen(
d->innerContrastLine());
1284 cachePainter.drawLine(pixmapRect.topRight() +
QPoint(-1, 0), pixmapRect.bottomRight() +
QPoint(-1, -1));
1286 cachePainter.setPen(
d->outline(
option->palette));
1287 cachePainter.drawLine(pixmapRect.topRight(), pixmapRect.bottomRight());
1296 case CE_ProgressBarGroove:
1318 case CE_ProgressBarContents:
1323 bool vertical =
false;
1324 bool inverted =
false;
1325 bool indeterminate = (bar->minimum == 0 && bar->maximum == 0);
1326 bool complete = bar->progress == bar->maximum;
1329 inverted = bar->invertedAppearance;
1341 int maxWidth =
rect.width();
1342 const auto progress =
qMax(bar->progress, bar->minimum);
1344 const auto progressSteps =
qint64(progress) - bar->minimum;
1345 const auto progressBarWidth = progressSteps * maxWidth / totalSteps;
1346 int width = indeterminate ? maxWidth : progressBarWidth;
1348 bool reverse = (!vertical && (bar->direction ==
Qt::RightToLeft)) || vertical;
1357 outline = highlightedoutline;
1359 if (!indeterminate) {
1361 innerShadow.setAlpha(35);
1382 if (indeterminate || bar->progress > bar->minimum) {
1386 QColor highlightedGradientStartColor = highlight.
lighter(120);
1387 QColor highlightedGradientStopColor = highlight;
1389 gradient.
setColorAt(0, highlightedGradientStartColor);
1390 gradient.
setColorAt(1, highlightedGradientStopColor);
1395 if (!complete && !indeterminate)
1398 indeterminate || complete || reverse ? 0 : 2, 0);
1406 if (!indeterminate) {
1407#if QT_CONFIG(animation)
1408 (
const_cast<QFusionStylePrivate*
>(
d))->stopAnimation(
option->styleObject);
1411 highlightedGradientStartColor.
setAlpha(120);
1414#if QT_CONFIG(animation)
1428 case CE_ProgressBarLabel:
1433 QColor alternateTextColor =
d->highlightedText(
option->palette);
1436 bool vertical =
false, inverted =
false;
1438 inverted = bar->invertedAppearance;
1442 const auto progressSteps =
qint64(bar->progress) - bar->minimum;
1443 const auto progressIndicatorPos = progressSteps *
rect.width() / totalSteps;
1444 if (progressIndicatorPos >= 0 && progressIndicatorPos <=
rect.width())
1457 if (!leftRect.
isNull()) {
1465 case CE_MenuBarItem:
1470 item.rect = mbi->rect.adjusted(0, 1, 0, -3);
1476 bool act = mbi->state & State_Selected && mbi->state & State_Sunken;
1477 bool dis = !(mbi->state & State_Enabled);
1490 if (!
proxy()->styleHint(SH_UnderlineShortcut, mbi,
widget))
1495 QColor shadow = mergedColors(
option->palette.window().color().darker(120),
1507 QColor highlightOutline = highlightedOutline;
1508 QColor highlight =
option->palette.highlight().color();
1512 if (!menuItem->text.isEmpty()) {
1514 proxy()->drawItemText(
painter, menuItem->rect.adjusted(margin, 0, -margin, 0),
1516 menuItem->palette, menuItem->state & State_Enabled, menuItem->text,
1518 w = menuItem->fontMetrics.horizontalAdvance(menuItem->text) + margin;
1522 qreal y = menuItem->rect.center().y() + 0.5f;
1528 const bool selected = menuItem->state & State_Selected && menuItem->state & State_Enabled;
1536 const bool checked = menuItem->checked;
1537 const bool sunken = menuItem->state & State_Sunken;
1538 const bool enabled = menuItem->state & State_Enabled;
1540 const int checkColHOffset = QFusionStylePrivate::menuItemHMargin +
windowsItemFrame - 1;
1542 int checkcol = qMax<int>(menuItem->rect.height() * 0.79,
1544 bool ignoreCheckMark =
false;
1547 qobject_cast<const QComboBox*>(
widget) ||
1549 (
option->styleObject &&
option->styleObject->property(
"_q_isComboBoxPopupItem").toBool()))
1550 ignoreCheckMark =
true;
1552 if (!ignoreCheckMark || menuItem->state & (State_On | State_Off)) {
1555 const qreal boxWidth = checkcol - 2 * boxMargin;
1557 option->rect.center().y() - boxWidth/2 + 1, boxWidth,
1560 checkRect =
visualRect(menuItem->direction, menuItem->rect, checkRect);
1564 if (menuItem->state & State_On || checked || sunken) {
1573 const int adjustment = checkRect.
height() * 0.3;
1578 if (menuItem->icon.isNull()) {
1580 box.QStyleOption::operator=(*option);
1581 box.rect = checkRect;
1582 if (checked || menuItem->state & State_On)
1583 box.state |= State_On;
1585 box.state |= State_Off;
1591 if (menuItem->icon.isNull())
1594 checkcol = menuItem->maxIconWidth;
1598 const bool dis = !(menuItem->state & State_Enabled);
1599 const bool act = menuItem->state & State_Selected;
1607 if (!menuItem->icon.isNull()) {
1615#if QT_CONFIG(combobox)
1625 pmr.moveCenter(vCheckRect.
center());
1627 if (!ignoreCheckMark && checkable && checked) {
1630 QColor activeColor = mergedColors(
option->palette.window().color(),
1631 option->palette.highlight().color());
1641 painter->
setPen(menuItem->palette.highlightedText().color());
1652 const int xm = checkColHOffset + checkcol + QFusionStylePrivate::menuItemHMargin;
1653 const int xpos = menuitem->
rect.
x() + xm;
1664 if (!
proxy()->styleHint(SH_UnderlineShortcut, menuitem,
widget))
1667 if (tabIndex >= 0) {
1671 const QString textToDraw =
s.
mid(tabIndex + 1).toString();
1674 p->drawText(vShortcutRect.
adjusted(1, 1, 1, 1), text_flags, textToDraw);
1677 p->drawText(vShortcutRect, text_flags, textToDraw);
1698 p->drawText(vTextRect.
adjusted(1, 1, 1, 1), text_flags, textToDraw);
1701 p->drawText(vTextRect, text_flags, textToDraw);
1707 const int dim = (menuItem->rect.height() - 4) / 2;
1708 PrimitiveElement arrow;
1710 const int xpos = menuItem->rect.left() + menuItem->rect.width() - 3 - dim;
1712 QRect(xpos, menuItem->rect.top() + menuItem->rect.height() / 2 - dim / 2, dim, dim));
1714 newMI.
rect = vSubMenuRect;
1724 case CE_MenuHMargin:
1725 case CE_MenuVMargin:
1727 case CE_MenuEmptyArea:
1737 case CE_MenuBarEmptyArea:
1741 QColor shadow = mergedColors(
option->palette.window().color().darker(120),
1748#if QT_CONFIG(tabbar)
1749 case CE_TabBarTabShape:
1751 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(
option)) {
1756 bool selected = tab->state & State_Selected;
1757 bool lastTab = ((!rtlHorTabs && tab->position == QStyleOptionTab::End)
1759 && tab->position == QStyleOptionTab::Beginning));
1760 bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab;
1761 int tabOverlap = pixelMetric(PM_TabBarTabOverlap,
option,
widget);
1762 rect =
option->rect.adjusted(0, 0, (onlyOne || lastTab) ? 0 : tabOverlap, 0);
1776 switch (tab->shape) {
1782 rotMatrix.
scale(-1, 1);
1786 rotMatrix.
rotate(180 + 90);
1787 rotMatrix.
scale(-1, 1);
1817 QColor tabFrameColor = tab->features & QStyleOptionTab::HasFrame ?
1818 d->tabFrameColor(
option->palette) :
1819 option->palette.window().color();
1825 fillGradient.setColorAt(0, tabFrameColor.
lighter(104));
1835 fillGradient.setColorAt(1, tabFrameColor);
1836 outlineGradient.setColorAt(1, outline);
1837 outlinePen =
QPen(outlineGradient, 1);
1839 fillGradient.setColorAt(0, tabFrameColor.
darker(108));
1840 fillGradient.setColorAt(0.85, tabFrameColor.
darker(108));
1841 fillGradient.setColorAt(1, tabFrameColor.
darker(116));
1844 QRect drawRect =
rect.adjusted(0, selected ? 0 : 2, 0, 3);
1876QPalette QFusionStyle::standardPalette ()
const
1888 Q_D (
const QFusionStyle);
1890#if QT_CONFIG(spinbox) || QT_CONFIG(slider)
1892 QColor gradientStopColor = buttonColor;
1894#if QT_CONFIG(slider)
1904 alphaCornerColor = mergedColors(
option->palette.window().color(), outline);
1917 frame.QStyleOption::operator=(*groupBox);
1936 if (
groupBox->state & State_HasFocus) {
1938 fropt.QStyleOption::operator=(*groupBox);
1945 if (
groupBox->subControls & SC_GroupBoxCheckBox) {
1947 box.QStyleOption::operator=(*groupBox);
1948 box.rect = checkBoxRect;
1954#if QT_CONFIG(spinbox)
1956 if (
const QStyleOptionSpinBox *
spinBox = qstyleoption_cast<const QStyleOptionSpinBox *>(
option)) {
1973 bool sunken = (
spinBox->state & State_Sunken);
1974 bool upIsActive = (
spinBox->activeSubControls == SC_SpinBoxUp);
1975 bool downIsActive = (
spinBox->activeSubControls == SC_SpinBoxDown);
1976 bool hasFocus = (
option->state & State_HasFocus);
1978 QStyleOptionSpinBox spinBoxCopy = *
spinBox;
1979 spinBoxCopy.
rect = pixmapRect;
1980 QRect upRect =
proxy()->subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxUp,
widget);
1981 QRect downRect =
proxy()->subControlRect(CC_SpinBox, &spinBoxCopy, SC_SpinBoxDown,
widget);
1984 cachePainter.save();
1986 cachePainter.translate(0.5, 0.5);
1990 cachePainter.setBrush(
option->palette.base());
1991 cachePainter.drawRoundedRect(
r.adjusted(0, 0, -1, -1), 2, 2);
1994 cachePainter.setPen(
d->topShadow());
1995 cachePainter.drawLine(
QPoint(
r.left() + 2,
r.top() + 1),
QPoint(
r.right() - 2,
r.top() + 1));
2001 const QLinearGradient gradient = qt_fusion_gradient(updownRect, (isEnabled &&
option->state & State_MouseOver )
2002 ? buttonColor : buttonColor.darker(104));
2005 cachePainter.setBrush(gradient);
2007 cachePainter.save();
2008 cachePainter.setClipRect(updownRect);
2009 cachePainter.drawRoundedRect(
r.adjusted(0, 0, -1, -1), 2, 2);
2010 cachePainter.setPen(
QPen(
d->innerContrastLine()));
2012 cachePainter.drawRoundedRect(
r.adjusted(1, 1, -2, -2), 2, 2);
2013 cachePainter.restore();
2018 cachePainter.fillRect(upRect.
adjusted(0, -1, 0, 0), gradientStopColor.
darker(110));
2020 cachePainter.fillRect(upRect.
adjusted(0, -1, 0, 0),
d->innerContrastLine());
2025 cachePainter.fillRect(downRect.
adjusted(0, 0, 0, 1), gradientStopColor.
darker(110));
2027 cachePainter.fillRect(downRect.
adjusted(0, 0, 0, 1),
d->innerContrastLine());
2030 cachePainter.setPen(hasFocus ?
d->highlightedOutline(
option->palette) : outline);
2032 cachePainter.drawRoundedRect(
r.adjusted(0, 0, -1, -1), 2, 2);
2034 QColor softHighlight =
option->palette.highlight().color();
2036 cachePainter.setPen(softHighlight);
2037 cachePainter.drawRoundedRect(
r.adjusted(1, 1, -2, -2), 1.7, 1.7);
2039 cachePainter.restore();
2045 cachePainter.setPen(outline);
2052 if (upIsActive && sunken) {
2053 cachePainter.setPen(gradientStopColor.
darker(130));
2054 cachePainter.drawLine(downRect.
left() + 1, downRect.
top(), downRect.
right(), downRect.
top());
2055 cachePainter.drawLine(upRect.
left() + 1, upRect.
top(), upRect.
left() + 1, upRect.
bottom());
2056 cachePainter.drawLine(upRect.
left() + 1, upRect.
top() - 1, upRect.
right(), upRect.
top() - 1);
2059 if (downIsActive && sunken) {
2060 cachePainter.setPen(gradientStopColor.
darker(130));
2061 cachePainter.drawLine(downRect.
left() + 1, downRect.
top(), downRect.
left() + 1, downRect.
bottom() + 1);
2062 cachePainter.drawLine(downRect.
left() + 1, downRect.
top(), downRect.
right(), downRect.
top());
2063 cachePainter.setPen(gradientStopColor.
darker(110));
2064 cachePainter.drawLine(downRect.
left() + 1, downRect.
bottom() + 1, downRect.
right(), downRect.
bottom() + 1);
2067 QColor disabledColor = mergedColors(arrowColor,
option->palette.button().color());
2069 int centerX = upRect.
center().
x();
2070 int centerY = upRect.
center().
y();
2074 cachePainter.drawLine(centerX - 1, centerY, centerX + 3, centerY);
2075 cachePainter.drawLine(centerX + 1, centerY - 2, centerX + 1, centerY + 2);
2077 centerX = downRect.
center().
x();
2078 centerY = downRect.
center().
y();
2080 cachePainter.drawLine(centerX - 1, centerY, centerX + 3, centerY);
2100 const int buttonMargin = 5;
2101 bool active = (titleBar->titleBarState & State_Active);
2102 QRect fullRect = titleBar->rect;
2104 QColor highlight =
option->palette.highlight().color();
2106 QColor titleBarFrameBorder(active ? highlight.
darker(180): outline.darker(110));
2108 QColor textColor(active ? 0xffffff : 0xff000000);
2109 QColor textAlphaColor(active ? 0xffffff : 0xff000000 );
2139 const QPoint points2[5] = {
2157 painter->
setPen(active? (titleBar->palette.text().color().lighter(120)) :
2168 QRect minButtonRect =
proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMinButton,
widget);
2169 if (minButtonRect.
isValid()) {
2170 bool hover = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_MouseOver);
2171 bool sunken = (titleBar->activeSubControls & SC_TitleBarMinButton) && (titleBar->state & State_Sunken);
2172 qt_fusion_draw_mdibutton(
painter, titleBar, minButtonRect, hover, sunken);
2173 QRect minButtonIconRect = minButtonRect.
adjusted(buttonMargin ,buttonMargin , -buttonMargin, -buttonMargin);
2176 minButtonIconRect.
center().
x() + 3, minButtonIconRect.
center().
y() + 3);
2178 minButtonIconRect.
center().
x() + 3, minButtonIconRect.
center().
y() + 4);
2181 minButtonIconRect.
center().
x() - 3, minButtonIconRect.
center().
y() + 4);
2183 minButtonIconRect.
center().
x() + 4, minButtonIconRect.
center().
y() + 4);
2189 QRect maxButtonRect =
proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarMaxButton,
widget);
2190 if (maxButtonRect.
isValid()) {
2191 bool hover = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_MouseOver);
2192 bool sunken = (titleBar->activeSubControls & SC_TitleBarMaxButton) && (titleBar->state & State_Sunken);
2193 qt_fusion_draw_mdibutton(
painter, titleBar, maxButtonRect, hover, sunken);
2195 QRect maxButtonIconRect = maxButtonRect.
adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin);
2200 maxButtonIconRect.
right() - 1, maxButtonIconRect.
top() + 1);
2214 QRect closeButtonRect =
proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarCloseButton,
widget);
2215 if (closeButtonRect.
isValid()) {
2216 bool hover = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_MouseOver);
2217 bool sunken = (titleBar->activeSubControls & SC_TitleBarCloseButton) && (titleBar->state & State_Sunken);
2218 qt_fusion_draw_mdibutton(
painter, titleBar, closeButtonRect, hover, sunken);
2219 QRect closeIconRect = closeButtonRect.
adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin);
2221 const QLine lines[4] = {
2223 closeIconRect.
right(), closeIconRect.
bottom() - 1),
2225 closeIconRect.
right() - 1, closeIconRect.
bottom()),
2227 closeIconRect.
left(), closeIconRect.
bottom() - 1),
2229 closeIconRect.
left() + 1, closeIconRect.
bottom())
2242 closeIconRect.
right() - 1, closeIconRect.
bottom() - 1);
2244 closeIconRect.
right() - 1, closeIconRect.
top() + 1);
2249 if ((titleBar->subControls & SC_TitleBarNormalButton) &&
2254 QRect normalButtonRect =
proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarNormalButton,
widget);
2255 if (normalButtonRect.
isValid()) {
2257 bool hover = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_MouseOver);
2258 bool sunken = (titleBar->activeSubControls & SC_TitleBarNormalButton) && (titleBar->state & State_Sunken);
2259 QRect normalButtonIconRect = normalButtonRect.
adjusted(buttonMargin, buttonMargin, -buttonMargin, -buttonMargin);
2260 qt_fusion_draw_mdibutton(
painter, titleBar, normalButtonRect, hover, sunken);
2262 QRect frontWindowRect = normalButtonIconRect.
adjusted(0, 3, -3, 0);
2266 frontWindowRect.
right() - 1, frontWindowRect.
top() + 1);
2276 QRect backWindowRect = normalButtonIconRect.
adjusted(3, 0, 0, -3);
2277 QRegion clipRegion = backWindowRect;
2278 clipRegion -= frontWindowRect;
2284 backWindowRect.
right() - 1, backWindowRect.
top() + 1);
2286 const QPoint points2[4] = {
2298 if (titleBar->subControls & SC_TitleBarContextHelpButton
2300 QRect contextHelpButtonRect =
proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarContextHelpButton,
widget);
2301 if (contextHelpButtonRect.
isValid()) {
2302 bool hover = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_MouseOver);
2303 bool sunken = (titleBar->activeSubControls & SC_TitleBarContextHelpButton) && (titleBar->state & State_Sunken);
2304 qt_fusion_draw_mdibutton(
painter, titleBar, contextHelpButtonRect, hover, sunken);
2305#if QT_CONFIG(imageformat_xpm)
2319 QRect shadeButtonRect =
proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarShadeButton,
widget);
2320 if (shadeButtonRect.
isValid()) {
2321 bool hover = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_MouseOver);
2322 bool sunken = (titleBar->activeSubControls & SC_TitleBarShadeButton) && (titleBar->state & State_Sunken);
2323 qt_fusion_draw_mdibutton(
painter, titleBar, shadeButtonRect, hover, sunken);
2330 QRect unshadeButtonRect =
proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarUnshadeButton,
widget);
2331 if (unshadeButtonRect.
isValid()) {
2332 bool hover = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_MouseOver);
2333 bool sunken = (titleBar->activeSubControls & SC_TitleBarUnshadeButton) && (titleBar->state & State_Sunken);
2334 qt_fusion_draw_mdibutton(
painter, titleBar, unshadeButtonRect, hover, sunken);
2340 QRect iconRect =
proxy()->subControlRect(CC_TitleBar, titleBar, SC_TitleBarSysMenu,
widget);
2342 if (!titleBar->icon.isNull()) {
2343 titleBar->icon.paint(
painter, iconRect);
2346 QPixmap pm =
proxy()->standardIcon(SP_TitleBarMenuButton, &tool,
widget).pixmap(16, 16);
2347 tool.
rect = iconRect;
2357#if QT_CONFIG(slider)
2360 if (
const QStyleOptionSlider *
scrollBar = qstyleoption_cast<const QStyleOptionSlider *>(
option)) {
2361 bool wasActive =
false;
2362 qreal expandScale = 1.0;
2363 qreal expandOffset = -1.0;
2366#if QT_CONFIG(animation)
2367 qreal opacity = 0.0;
2368 bool shouldExpand =
false;
2369 const qreal maxExpandScale = 13.0 / 9.0;
2376 QStyle::State oldState =
static_cast<QStyle::State
>(qvariant_cast<QStyle::State::Int>(
styleObject->
property(
"_q_stylestate")));
2381 bool transient = !
option->activeSubControls && !(
option->state & State_On);
2389 oldActiveControls !=
scrollBar->activeSubControls) {
2398#if QT_CONFIG(animation)
2407 d->startAnimation(anim);
2419#if QT_CONFIG(animation)
2424 if (oldActiveControls)
2431 shouldExpand = (
option->activeSubControls || wasActive);
2433 if (!anim && !oldActiveControls) {
2436 d->startAnimation(anim);
2439 expandScale = 1.0 + (maxExpandScale - 1.0) * anim->
currentValue();
2443 expandScale = maxExpandScale;
2453 bool sunken =
scrollBar->state & State_Sunken;
2461 QColor alphaOutline = outline;
2464 QColor arrowColor =
option->palette.windowText().color();
2468 const bool isDarkBg = bgColor.
red() < 128 && bgColor.
green() < 128 && bgColor.
blue() < 128;
2472 rect.setY(
rect.y() + 4.5 - expandOffset);
2473 scrollBarSlider.
setY(scrollBarSlider.
y() + 4.5 - expandOffset);
2474 scrollBarGroove.
setY(scrollBarGroove.
y() + 4.5 - expandOffset);
2476 rect.setHeight(
rect.height() * expandScale);
2479 rect.setX(
rect.x() + 4.5 - expandOffset);
2480 scrollBarSlider.
setX(scrollBarSlider.
x() + 4.5 - expandOffset);
2481 scrollBarGroove.
setX(scrollBarGroove.
x() + 4.5 - expandOffset);
2483 rect.setWidth(
rect.width() * expandScale);
2484 scrollBarGroove.
setWidth(scrollBarGroove.
width() * expandScale);
2489 if ((!transient ||
scrollBar->activeSubControls || wasActive) &&
scrollBar->subControls & SC_ScrollBarGroove) {
2495 if (!transient || !isDarkBg) {
2520 QColor subtleEdge = alphaOutline;
2529 QRect pixmapRect = scrollBarSlider;
2538 QColor midColor2 = mergedColors(gradientStartColor, gradientStopColor, 40);
2546 if (
scrollBar->subControls & SC_ScrollBarSlider) {
2548 QRect rect = scrollBarSlider.
adjusted(horizontal ? 1 : 2, horizontal ? 2 : 1, -1, -1);
2558 QRect pixmapRect = scrollBarSlider;
2560 if (
option->state & State_Sunken &&
scrollBar->activeSubControls & SC_ScrollBarSlider)
2562 else if (
option->state & State_MouseOver &&
scrollBar->activeSubControls & SC_ScrollBarSlider)
2567 painter->
drawRect(pixmapRect.
adjusted(horizontal ? -1 : 0, horizontal ? 0 : -1, horizontal ? 0 : 1, horizontal ? 1 : 0));
2585 if (!transient &&
scrollBar->subControls & SC_ScrollBarSubLine) {
2586 if ((
scrollBar->activeSubControls & SC_ScrollBarSubLine) && sunken)
2588 else if ((
scrollBar->activeSubControls & SC_ScrollBarSubLine))
2596 if (
option->state & State_Horizontal) {
2609 QRect upRect = scrollBarSubLine.
adjusted(horizontal ? 0 : 1, horizontal ? 1 : 0, horizontal ? -2 : -1, horizontal ? -1 : -2);
2616 if (
option->state & State_Horizontal)
2618 qt_fusion_draw_arrow(arrowType,
painter,
option, upRect, arrowColor);
2622 if (!transient &&
scrollBar->subControls & SC_ScrollBarAddLine) {
2623 if ((
scrollBar->activeSubControls & SC_ScrollBarAddLine) && sunken)
2625 else if ((
scrollBar->activeSubControls & SC_ScrollBarAddLine))
2633 if (
option->state & State_Horizontal) {
2642 pixmapRect.
setTop(scrollBarAddLine.
top());
2652 if (
option->state & State_Horizontal)
2654 qt_fusion_draw_arrow(arrowType,
painter,
option, downRect, arrowColor);
2664 bool hasFocus =
option->state & State_HasFocus &&
option->state & State_KeyboardFocusChange;
2665 bool sunken = comboBox->state & State_On;
2666 bool isEnabled = (comboBox->state & State_Enabled);
2670 pixmapName +=
"-sunken"_L1;
2671 if (comboBox->editable)
2672 pixmapName +=
"-editable"_L1;
2674 pixmapName +=
"-enabled"_L1;
2675 if (!comboBox->frame)
2676 pixmapName +=
"-frameless"_L1;
2682 QRect pixmapRect(0, 0, comboBox->rect.width(), comboBox->rect.height());
2684 comboBoxCopy.
rect = pixmapRect;
2687 QRect downArrowRect =
proxy()->subControlRect(CC_ComboBox, &comboBoxCopy,
2688 SC_ComboBoxArrow,
widget);
2690 if (comboBox->editable) {
2692 buttonOption.QStyleOption::operator=(*comboBox);
2694 buttonOption.
state = (comboBox->state & (State_Enabled | State_MouseOver | State_HasFocus))
2695 | State_KeyboardFocusChange;
2698 buttonOption.
state |= State_Sunken;
2699 buttonOption.
state &= ~State_MouseOver;
2702 if (comboBox->frame) {
2703 cachePainter.save();
2705 cachePainter.translate(0.5, 0.5);
2707 cachePainter.setBrush(buttonOption.
palette.
base());
2708 cachePainter.drawRoundedRect(
rect.adjusted(0, 0, -1, -1), 2, 2);
2709 cachePainter.restore();
2710 proxy()->drawPrimitive(PE_FrameLineEdit, &buttonOption, &cachePainter,
widget);
2714 cachePainter.save();
2715 cachePainter.setClipRect(downArrowRect.
adjusted(0, 0, 1, 0));
2717 downArrowRect.
left() - 6: downArrowRect.
right() + 6);
2718 proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter,
widget);
2719 cachePainter.restore();
2720 cachePainter.setPen(
QPen(hasFocus ?
option->palette.highlight() : outline.lighter(110), 1));
2725 cachePainter.drawLine(
QPoint(downArrowRect.
right() - 1, downArrowRect.
top() + borderSize ),
2728 cachePainter.drawLine(
QPoint(downArrowRect.
left() , downArrowRect.
top() + borderSize),
2733 cachePainter.drawLine(
QPoint(downArrowRect.
right(), downArrowRect.
top() + 2),
2737 cachePainter.drawLine(
QPoint(downArrowRect.
left(), downArrowRect.
top() + 2),
2743 buttonOption.QStyleOption::operator=(*comboBox);
2745 buttonOption.
state = comboBox->state & (State_Enabled | State_MouseOver | State_HasFocus | State_KeyboardFocusChange);
2747 buttonOption.
state |= State_Sunken;
2748 buttonOption.
state &= ~State_MouseOver;
2750 proxy()->drawPrimitive(PE_PanelButtonCommand, &buttonOption, &cachePainter,
widget);
2752 if (comboBox->subControls & SC_ComboBoxArrow) {
2754 QColor arrowColor =
option->palette.buttonText().color();
2765#if QT_CONFIG(slider)
2767 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(
option)) {
2780 if (
option->state & State_HasFocus &&
option->state & State_KeyboardFocusChange)
2781 outline =
d->highlightedOutline(
option->palette);
2784 if ((
option->subControls & SC_SliderGroove) && groove.
isValid()) {
2788 qMin(255, (
int)(buttonColor.
value()*0.9)));
2798 groovePainter.translate(0.5, 0.5);
2808 groovePainter.setPen(
QPen(outline));
2811 groovePainter.setBrush(gradient);
2812 groovePainter.drawRoundedRect(pixmapRect.
adjusted(1, 1, -2, -2), 1, 1);
2813 groovePainter.end();
2820 groovePixmapName +=
"_blue"_L1;
2837 outline = highlightedoutline;
2841 groovePainter.translate(0.5, 0.5);
2842 groovePainter.setPen(
QPen(outline));
2845 groovePainter.setBrush(gradient);
2846 groovePainter.drawRoundedRect(pixmapRect.
adjusted(1, 1, -2, -2), 1, 1);
2847 groovePainter.setPen(
d->innerContrastLine());
2849 groovePainter.drawRoundedRect(pixmapRect.
adjusted(2, 2, -3, -3), 1, 1);
2850 groovePainter.end();
2854 if (slider->upsideDown)
2859 if (slider->upsideDown)
2870 if (
option->subControls & SC_SliderTickmarks) {
2873 int available =
proxy()->pixelMetric(PM_SliderSpaceAvailable, slider,
widget);
2874 int interval = slider->tickInterval;
2875 if (interval <= 0) {
2876 interval = slider->singleStep;
2881 interval = slider->pageStep;
2886 int v = slider->minimum;
2888 while (v <= slider->maximum + 1) {
2889 if (
v == slider->maximum + 1 && interval == 1)
2891 const int v_ =
qMin(
v, slider->maximum);
2892 int pos = sliderPositionFromValue(slider->minimum, slider->maximum,
2894 ? slider->rect.width()
2896 slider->upsideDown) +
len / 2;
2897 int extra = 2 - ((v_ == slider->minimum || v_ == slider->maximum) ? 1 : 0);
2902 pos, slider->rect.top() + tickSize);
2906 pos, slider->rect.bottom() - tickSize);
2911 slider->rect.left() + tickSize,
pos);
2915 slider->rect.right() - tickSize,
pos);
2919 int nextInterval =
v + interval;
2920 if (nextInterval <
v)
2926 if ((
option->subControls & SC_SliderHandle) ) {
2937 QLinearGradient gradient = qt_fusion_gradient(gradRect,
d->buttonColor(
option->palette),horizontal ? TopDown : FromLeft);
2940 handlePainter.translate(0.5, 0.5);
2943 handlePainter.setBrush(
QColor(0, 0, 0, 40));
2944 handlePainter.drawRect(
r.adjusted(-1, 2, 1, -2));
2946 handlePainter.setPen(
QPen(
d->outline(
option->palette)));
2947 if (
option->state & State_HasFocus &&
option->state & State_KeyboardFocusChange)
2948 handlePainter.setPen(
QPen(
d->highlightedOutline(
option->palette)));
2950 handlePainter.setBrush(gradient);
2951 handlePainter.drawRoundedRect(
r, 2, 2);
2953 handlePainter.setPen(
d->innerContrastLine());
2954 handlePainter.drawRoundedRect(
r.adjusted(1, 1, -1, -1), 2, 2);
2960 handlePainter.setPen(shadowAlpha);
2961 handlePainter.drawLine(
QPoint(
r.left() + 2,
r.bottom() + 1),
QPoint(
r.right() - 2,
r.bottom() + 1));
2962 handlePainter.drawLine(
QPoint(
r.right() + 1,
r.bottom() - 3),
QPoint(
r.right() + 1,
r.top() + 4));
2963 handlePainter.drawLine(
QPoint(
r.right() - 1,
r.bottom()),
QPoint(
r.right() + 1,
r.bottom() - 2));
2965 handlePainter.end();
2979 if (
const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(
option))
2980 QStyleHelper::drawDial(dial,
painter);
2996 case PM_SliderTickmarkOffset:
2999 case PM_HeaderMargin:
3000 case PM_ToolTipLabelFrameWidth:
3003 case PM_ButtonDefaultIndicator:
3004 case PM_ButtonShiftHorizontal:
3005 case PM_ButtonShiftVertical:
3008 case PM_MessageBoxIconSize:
3011 case PM_ListViewIconSize:
3014 case PM_DialogButtonsSeparator:
3015 case PM_ScrollBarSliderMin:
3018 case PM_TitleBarHeight:
3021 case PM_ScrollBarExtent:
3024 case PM_SliderThickness:
3025 case PM_SliderLength:
3028 case PM_DockWidgetTitleMargin:
3031 case PM_SpinBoxFrameWidth:
3034 case PM_MenuVMargin:
3035 case PM_MenuHMargin:
3036 case PM_MenuPanelWidth:
3039 case PM_MenuBarItemSpacing:
3042 case PM_MenuBarVMargin:
3043 case PM_MenuBarHMargin:
3044 case PM_MenuBarPanelWidth:
3047 case PM_ToolBarHandleExtent:
3050 case PM_ToolBarItemSpacing:
3053 case PM_ToolBarFrameWidth:
3054 case PM_ToolBarItemMargin:
3057 case PM_SmallIconSize:
3058 case PM_ButtonIconSize:
3061 case PM_DockWidgetTitleBarButtonMargin:
3064 case PM_TitleBarButtonSize:
3067 case PM_MaximumDragDistance:
3069 case PM_TabCloseIndicatorWidth:
3070 case PM_TabCloseIndicatorHeight:
3073 case PM_TabBarTabVSpace:
3076 case PM_TabBarTabOverlap:
3079 case PM_TabBarBaseOverlap:
3082 case PM_SubMenuOverlap:
3085 case PM_DockWidgetHandleExtent:
3086 case PM_SplitterWidth:
3089 case PM_IndicatorHeight:
3090 case PM_IndicatorWidth:
3091 case PM_ExclusiveIndicatorHeight:
3092 case PM_ExclusiveIndicatorWidth:
3095 case PM_ScrollView_ScrollBarSpacing:
3098 case PM_ScrollView_ScrollBarOverlap:
3103 case PM_DefaultFrameWidth:
3124 newSize -=
QSize(0, 2);
3129 int topMargin =
qMax(pixelMetric(PM_ExclusiveIndicatorHeight),
option->fontMetrics.height()) + groupBoxTopMargin;
3130 newSize +=
QSize(10, topMargin);
3133 case CT_RadioButton:
3135 newSize +=
QSize(0, 1);
3138 newSize +=
QSize(2, 2);
3141 newSize +=
QSize(0, -3);
3144 newSize +=
QSize(2, 4);
3147 newSize +=
QSize(0, 4);
3149 case CT_MenuBarItem:
3150 newSize +=
QSize(8, 5);
3154 int w =
size.width();
3155 if (menuItem->text.contains(u
'\t'))
3156 w += menuItem->reservedShortcutWidth;
3161 QFont fontBold = menuItem->font;
3164 w += fmBold.horizontalAdvance(menuItem->text) - fm.horizontalAdvance(menuItem->text);
3168 const int checkcol = qMax<int>(menuItem->maxIconWidth,
3174 if (!menuItem->text.isEmpty()) {
3175 newSize.
setHeight(menuItem->fontMetrics.height());
3178 else if (!menuItem->icon.isNull()) {
3179#if QT_CONFIG(combobox)
3180 if (
const QComboBox *combo = qobject_cast<const QComboBox*>(
widget)) {
3190 newSize +=
QSize(4, 4);
3192 case CT_MdiControls:
3193 newSize -=
QSize(1, 0);
3217 || qobject_cast<QAbstractButton*>(
widget)
3220 || qobject_cast<QComboBox *>(
widget)
3223 || qobject_cast<QProgressBar *>(
widget)
3226 || qobject_cast<QScrollBar *>(
widget)
3229 || qobject_cast<QSplitterHandle *>(
widget)
3232 || qobject_cast<QAbstractSlider *>(
widget)
3235 || qobject_cast<QAbstractSpinBox *>(
widget)
3248void QFusionStyle::polish(
QPalette &pal)
3261 || qobject_cast<QAbstractButton*>(
widget)
3264 || qobject_cast<QComboBox *>(
widget)
3267 || qobject_cast<QProgressBar *>(
widget)
3270 || qobject_cast<QScrollBar *>(
widget)
3273 || qobject_cast<QSplitterHandle *>(
widget)
3276 || qobject_cast<QAbstractSlider *>(
widget)
3279 || qobject_cast<QAbstractSpinBox *>(
widget)
3305#if QT_CONFIG(slider)
3307 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(
option)) {
3309 switch (subControl) {
3310 case SC_SliderHandle: {
3314 int centerY = slider->rect.center().y() -
rect.height() / 2;
3316 centerY += tickSize;
3318 centerY -= tickSize;
3319 rect.moveTop(centerY);
3323 int centerX = slider->rect.center().x() -
rect.width() / 2;
3325 centerX += tickSize;
3327 centerX -= tickSize;
3328 rect.moveLeft(centerX);
3332 case SC_SliderGroove: {
3333 QPoint grooveCenter = slider->rect.center();
3336 rect.setHeight(grooveThickness);
3338 grooveCenter.
ry() += tickSize;
3340 grooveCenter.
ry() -= tickSize;
3342 rect.setWidth(grooveThickness);
3344 grooveCenter.
rx() += tickSize;
3346 grooveCenter.
rx() -= tickSize;
3348 rect.moveCenter(grooveCenter);
3357#if QT_CONFIG(spinbox)
3359 if (
const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(
option)) {
3360 int center = spinbox->rect.height() / 2;
3361 int fw = spinbox->frame ? 3 : 0;
3365 x = spinbox->rect.width() -
y - buttonWidth + 2;
3368 switch (subControl) {
3372 rect =
QRect(
x, fw, buttonWidth, center - fw);
3374 case SC_SpinBoxDown:
3378 rect =
QRect(
x, center, buttonWidth, spinbox->rect.bottom() - center - fw + 1);
3380 case SC_SpinBoxEditField:
3382 rect =
QRect(lx, fw, spinbox->rect.width() - 2*fw, spinbox->rect.height() - 2*fw);
3384 rect =
QRect(lx, fw,
rx -
qMax(fw - 1, 0), spinbox->rect.height() - 2*fw);
3387 case SC_SpinBoxFrame:
3388 rect = spinbox->rect;
3399 if (subControl == SC_GroupBoxFrame)
3400 return rect.adjusted(0, 0, 0, 0);
3401 else if (subControl == SC_GroupBoxContents) {
3404 int leftMarginExtension = 0;
3405 const int exclusiveIndicatorHeight =
option->subControls.testFlag(SC_GroupBoxCheckBox) ?
3406 pixelMetric(PM_ExclusiveIndicatorHeight) : 0;
3407 const int fontMetricsHeight =
groupBox->text.isEmpty() ? 0 :
3409 const int topMargin =
qMax(exclusiveIndicatorHeight, fontMetricsHeight) +
3411 return frameRect.
adjusted(leftMarginExtension + margin, margin + topMargin, -margin, -margin - groupBoxBottomMargin);
3434 if (subControl == SC_GroupBoxCheckBox) {
3435 rect.setWidth(indicatorWidth);
3436 rect.setHeight(indicatorHeight);
3437 rect.moveTop(textSize.
height() > indicatorHeight ? (textSize.
height() - indicatorHeight) / 2 : 0);
3438 rect.translate(1, 0);
3439 }
else if (subControl == SC_GroupBoxLabel) {
3440 rect.setSize(textSize);
3443 rect.translate(indicatorWidth + 5, 0);
3451 switch (subControl) {
3452 case SC_ComboBoxArrow: {
3460 case SC_ComboBoxEditField: {
3463 rect.setRect(
option->rect.left() + frameWidth,
option->rect.top() + frameWidth,
3465 option->rect.height() - 2 * frameWidth);
3467 if (!
box->editable) {
3468 rect.adjust(2, 0, 0, 0);
3469 if (
box->state & (State_Sunken | State_On))
3470 rect.translate(1, 1);
3482 SubControl sc = subControl;
3484 const int indent = 3;
3485 const int controlTopMargin = 3;
3486 const int controlBottomMargin = 3;
3487 const int controlWidthMargin = 2;
3488 const int controlHeight = tb->rect.height() - controlTopMargin - controlBottomMargin ;
3489 const int delta = controlHeight + controlWidthMargin;
3496 case SC_TitleBarLabel:
3500 ret.adjust(delta, 0, -delta, 0);
3502 ret.adjust(0, 0, -delta, 0);
3504 ret.adjust(0, 0, -delta, 0);
3506 ret.adjust(0, 0, -delta, 0);
3508 ret.adjust(0, 0, -delta, 0);
3511 case SC_TitleBarContextHelpButton:
3515 case SC_TitleBarMinButton:
3518 else if (sc == SC_TitleBarMinButton)
3521 case SC_TitleBarNormalButton:
3526 else if (sc == SC_TitleBarNormalButton)
3529 case SC_TitleBarMaxButton:
3532 else if (sc == SC_TitleBarMaxButton)
3535 case SC_TitleBarShadeButton:
3538 else if (sc == SC_TitleBarShadeButton)
3541 case SC_TitleBarUnshadeButton:
3544 else if (sc == SC_TitleBarUnshadeButton)
3547 case SC_TitleBarCloseButton:
3550 else if (sc == SC_TitleBarCloseButton)
3552 ret.setRect(tb->rect.right() - indent -
offset, tb->rect.top() + controlTopMargin,
3553 controlHeight, controlHeight);
3555 case SC_TitleBarSysMenu:
3557 ret.setRect(tb->rect.left() + controlWidthMargin + indent, tb->rect.top() + controlTopMargin,
3558 controlHeight, controlHeight);
3617 case SH_Slider_SnapToValue:
3618 case SH_PrintDialog_RightAlignButtons:
3619 case SH_FontDialog_SelectAssociatedText:
3620 case SH_MenuBar_AltKeyNavigation:
3621 case SH_ComboBox_ListMouseTracking:
3622 case SH_Slider_StopMouseOverSlider:
3623 case SH_ScrollBar_MiddleClickAbsolutePosition:
3624 case SH_EtchDisabledText:
3625 case SH_TitleBar_AutoRaise:
3626 case SH_TitleBar_NoBorder:
3627 case SH_ItemView_ShowDecorationSelected:
3628 case SH_ItemView_ArrowKeysNavigateIntoChildren:
3629 case SH_ItemView_ChangeHighlightOnFocus:
3630 case SH_MenuBar_MouseTracking:
3631 case SH_Menu_MouseTracking:
3632 case SH_Menu_SupportsSections:
3635#if defined(QT_PLATFORM_UIKIT)
3636 case SH_ComboBox_UseNativePopup:
3640 case SH_ToolBox_SelectedPageTitleBold:
3641 case SH_ScrollView_FrameOnlyAroundContents:
3642 case SH_Menu_AllowActiveAndDisabled:
3643 case SH_MainWindow_SpaceBelowMenuBar:
3644 case SH_MessageBox_CenterButtons:
3645 case SH_RubberBand_Mask:
3648 case SH_ComboBox_Popup:
3650 return !cmb->editable;
3653 case SH_Table_GridLineColor:
3654 return option ?
option->palette.window().color().darker(120).rgba() : 0;
3656 case SH_MessageBox_TextInteractionFlags:
3658#if QT_CONFIG(wizard)
3659 case SH_WizardStyle:
3662 case SH_Menu_SubMenuPopupDelay:
3665 case SH_WindowFrame_Mask:
3692 case SE_ProgressBarLabel:
3693 case SE_ProgressBarContents:
3694 case SE_ProgressBarGroove:
3696 case SE_PushButtonFocusRect:
3699 case SE_DockWidgetTitleBarText: {
3701 bool verticalTitleBar = titlebar->verticalTitleBar;
3702 if (verticalTitleBar) {
3703 r.adjust(0, 0, 0, -4);
3706 r.adjust(4, 0, 0, 0);
3708 r.adjust(0, 0, -4, 0);
3726#if QT_CONFIG(imageformat_xpm)
3727 switch (standardIcon) {
3728 case SP_TitleBarNormalButton:
3730 case SP_TitleBarMinButton:
3732 case SP_TitleBarCloseButton:
3733 case SP_DockWidgetCloseButton:
3748#ifndef QT_NO_IMAGEFORMAT_XPM
3749 switch (standardPixmap) {
3750 case SP_TitleBarNormalButton:
3751 return QPixmap(dock_widget_restore_xpm);
3752 case SP_TitleBarMinButton:
3753 return QPixmap(workspace_minimize);
3754 case SP_TitleBarCloseButton:
3755 case SP_DockWidgetCloseButton:
3756 return QPixmap(fusion_dock_widget_close_xpm);
3768#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 is a combined button and popup 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.
void setFinalStop(const QPointF &stop)
void setStart(const QPointF &start)
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 & text() const
Returns the text foreground brush of the current color group.
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.
const QBrush & light() const
Returns the light brush of the current color group.
void setBrush(ColorRole cr, const QBrush &brush)
Sets the brush for the given color role to the specified brush for all groups in the palette.
void 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...
const QBrush & base() const
Returns the base brush of the current color group.
const QBrush & highlightedText() const
Returns the highlighted text brush of the current color group.
qreal widthF() const
Returns the pen width with floating point precision.
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...
void fill(const QColor &fillColor=Qt::white)
Fills the pixmap with the given color.
\inmodule QtCore\reentrant
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
constexpr int & ry() noexcept
Returns a reference to the y coordinate of this point.
constexpr int & rx() noexcept
Returns a reference to the x coordinate of this point.
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
constexpr void moveTo(qreal x, qreal y) noexcept
Moves the rectangle, leaving the top-left corner at the given position (x, y).
constexpr qreal bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr qreal height() const noexcept
Returns the height of the rectangle.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
constexpr QPointF bottomLeft() const noexcept
Returns the position of the rectangle's bottom-left corner.
constexpr qreal left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr void setWidth(qreal w) noexcept
Sets the width of the rectangle to the given finite width.
constexpr QPointF topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr QPointF center() const noexcept
Returns the center point of the rectangle.
constexpr QPointF bottomRight() const noexcept
Returns the position of the rectangle's bottom-right corner.
constexpr QRect toRect() const noexcept
Returns a QRect based on the values of this rectangle.
constexpr qreal top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr void setHeight(qreal h) noexcept
Sets the height of the rectangle to the given finite height.
constexpr QPointF topRight() const noexcept
Returns the position of the rectangle's top-right corner.
constexpr QRectF transposed() const noexcept
constexpr qreal right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
\inmodule QtCore\reentrant
constexpr QPoint bottomLeft() const noexcept
Returns the position of the rectangle's bottom-left corner.
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 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...
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 bool isNull() const noexcept
Returns true if the rectangle is a null rectangle, otherwise returns false.
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr void setRight(int pos) noexcept
Sets the right edge of the rectangle to the given x coordinate.
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 void setBottom(int pos) noexcept
Sets the bottom edge of the rectangle to the given y coordinate.
constexpr void setLeft(int pos) noexcept
Sets the left edge of the rectangle to the given x coordinate.
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 void setWidth(int w) noexcept
Sets the width of the rectangle to the given width.
constexpr void setX(int x) noexcept
Sets the left edge of the rectangle to the given x coordinate.
constexpr QSize size() const noexcept
Returns the size of the rectangle.
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 QPoint bottomRight() const noexcept
Returns the position of the rectangle's bottom-right corner.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr void setHeight(int h) noexcept
Sets the height of the rectangle to the given height.
constexpr QPoint center() const noexcept
Returns the center point of the rectangle.
constexpr void setY(int y) noexcept
Sets the top edge of the rectangle to the given y coordinate.
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
constexpr void setTop(int pos) noexcept
Sets the top edge of the rectangle to the given y coordinate.
The QRegion class specifies a clip region for a painter.
QRegion subtracted(const QRegion &r) const
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 mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
QString left(qsizetype n) const
Returns a substring that contains the n leftmost characters of the string.
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.
constexpr size_type size() const noexcept
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]
Q_WIDGETS_EXPORT qreal dpiScaled(qreal value, qreal dpi)
QString uniqueName(const QString &key, const QStyleOption *option, const QSize &size)
Q_WIDGETS_EXPORT qreal dpi(const QStyleOption *option)
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
void flip(QMatrix4x4 &matrix)
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)
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 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)
#define BEGIN_STYLE_PIXMAPCACHE(a)
#define END_STYLE_PIXMAPCACHE
QPixmap styleCachePixmap(const QSize &size)
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]