8#if QT_CONFIG(itemviews)
12#include <private/qguiapplication_p.h>
13#include <qpa/qplatformtheme.h>
16#if QT_CONFIG(dockwidget)
20#if QT_CONFIG(dialogbuttonbox)
23#if QT_CONFIG(formlayout)
28#if QT_CONFIG(groupbox)
45#if QT_CONFIG(tabwidget)
51#if QT_CONFIG(toolbutton)
54#if QT_CONFIG(rubberband)
57#if QT_CONFIG(treeview)
60#include <private/qcommonstylepixmaps_p.h>
61#include <private/qmath_p.h>
67#if QT_CONFIG(filedialog)
72#if QT_CONFIG(settings)
77#if QT_CONFIG(animation)
78#include <private/qstyleanimation_p.h>
85#include <private/qtextengine_p.h>
86#include <private/qstylehelper_p.h>
191 QColor bg = fropt->backgroundColor;
192 QPen oldPen =
p->pen();
204 p->drawRect(focusRect.
adjusted(0, 0, -1, -1));
210 const int markH = markW;
220 for (
i = 0;
i < markW/2; ++
i) {
221 a <<
QLineF(xx, yy, xx, yy + 2);
226 for (;
i < markH; ++
i) {
227 a <<
QLineF(xx, yy, xx, yy + 2);
252#if QT_CONFIG(toolbar)
261 else if (
const QStyleOptionToolBar *
frame = qstyleoption_cast<const QStyleOptionToolBar *>(
opt)){
272#if QT_CONFIG(progressbar)
275 bool vertical =
false;
289 static const int decoration_size = 9;
297 int delta = decoration_size / 2;
302 p->drawLine(bef_h + 2, bef_v + 4, bef_h + 6, bef_v + 4);
304 p->drawLine(bef_h + 4, bef_v + 2, bef_h + 4, bef_v + 6);
305 QPen oldPen =
p->pen();
307 p->drawRect(bef_h, bef_v, decoration_size - 1, decoration_size - 1);
327 QPen oldPen =
p->pen();
356 if (
const QStyleOptionTabBarBase *tbb
357 = qstyleoption_cast<const QStyleOptionTabBarBase *>(
opt)) {
359 switch (tbb->shape) {
362 p->setPen(
QPen(tbb->palette.light(), 0));
363 p->drawLine(tbb->rect.topLeft(), tbb->rect.topRight());
367 p->setPen(
QPen(tbb->palette.light(), 0));
368 p->drawLine(tbb->rect.topLeft(), tbb->rect.bottomLeft());
372 p->setPen(
QPen(tbb->palette.shadow(), 0));
373 p->drawLine(tbb->rect.left(), tbb->rect.bottom(),
374 tbb->rect.right(), tbb->rect.bottom());
375 p->setPen(
QPen(tbb->palette.dark(), 0));
376 p->drawLine(tbb->rect.left(), tbb->rect.bottom() - 1,
377 tbb->rect.right() - 1, tbb->rect.bottom() - 1);
381 p->setPen(
QPen(tbb->palette.dark(), 0));
382 p->drawLine(tbb->rect.topRight(), tbb->rect.bottomRight());
389 if (
d->tabBarcloseButtonIcon.isNull())
416#if QT_CONFIG(groupbox)
433#if QT_CONFIG(dockwidget)
444#if QT_CONFIG(toolbar)
483#if QT_CONFIG(spinbox)
494 const qreal devicePixelRatio =
p->device()->devicePixelRatio();
496 const qreal inverseScale =
qreal(1) / devicePixelRatio;
497 p->scale(inverseScale, inverseScale);
502 p->translate(0.5, 0.5);
504 int len = std::min(
w,
h);
507 int step = (
len + 4) / 5;
510 const int step2 = step / 2;
516 p->translate(center);
532 const qreal devicePixelRatio =
p->device()->devicePixelRatio();
534 const qreal inverseScale =
qreal(1) / devicePixelRatio;
535 p->scale(inverseScale, inverseScale);
540 p->translate(0.5, 0.5);
550 int sx =
x +
w / 2 - sw / 2;
551 int sy =
y +
h / 2 - sh / 2;
562 p->translate(sx + bsx, sy + bsy);
582 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
584 const bool horizontal = tab->rect.height() > tab->rect.width();
585 const int margin = 4;
589 QRect rect = tab->rect.adjusted(rtl ? margin : 0, 0, rtl ? 1 : -margin, 0);
595 for (
int jags = 1; jags <=
count; ++jags, rtl = !rtl)
598 QRect rect = tab->rect.adjusted(0, 0, 0, -margin);
604 for (
int jags = 1; jags <=
count; ++jags, rtl = !rtl)
608 p->setPen(
QPen(tab->palette.dark(),
qreal(.8)));
609 p->setBrush(tab->palette.window());
615#if QT_CONFIG(lineedit)
621 if (
panel->lineWidth > 0)
626#if QT_CONFIG(columnview)
628 if (
const QStyleOptionViewItem *viewOpt = qstyleoption_cast<const QStyleOptionViewItem *>(
opt)) {
632 int x = viewOpt->rect.x() + 1;
633 int offset = (viewOpt->rect.height() / 3);
639 x = viewOpt->rect.x() + viewOpt->rect.width() - 1;
647 if (viewOpt->showDecorationSelected) {
682 p->drawLine(
rect.topLeft(),
rect.topRight());
686#if QT_CONFIG(itemviews)
688 if (
const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(
opt)) {
696 else if (vopt->features & QStyleOptionViewItem::Alternate)
701 if (
const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(
opt)) {
710 if (vopt->backgroundBrush.style() !=
Qt::NoBrush) {
712 p->setBrushOrigin(vopt->rect.topLeft());
713 p->fillRect(vopt->rect, vopt->backgroundBrush);
714 p->setBrushOrigin(oldBO);
745 qreal pixelRatio =
p->device()->devicePixelRatio();
778 QRect bounds =
a.boundingRect();
779 int sx = sqsize / 2 - bounds.
center().
x() - 1;
780 int sy = sqsize / 2 - bounds.
center().
y() - 1;
781 imagePainter.
translate(sx + bsx, sy + bsy);
798 pixmap.setDevicePixelRatio(pixelRatio);
801 int xOffset =
r.x() + (
r.width() -
size)/2;
802 int yOffset =
r.y() + (
r.height() -
size)/2;
803 p->drawPixmap(xOffset, yOffset,
pixmap);
811#if QT_CONFIG(toolbutton)
841 *lastVisibleLine = -1;
850 line.setLineWidth(lineWidth);
853 widthUsed =
qMax(widthUsed,
line.naturalTextWidth());
855 if (maxHeight > 0 && lastVisibleLine &&
height +
line.height() > maxHeight) {
857 *lastVisibleLine = nextLine.
isValid() ?
i : -1;
869 bool lastVisibleLineShouldBeElided,
QPointF *paintStartPosition)
const
877 const bool vAlignmentOptimization = paintStartPosition && valign.testFlag(
Qt::AlignVCenter);
879 int lastVisibleLine = -1;
887 if (paintStartPosition)
892 const int lineCount = textLayout.
lineCount();
893 for (
int i = 0;
i < lineCount; ++
i) {
899 if (paintStartPosition)
900 paintStartPosition->
ry() +=
line.height();
907 bool elideLastVisibleLine = lastVisibleLine ==
i;
908 if (!drawElided &&
i + 1 < lineCount && lastVisibleLineShouldBeElided) {
913 elideLastVisibleLine =
true;
917 if (drawElided || elideLastVisibleLine) {
918 if (elideLastVisibleLine) {
930 if (
i < lineCount - 1 &&
939 (lastVisibleLine >= 0 && lastVisibleLine ==
i))
945#if QT_CONFIG(itemviews)
947QSize QCommonStylePrivate::viewItemSize(
const QStyleOptionViewItem *
option,
int role)
const
952 if (
option->features & QStyleOptionViewItem::HasCheckIndicator)
957 if (
option->features & QStyleOptionViewItem::HasDisplay) {
962 const bool wrapText =
option->features & QStyleOptionViewItem::WrapText;
965 switch (
option->decorationPosition) {
966 case QStyleOptionViewItem::Left:
967 case QStyleOptionViewItem::Right: {
970 if (
option->features & QStyleOptionViewItem::HasDecoration)
971 width -=
option->decorationSize.width() + 2 * textMargin;
977 case QStyleOptionViewItem::Top:
978 case QStyleOptionViewItem::Bottom: {
983 else if (
option->features & QStyleOptionViewItem::HasDecoration)
997 if (
wrapText &&
option->features & QStyleOptionViewItem::HasCheckIndicator)
1000 const int lineWidth = bounds.
width();
1006 if (
option->features & QStyleOptionViewItem::HasDecoration) {
1007 return option->decorationSize;
1017void QCommonStylePrivate::viewItemDrawText(
QPainter *
p,
const QStyleOptionViewItem *
option,
const QRect &
rect)
const
1023 const bool wrapText =
option->features & QStyleOptionViewItem::WrapText;
1032 option->textElideMode, 0,
1033 true, &paintPosition);
1049void QCommonStylePrivate::viewItemLayout(
const QStyleOptionViewItem *
opt,
QRect *checkRect,
1058 const bool hasCheck = checkRect->
isValid();
1059 const bool hasPixmap = pixmapRect->
isValid();
1061 const bool hasMargin = (hasText | hasPixmap | hasCheck);
1062 const int frameHMargin = hasMargin ?
1064 const int textMargin = hasText ? frameHMargin : 0;
1065 const int pixmapMargin = hasPixmap ? frameHMargin : 0;
1066 const int checkMargin = hasCheck ? frameHMargin : 0;
1078 pm = pixmapRect->
size();
1079 pm.
rwidth() += 2 * pixmapMargin;
1083 if (
opt->decorationPosition == QStyleOptionViewItem::Left
1084 ||
opt->decorationPosition == QStyleOptionViewItem::Right) {
1097 cw = checkRect->
width() + 2 * checkMargin;
1098 if (sizehint)
w +=
cw;
1108 switch (
opt->decorationPosition) {
1109 case QStyleOptionViewItem::Top: {
1111 pm.setHeight(pm.height() + pixmapMargin);
1122 case QStyleOptionViewItem::Bottom: {
1135 case QStyleOptionViewItem::Left: {
1144 case QStyleOptionViewItem::Right: {
1154 qCWarning(lcCommonStyle,
"doLayout: decoration position is invalid");
1161 checkRect->
size(), check);
1165 if (
opt->showDecorationSelected)
1178#if QT_CONFIG(toolbutton)
1198#if QT_CONFIG(tabbar)
1214 tr.setRect(0, 0,
tr.height(),
tr.width());
1221 verticalShift = -verticalShift;
1222 tr.adjust(hpadding, verticalShift - vpadding, horizontalShift - hpadding, vpadding);
1225 tr.setTop(
tr.top() - verticalShift);
1226 tr.setRight(
tr.right() - horizontalShift);
1230 if (!
opt->leftButtonSize.isEmpty()) {
1231 tr.setLeft(
tr.left() + 4 +
1235 if (!
opt->rightButtonSize.isEmpty()) {
1236 tr.setRight(
tr.right() - 4 -
1253 const int offsetX = (
iconSize.width() - tabIconSize.
width()) / 2;
1254 *iconRect =
QRect(
tr.left() + offsetX,
tr.center().y() - tabIconSize.
height() / 2,
1258 tr.setLeft(
tr.left() + tabIconSize.
width() + 4);
1268#if QT_CONFIG(animation)
1272 return animations.keys();
1278 return animations.value(
target);
1292void QCommonStylePrivate::stopAnimation(
const QObject *
target)
const
1302void QCommonStylePrivate::_q_removeAnimation()
1328 fropt.QStyleOption::operator=(*btn);
1384 int pixmapWidth =
pixmap.width() /
pixmap.devicePixelRatio();
1385 int pixmapHeight =
pixmap.height() /
pixmap.devicePixelRatio();
1386 int labelWidth = pixmapWidth;
1387 int labelHeight = pixmapHeight;
1388 int iconSpacing = 4;
1391 labelWidth += (textWidth + iconSpacing);
1396 pixmapWidth, pixmapHeight);
1411 p->drawPixmap(iconRect,
pixmap);
1437 fropt.QStyleOption::operator=(*btn);
1488#if QT_CONFIG(menubar)
1509#if QT_CONFIG(progressbar)
1512 = qstyleoption_cast<const QStyleOptionProgressBar *>(
opt)) {
1518 if (pb->textVisible) {
1538 QRect shadowRect(pb->rect);
1540 QColor shadowColor = (pb->palette.color(textRole).value() <= 128)
1542 QPalette shadowPalette = pb->palette;
1543 shadowPalette.
setColor(textRole, shadowColor);
1557 const bool inverted = pb->invertedAppearance;
1567 m.translate(0, -(
rect.height() +
rect.y()*2));
1575 bool reverse = ((!vertical && (pb->direction ==
Qt::RightToLeft)) || vertical);
1578 int w =
rect.width();
1579 if (pb->minimum == 0 && pb->maximum == 0) {
1581 int x = (progress - minimum) % (
w * 2);
1594 u = ((
rect.width() + unit_width) / unit_width);
1597 qint64 p_v = progress - minimum;
1598 qint64 t_s = (maximum - minimum) ? (maximum - minimum) :
qint64(1);
1600 if (u > 0 && p_v >= INT_MAX / u && t_s >= u) {
1608 tnu = nu = p_v * u / t_s;
1610 if (nu * unit_width >
w)
1618 int x0 = reverse ?
rect.right() - ((unit_width > 1) ? unit_width : 0)
1624 int myY = pbBits.
rect.
y();
1627 for (
int i = 0;
i < nu; ++
i) {
1631 x += reverse ? -unit_width : unit_width;
1637 int pixels_left =
w - (nu * unit_width);
1638 int offset = reverse ?
x0 +
x + unit_width-pixels_left :
x0 +
x;
1658 p->drawPixmap(inter.
x(), inter.
y(),
pixmap,
1665 rect.setLeft(
rect.left() + pixw + margin);
1667 rect.setRight(
rect.right() - pixw - margin);
1685#if QT_CONFIG(toolbutton)
1688 = qstyleoption_cast<const QStyleOptionToolButton *>(
opt)) {
1703 rect.translate(shiftX, shiftY);
1704 p->setFont(toolbutton->
font);
1727 p->setFont(toolbutton->
font);
1736 tr.adjust(0, pr.
height() - 1, 0, -1);
1746 tr.adjust(pr.
width(), 0, 0, 0);
1755 tr.translate(shiftX, shiftY);
1761 rect.translate(shiftX, shiftY);
1772#if QT_CONFIG(toolbox)
1781 p->setPen(tb->palette.mid().color().darker(150));
1782 int d = 20 + tb->rect.height() - 3;
1785 QPoint(-1, tb->rect.height() + 1),
1787 QPoint(tb->rect.width() -
d, 1),
1788 QPoint(tb->rect.width() - 20, tb->rect.height() - 2),
1789 QPoint(tb->rect.width() - 1, tb->rect.height() - 2),
1790 QPoint(tb->rect.width() - 1, tb->rect.height() + 1),
1791 QPoint(-1, tb->rect.height() + 1),
1796 QPoint(tb->rect.width(), tb->rect.height() + 1),
1797 QPoint(tb->rect.width(), 1),
1799 QPoint(20 - 1, tb->rect.height() - 2),
1800 QPoint(0, tb->rect.height() - 2),
1801 QPoint(0, tb->rect.height() + 1),
1802 QPoint(tb->rect.width(), tb->rect.height() + 1),
1806 p->setPen(tb->palette.light().color());
1808 p->drawLine(0, 2, tb->rect.width() -
d, 2);
1809 p->drawLine(tb->rect.width() -
d - 1, 2, tb->rect.width() - 21, tb->rect.height() - 1);
1810 p->drawLine(tb->rect.width() - 20, tb->rect.height() - 1,
1811 tb->rect.width(), tb->rect.height() - 1);
1813 p->drawLine(tb->rect.width() - 1, 2,
d - 1, 2);
1814 p->drawLine(
d, 2, 20, tb->rect.height() - 1);
1815 p->drawLine(19, tb->rect.height() - 1,
1816 -1, tb->rect.height() - 1);
1822#if QT_CONFIG(tabbar)
1824 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
1830 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
1835 bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab;
1839 switch (tab->shape) {
1841 rect.adjust(0, 0, 0, -tabOverlap);
1843 rect.adjust(1, 1, -1, 0);
1846 rect.adjust(0, tabOverlap, 0, 0);
1848 rect.adjust(1, 0, -1, -1);
1851 rect.adjust(tabOverlap, 0, 0, 0);
1853 rect.adjust(0, 1, -1, -1);
1856 rect.adjust(0, 0, -tabOverlap, 0);
1858 rect.adjust(1, 1, 0, -1);
1865 p->setPen(
QPen(tab->palette.windowText(), 0));
1867 p->setBrush(tab->palette.base());
1872 p->setBrush(tab->palette.window());
1878 switch (tab->shape) {
1881 a.setPoint(0, 0, -1);
1882 a.setPoint(1, 0, 0);
1883 y =
rect.height() - 2;
1885 a.setPoint(2,
x++,
y - 1);
1887 a.setPoint(3,
x++,
y++);
1888 a.setPoint(4,
x,
y);
1892 for (
i = 0;
i < 5; ++
i)
1893 a.setPoint(9 -
i,
right -
a.point(
i).x(),
a.point(
i).y());
1895 for (
i = 0;
i < 10; ++
i)
1896 a.setPoint(
i,
a.point(
i).x(),
rect.height() - 1 -
a.point(
i).y());
1900 p->translate(0, 0.5);
1908 a.setPoint(0, -1, 0);
1909 a.setPoint(1, 0, 0);
1910 x =
rect.width() - 2;
1912 a.setPoint(2,
x - 1,
y++);
1914 a.setPoint(3,
x++,
y++);
1915 a.setPoint(4,
x,
y);
1918 for (
i = 0;
i < 5; ++
i)
1919 a.setPoint(9 -
i,
a.point(
i).x(),
bottom -
a.point(
i).y());
1921 for (
i = 0;
i < 10; ++
i)
1922 a.setPoint(
i,
rect.width() - 1 -
a.point(
i).x(),
a.point(
i).y());
1925 p->translate(0.5, 0);
1941 QPixmap pm = tb->icon.pixmap(
QSize(iconExtent, iconExtent),
p->device()->devicePixelRatio(),
1949 tr.adjust(4, 0, -8, 0);
1966 p->drawPixmap(ir.
left(), (tb->rect.height() - ih) / 2, pm);
1983 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
1996 int newX, newY, newRot;
1998 newX =
tr.width() +
tr.x();
2003 newY =
tr.y() +
tr.height();
2008 p->setTransform(
m,
true);
2011 d->tabLayout(tab,
widget, &
tr, &iconRect);
2014 if (tab->position != QStyleOptionTab::TabPosition::Moving)
2017 if (!tab->icon.isNull()) {
2018 QPixmap tabIcon = tab->icon.pixmap(tab->iconSize,
p->device()->devicePixelRatio(),
2023 p->drawPixmap(iconRect.
x(), iconRect.
y(), tabIcon);
2035 x1 = tab->rect.left();
2036 x2 = tab->rect.right() - 1;
2039 fropt.QStyleOption::operator=(*tab);
2041 x2 -
x1 - 2*OFFSET, tab->rect.height() - 2*OFFSET);
2047#if QT_CONFIG(sizegrip)
2055 p->translate(0,
h -
w);
2057 p->translate(
w -
h, 0);
2065 corner = sgOpt->corner;
2073 for (
int i = 0;
i < 4; ++
i) {
2075 p->drawLine(
x, sy - 1 , sx + 1, sw);
2077 p->drawLine(
x, sy, sx, sw);
2079 p->drawLine(
x, sy + 1, sx - 1, sw);
2084 for (
int i = 0;
i < 4; ++
i) {
2086 p->drawLine(sx - 1, sw, sw, sy - 1);
2088 p->drawLine(sx, sw, sw, sy);
2090 p->drawLine(sx + 1, sw, sw, sy + 1);
2096 for (
int i = 0;
i < 4; ++
i) {
2098 p->drawLine(sx - 1,
y, sw, sy + 1);
2100 p->drawLine(sx,
y, sw, sy);
2102 p->drawLine(sx + 1,
y, sw, sy - 1);
2107 for (
int i = 0;
i < 4; ++
i) {
2109 p->drawLine(
x, sy - 1, sx - 1,
y);
2111 p->drawLine(
x, sy, sx,
y);
2113 p->drawLine(
x, sy + 1, sx + 1,
y);
2121#if QT_CONFIG(rubberband)
2123 if (
const QStyleOptionRubberBand *rbOpt = qstyleoption_cast<const QStyleOptionRubberBand *>(
opt)) {
2125 QPainter pixmapPainter(&tiledPixmap);
2131 pixmapPainter.
end();
2139 p->setClipRegion(
mask.region);
2140 p->drawTiledPixmap(
r.x(),
r.y(),
r.width(),
r.height(), tiledPixmap);
2143 p->drawRect(
r.adjusted(0, 0, -1, -1));
2145 p->drawRect(
r.adjusted(3, 3, -4, -4));
2150#if QT_CONFIG(dockwidget)
2154 if (dwOpt->movable) {
2159 if (!dwOpt->title.isEmpty()) {
2160 const bool verticalTitleBar = dwOpt->verticalTitleBar;
2162 if (verticalTitleBar) {
2168 p->translate(-
r.left(), -
r.top());
2171 const int indent =
p->fontMetrics().descent();
2177 if (verticalTitleBar)
2185 QRegion clipRegion =
p->clipRegion();
2191 if (
auto v2 = qstyleoption_cast<const QStyleOptionHeaderV2 *>(
opt))
2202 p->setClipRegion(clipRegion);
2216#if QT_CONFIG(combobox)
2221 p->setClipRect(editRect);
2222 if (!
cb->currentIcon.isNull()) {
2226 QRect iconRect(editRect);
2230 iconRect.
size(), editRect);
2240 if (!
cb->currentText.isEmpty() && !
cb->editable) {
2249#if QT_CONFIG(toolbar)
2251 if (
const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(
opt)) {
2254 frame.QStyleOption::operator=(*toolBar);
2261 qDrawShadePanel(
p, toolBar->rect, toolBar->palette,
false, toolBar->lineWidth,
2283 p->drawLine(line1starting,
top, line1starting,
bottom);
2284 p->drawLine(line2starting,
top, line2starting,
bottom);
2288#if QT_CONFIG(itemviews)
2290 if (
const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(
opt)) {
2294 p->setClipRegion(clipRegion);
2304 if (vopt->features & QStyleOptionViewItem::HasCheckIndicator) {
2305 QStyleOptionViewItem
option(*vopt);
2309 switch (vopt->checkState) {
2330 vopt->icon.paint(
p, iconRect, vopt->decorationAlignment,
mode,
state);
2333 if (!vopt->text.isEmpty()) {
2355 o.QStyleOption::operator=(*vopt);
2374 int frameShape =
f->frameShape;
2382 int lw =
f->lineWidth;
2383 int mlw =
f->midLineWidth;
2388 switch (frameShape) {
2430 QPen oldPen =
p->pen();
2432 p->drawLine(
p1,
p2);
2446#if !QT_CONFIG(tabbar) && !QT_CONFIG(itemviews)
2474 int dbw1 = 0, dbw2 = 0;
2519 r.adjust(1, 1, -1, -1);
2570 r.adjust(1, 1, -1, -1);
2593#if QT_CONFIG(slider)
2595 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
2599 r.setRect(0, tickOffset - 1, slider->rect.width(), thickness + 2);
2601 r.setRect(tickOffset - 1, 0, thickness + 2, slider->rect.height());
2602 r =
r.intersected(slider->rect);
2607#if QT_CONFIG(progressbar)
2615 if (pb->textVisible)
2616 textw =
qMax(pb->fontMetrics.horizontalAdvance(pb->text), pb->fontMetrics.horizontalAdvance(
"100%"_L1)) + 6;
2621 r.setCoords(pb->rect.left(), pb->rect.top(),
2622 pb->rect.right() - textw, pb->rect.bottom());
2624 r.setCoords(pb->rect.right() - textw, pb->rect.top(),
2625 pb->rect.right(), pb->rect.bottom());
2633#if QT_CONFIG(combobox)
2636 int margin =
cb->frame ? 3 : 0;
2643#if QT_CONFIG(toolbox)
2660 r.setHeight(
r.height() - (
opt->
rect.
width() / 2) - (margin * 2));
2673 int horiz_size =
h / 2;
2674 r.setRect(
x +
w - margin * 2 - horiz_size,
y + 5,
2675 horiz_size,
h - margin * 2 - 5);
2677 int vert_size =
w / 2;
2678 r.setRect(
x + 5,
y +
h - margin * 2 - vert_size,
2679 w - margin * 2 - 5, vert_size);
2692#if QT_CONFIG(tabwidget)
2694 if (
const QStyleOptionTabWidgetFrame *twf
2695 = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(
opt)) {
2696 r.setSize(twf->tabBarSize);
2698 switch (twf->shape) {
2703 r.setWidth(
qMin(
r.width(), twf->rect.width()
2704 - twf->leftCornerWidgetSize.width()
2705 - twf->rightCornerWidgetSize.width()));
2709 r.moveTopLeft(
QPoint(twf->leftCornerWidgetSize.width(), 0));
2712 r.moveTopLeft(
QPoint(twf->rect.center().x() -
qRound(
r.width() / 2.0f)
2713 + (twf->leftCornerWidgetSize.width() / 2)
2714 - (twf->rightCornerWidgetSize.width() / 2), 0));
2717 r.moveTopLeft(
QPoint(twf->rect.width() - twf->tabBarSize.width()
2718 - twf->rightCornerWidgetSize.width(), 0));
2725 r.setWidth(
qMin(
r.width(), twf->rect.width()
2726 - twf->leftCornerWidgetSize.width()
2727 - twf->rightCornerWidgetSize.width()));
2731 r.moveTopLeft(
QPoint(twf->leftCornerWidgetSize.width(),
2732 twf->rect.height() - twf->tabBarSize.height()));
2735 r.moveTopLeft(
QPoint(twf->rect.center().x() -
qRound(
r.width() / 2.0f)
2736 + (twf->leftCornerWidgetSize.width() / 2)
2737 - (twf->rightCornerWidgetSize.width() / 2),
2738 twf->rect.height() - twf->tabBarSize.height()));
2741 r.moveTopLeft(
QPoint(twf->rect.width() - twf->tabBarSize.width()
2742 - twf->rightCornerWidgetSize.width(),
2743 twf->rect.height() - twf->tabBarSize.height()));
2750 r.setHeight(
qMin(
r.height(), twf->rect.height()
2751 - twf->leftCornerWidgetSize.height()
2752 - twf->rightCornerWidgetSize.height()));
2756 r.moveTopLeft(
QPoint(twf->rect.width() - twf->tabBarSize.width(),
2757 twf->leftCornerWidgetSize.height()));
2760 r.moveTopLeft(
QPoint(twf->rect.width() - twf->tabBarSize.width(),
2761 twf->rect.center().y() -
r.height() / 2));
2764 r.moveTopLeft(
QPoint(twf->rect.width() - twf->tabBarSize.width(),
2765 twf->rect.height() - twf->tabBarSize.height()
2766 - twf->rightCornerWidgetSize.height()));
2772 r.setHeight(
qMin(
r.height(), twf->rect.height()
2773 - twf->leftCornerWidgetSize.height()
2774 - twf->rightCornerWidgetSize.height()));
2778 r.moveTopLeft(
QPoint(0, twf->leftCornerWidgetSize.height()));
2781 r.moveTopLeft(
QPoint(0, twf->rect.center().y() -
r.height() / 2));
2784 r.moveTopLeft(
QPoint(0, twf->rect.height() - twf->tabBarSize.height()
2785 - twf->rightCornerWidgetSize.height()));
2794 if (
const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(
opt)) {
2795 QStyleOptionTab tabopt;
2796 tabopt.shape = twf->shape;
2798 if (twf->lineWidth == 0)
2800 switch (twf->shape) {
2804 QSize(twf->rect.width(),
qMin(twf->rect.height() - twf->tabBarSize.height() + overlap, twf->rect.height())));
2808 r =
QRect(
QPoint(0,0),
QSize(twf->rect.width(),
qMin(twf->rect.height() - twf->tabBarSize.height() + overlap, twf->rect.height())));
2812 r =
QRect(
QPoint(0, 0),
QSize(
qMin(twf->rect.width() - twf->tabBarSize.width() + overlap, twf->rect.width()), twf->rect.height()));
2817 QSize(
qMin(twf->rect.width() - twf->tabBarSize.width() + overlap, twf->rect.width()), twf->rect.height()));
2821 r.adjust(2, 2, -2, -2);
2825 if (
const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(
opt)) {
2827 switch (twf->shape) {
2830 r =
QRect(
QPoint(paneRect.
x(), paneRect.
y() - twf->leftCornerWidgetSize.height()),
2831 twf->leftCornerWidgetSize);
2844 if (
const QStyleOptionTabWidgetFrame *twf = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(
opt)) {
2846 switch (twf->shape) {
2850 paneRect.
y() - twf->rightCornerWidgetSize.height()),
2851 twf->rightCornerWidgetSize);
2856 paneRect.
height()), twf->rightCornerWidgetSize);
2865 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
2866 QRect dummyIconRect;
2867 d->tabLayout(tab,
widget, &
r, &dummyIconRect);
2872 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
2877 hpadding =
qMax(hpadding, 4);
2886 verticalShift = -verticalShift;
2888 qSwap(horizontalShift, verticalShift);
2889 horizontalShift *= -1;
2890 verticalShift *= -1;
2893 horizontalShift = -horizontalShift;
2895 tr.adjust(0, 0, horizontalShift, verticalShift);
2898 tr.setBottom(
tr.bottom() - verticalShift);
2899 tr.setRight(
tr.right() - horizontalShift);
2903 int w =
size.width();
2904 int h =
size.height();
2905 int midHeight =
static_cast<int>(
qCeil(
float(
tr.height() -
h) / 2));
2906 int midWidth = ((
tr.width() -
w) / 2);
2908 bool atTheTop =
true;
2909 switch (tab->shape) {
2920 r =
QRect(tab->rect.x() + hpadding, midHeight,
w,
h);
2922 r =
QRect(tab->rect.right() -
w - hpadding, midHeight,
w,
h);
2927 r =
QRect(midWidth,
tr.y() + tab->rect.height() - hpadding -
h,
w,
h);
2929 r =
QRect(midWidth,
tr.y() + hpadding,
w,
h);
2935#if QT_CONFIG(tabbar)
2937 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(
opt)) {
2938 switch (tab->shape) {
2943 r.setRect(tab->rect.left(), tab->rect.top(), 8,
opt->
rect.
height());
2949 r.setRect(tab->rect.left(), tab->rect.top(),
opt->
rect.
width(), 8);
2980 r =
f->rect.adjusted(
f->lineWidth,
f->lineWidth, -
f->lineWidth, -
f->lineWidth);
2993 int frameShape =
f->frameShape;
3003 switch (frameShape) {
3011 switch (frameShadow) {
3013 frameWidth =
f->lineWidth;
3017 frameWidth = (short)(
f->lineWidth*2 +
f->midLineWidth);
3035 switch (frameShadow) {
3039 frameWidth =
f->lineWidth;
3044 r =
f->rect.adjusted(frameWidth, frameWidth, -frameWidth, -frameWidth);
3047#if QT_CONFIG(dockwidget)
3058 = qstyleoption_cast<const QStyleOptionDockWidget*>(
opt);
3059 bool canClose = dwOpt ==
nullptr ? true : dwOpt->
closable;
3067 if (verticalTitleBar)
3079 sz +=
QSize(buttonMargin, buttonMargin);
3080 if (verticalTitleBar)
3096 sz +=
QSize(buttonMargin, buttonMargin);
3097 if (verticalTitleBar)
3112 if (dw->isFloating())
3113 icon = dw->windowIcon();
3117 if (verticalTitleBar)
3138 if (verticalTitleBar) {
3141 r.height(),
r.width());
3148#if QT_CONFIG(itemviews)
3150 if (!qstyleoption_cast<const QStyleOptionViewItem *>(
opt)) {
3158 if (
const QStyleOptionViewItem *vopt = qstyleoption_cast<const QStyleOptionViewItem *>(
opt)) {
3159 if (!
d->isViewItemCached(*vopt)) {
3160 d->viewItemLayout(vopt, &
d->checkRect, &
d->decorationRect, &
d->displayRect,
false);
3161 if (
d->cachedOption) {
3162 delete d->cachedOption;
3163 d->cachedOption =
nullptr;
3165 d->cachedOption =
new QStyleOptionViewItem(*vopt);
3170 r =
d->decorationRect;
3176#if QT_CONFIG(toolbar)
3178 if (
const QStyleOptionToolBar *tbopt = qstyleoption_cast<const QStyleOptionToolBar *>(
opt)) {
3179 if (tbopt->features & QStyleOptionToolBar::Movable) {
3188 tbopt->rect.height() - (margins.
top() + margins.
bottom()));
3192 tbopt->rect.width() - (margins.
left() + margins.
right()),
3203#if !QT_CONFIG(tabwidget) && !QT_CONFIG(itemviews)
3212struct StaticPolygonF
3216 constexpr int size()
const {
return N; }
3217 constexpr const QPointF *cbegin()
const {
return data; }
3218 constexpr const QPointF &operator[](
int idx)
const {
return data[idx]; }
3221static StaticPolygonF<3> calcArrow(
const QStyleOptionSlider *dial,
qreal &
a)
3223 int width = dial->rect.width();
3224 int height = dial->rect.height();
3226 int currentSliderPosition = dial->upsideDown ? dial->sliderPosition : (dial->maximum - dial->sliderPosition);
3228 if (dial->maximum == dial->minimum)
3230 else if (dial->dialWrapping)
3231 a =
Q_PI * 3 / 2 - (currentSliderPosition - dial->minimum) * 2 *
Q_PI
3232 / (dial->maximum - dial->minimum);
3234 a = (
Q_PI * 8 - (currentSliderPosition - dial->minimum) * 10 *
Q_PI
3235 / (dial->maximum - dial->minimum)) / 6;
3237 int xc =
width / 2 + dial->rect.left();
3238 int yc =
height / 2 + dial->rect.top();
3240 int len =
r - QStyleHelper::calcBigLineSize(
r) - 5;
3245 StaticPolygonF<3> arrow = {{
3249 0.5 + yc - back *
qSin(
a +
Q_PI * 5 / 6)),
3251 0.5 + yc - back *
qSin(
a -
Q_PI * 5 / 6)),
3265#if QT_CONFIG(slider)
3267 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
3270 int ticks = slider->tickPosition;
3274 int interval = slider->tickInterval;
3275 if (interval <= 0) {
3276 interval = slider->singleStep;
3281 interval = slider->pageStep;
3285 int fudge =
len / 2;
3289 p->translate(slider->rect.x(), slider->rect.y());
3290 p->setPen(slider->palette.windowText().color());
3291 int v = slider->minimum;
3292 while (v <= slider->maximum + 1) {
3293 if (
v == slider->maximum + 1 && interval == 1)
3295 const int v_ =
qMin(
v, slider->maximum);
3297 v_, available) + fudge;
3300 p->drawLine(
pos, 0,
pos, tickOffset - 2);
3302 p->drawLine(
pos, tickOffset + thickness + 1,
pos,
3303 slider->rect.height()-1);
3306 p->drawLine(0,
pos, tickOffset - 2,
pos);
3308 p->drawLine(tickOffset + thickness + 1,
pos,
3309 slider->rect.width()-1,
pos);
3312 int nextInterval =
v + interval;
3313 if (nextInterval <
v)
3322#if QT_CONFIG(scrollbar)
3324 if (
const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
3326 QStyleOptionSlider newScrollbar = *scrollbar;
3327 State saveFlags = scrollbar->state;
3330 newScrollbar.state = saveFlags;
3332 if (newScrollbar.rect.isValid()) {
3339 newScrollbar.rect = scrollbar->rect;
3340 newScrollbar.state = saveFlags;
3342 if (newScrollbar.rect.isValid()) {
3349 newScrollbar.rect = scrollbar->rect;
3350 newScrollbar.state = saveFlags;
3352 if (newScrollbar.rect.isValid()) {
3359 newScrollbar.rect = scrollbar->rect;
3360 newScrollbar.state = saveFlags;
3362 if (newScrollbar.rect.isValid()) {
3369 newScrollbar.rect = scrollbar->rect;
3370 newScrollbar.state = saveFlags;
3372 if (newScrollbar.rect.isValid()) {
3379 newScrollbar.rect = scrollbar->rect;
3380 newScrollbar.state = saveFlags;
3382 if (newScrollbar.rect.isValid()) {
3389 newScrollbar.rect = scrollbar->rect;
3390 newScrollbar.state = saveFlags;
3392 if (newScrollbar.rect.isValid()) {
3399 fropt.QStyleOption::operator=(newScrollbar);
3400 fropt.
rect.
setRect(newScrollbar.rect.x() + 2, newScrollbar.rect.y() + 2,
3401 newScrollbar.rect.width() - 5,
3402 newScrollbar.rect.height() - 5);
3410#if QT_CONFIG(spinbox)
3412 if (
const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(
opt)) {
3413 QStyleOptionSpinBox
copy = *sb;
3426 copy.state &= ~State_Enabled;
3429 copy.palette = pal2;
3436 copy.state &= ~State_Sunken;
3443 copy.rect.adjust(3, 0, -4, 0);
3449 copy.state = sb->state;
3453 copy.state &= ~State_Enabled;
3455 copy.palette = pal2;
3462 copy.state &= ~State_Sunken;
3469 copy.rect.adjust(3, 0, -4, 0);
3475#if QT_CONFIG(toolbutton)
3478 = qstyleoption_cast<const QStyleOptionToolButton *>(
opt)) {
3483 State bflags = toolbutton->
state & ~State_Sunken;
3487 bflags &= ~State_Raised;
3490 State mflags = bflags;
3501 tool.
state = bflags;
3508 fr.QStyleOption::operator=(*toolbutton);
3522 tool.
rect = menuarea;
3523 tool.
state = mflags;
3542 QColor left = tb->palette.highlight().color();
3547 QPoint p1(tb->rect.x(), tb->rect.top() + tb->rect.height()/2);
3548 QPoint p2(tb->rect.right(), tb->rect.top() + tb->rect.height()/2);
3559 p->setPen(tb->palette.highlightedText().color());
3572#if QT_CONFIG(dockwidget)
3573 || qobject_cast<const QDockWidget *>(
widget)
3634 if (drawNormalButton) {
3702 if (!tb->icon.isNull()) {
3703 tb->icon.paint(
p, ir);
3717 if (
const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
3725 int width = dial->rect.width();
3726 int height = dial->rect.height();
3729 qreal dx = dial->rect.x() + d_ + (
width - 2 *
r) / 2 + 1;
3730 qreal dy = dial->rect.y() + d_ + (
height - 2 *
r) / 2 + 1;
3731 QRect br =
QRect(
int(dx),
int(dy),
int(
r * 2 - 2 * d_ - 2),
int(
r * 2 - 2 * d_ - 2));
3737 p->drawLines(QStyleHelper::calcLines(dial));
3748 p->drawArc(br, 60 * 16, 180 * 16);
3750 p->drawArc(br, 240 * 16, 180 * 16);
3753 const StaticPolygonF<3> arrow = calcArrow(dial,
a);
3757 p->drawPolygon(arrow.cbegin(), arrow.size());
3762 if (a <= 0 || a > 200) {
3764 p->drawLine(arrow[2], arrow[0]);
3765 p->drawLine(arrow[1], arrow[2]);
3767 p->drawLine(arrow[0], arrow[1]);
3768 }
else if (
a > 0 &&
a < 45) {
3770 p->drawLine(arrow[2], arrow[0]);
3772 p->drawLine(arrow[1], arrow[2]);
3773 p->drawLine(arrow[0], arrow[1]);
3774 }
else if (
a >= 45 &&
a < 135) {
3776 p->drawLine(arrow[2], arrow[0]);
3777 p->drawLine(arrow[1], arrow[2]);
3779 p->drawLine(arrow[0], arrow[1]);
3780 }
else if (
a >= 135 &&
a < 200) {
3782 p->drawLine(arrow[2], arrow[0]);
3784 p->drawLine(arrow[0], arrow[1]);
3785 p->drawLine(arrow[1], arrow[2]);
3790 fropt.
rect = dial->rect;
3791 fropt.
state = dial->state;
3792 fropt.
palette = dial->palette;
3794 br.adjust(0, 0, 2, 2);
3797 br.translate(-
r / 6, -
r / 6);
3798 br.setWidth(br.width() +
r / 3);
3799 br.setHeight(br.height() +
r / 3);
3808#if QT_CONFIG(groupbox)
3816 frame.QStyleOption::operator=(*groupBox);
3828 finalRect.
adjust(ltr ? -4 : 0, 0, ltr ? 0 : 4, 0);
3832 region -= finalRect;
3834 p->setClipRegion(region);
3843 p->setPen(textColor);
3854 fropt.QStyleOption::operator=(*groupBox);
3863 box.QStyleOption::operator=(*groupBox);
3864 box.rect = checkBoxRect;
3870#if QT_CONFIG(mdiarea)
3874 btnOpt.QStyleOption::operator=(*opt);
3875 btnOpt.
state &= ~State_MouseOver;
3879 const QSize buttonIconSize(buttonIconMetric, buttonIconMetric);
3883 btnOpt.
state &= ~State_Raised;
3888 btnOpt.
state &= ~State_Sunken;
3900 btnOpt.
state &= ~State_Raised;
3905 btnOpt.
state &= ~State_Sunken;
3917 btnOpt.
state &= ~State_Raised;
3922 btnOpt.
state &= ~State_Sunken;
3935 qCWarning(lcCommonStyle,
"QCommonStyle::drawComplexControl: Control %d not handled", cc);
3947#if QT_CONFIG(slider)
3949 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
3951 if (
r.isValid() &&
r.contains(pt)) {
3955 if (
r.isValid() &&
r.contains(pt))
3961#if QT_CONFIG(scrollbar)
3963 if (
const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
3968 if (
r.isValid() &&
r.contains(pt)) {
3977#if QT_CONFIG(toolbutton)
3984 if (
r.isValid() &&
r.contains(pt)) {
3993#if QT_CONFIG(spinbox)
3995 if (
const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(
opt)) {
4000 if (
r.isValid() &&
r.contains(pt)) {
4016 if (
r.isValid() &&
r.contains(pt)) {
4024#if QT_CONFIG(combobox)
4031 if (
r.isValid() &&
r.contains(pt)) {
4040#if QT_CONFIG(groupbox)
4047 if (
r.isValid() &&
r.contains(pt)) {
4062 if (
r.isValid() &&
r.contains(pt) && (
opt->subControls & ctrl)) {
4071 qCWarning(lcCommonStyle,
"QCommonStyle::hitTestComplexControl: Case %d not handled", cc);
4084#if QT_CONFIG(slider)
4086 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
4096 slider->sliderPosition,
4097 (horizontal ? slider->rect.width()
4098 : slider->rect.height()) -
len,
4099 slider->upsideDown);
4101 ret.setRect(slider->rect.x() + sliderPos, slider->rect.y() + tickOffset,
len, thickness);
4103 ret.setRect(slider->rect.x() + tickOffset, slider->rect.y() + sliderPos, thickness,
len);
4107 ret.setRect(slider->rect.x(), slider->rect.y() + tickOffset,
4108 slider->rect.width(), thickness);
4110 ret.setRect(slider->rect.x() + tickOffset, slider->rect.y(),
4111 thickness, slider->rect.height());
4120#if QT_CONFIG(scrollbar)
4122 if (
const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
4123 const QRect scrollBarRect = scrollbar->rect;
4128 scrollBarRect.
width() : scrollBarRect.
height()) - (sbextent * 2);
4132 if (scrollbar->maximum != scrollbar->minimum) {
4133 uint range = scrollbar->maximum - scrollbar->minimum;
4134 sliderlen = (
qint64(scrollbar->pageStep) * maxlen) / (
range + scrollbar->pageStep);
4137 if (sliderlen < slidermin || range > INT_MAX / 2)
4138 sliderlen = slidermin;
4139 if (sliderlen > maxlen)
4147 scrollbar->sliderPosition,
4149 scrollbar->upsideDown);
4154 int buttonWidth =
qMin(scrollBarRect.
width() / 2, sbextent);
4155 ret.setRect(0, 0, buttonWidth, scrollBarRect.
height());
4157 int buttonHeight =
qMin(scrollBarRect.
height() / 2, sbextent);
4158 ret.setRect(0, 0, scrollBarRect.
width(), buttonHeight);
4163 int buttonWidth =
qMin(scrollBarRect.
width()/2, sbextent);
4164 ret.setRect(scrollBarRect.
width() - buttonWidth, 0, buttonWidth, scrollBarRect.
height());
4166 int buttonHeight =
qMin(scrollBarRect.
height()/2, sbextent);
4167 ret.setRect(0, scrollBarRect.
height() - buttonHeight, scrollBarRect.
width(), buttonHeight);
4172 ret.setRect(sbextent, 0, sliderstart - sbextent, scrollBarRect.
height());
4174 ret.setRect(0, sbextent, scrollBarRect.
width(), sliderstart - sbextent);
4178 ret.setRect(sliderstart + sliderlen, 0,
4179 maxlen - sliderstart - sliderlen + sbextent, scrollBarRect.
height());
4181 ret.setRect(0, sliderstart + sliderlen, scrollBarRect.
width(),
4182 maxlen - sliderstart - sliderlen + sbextent);
4186 ret.setRect(sbextent, 0, scrollBarRect.
width() - sbextent * 2,
4189 ret.setRect(0, sbextent, scrollBarRect.
width(),
4190 scrollBarRect.
height() - sbextent * 2);
4194 ret.setRect(sliderstart, 0, sliderlen, scrollBarRect.
height());
4196 ret.setRect(0, sliderstart, scrollBarRect.
width(), sliderlen);
4205#if QT_CONFIG(spinbox)
4207 if (
const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(
opt)) {
4213 int y = fw + spinbox->rect.y();
4215 x = spinbox->rect.x() + spinbox->rect.width() - fw - bs.
width();
4232 ret =
QRect(lx, fw, spinbox->rect.width() - 2*fw, spinbox->rect.height() - 2*fw);
4234 ret =
QRect(lx, fw,
rx, spinbox->rect.height() - 2*fw);
4238 ret = spinbox->rect;
4246#if QT_CONFIG(toolbutton)
4256 ret.adjust(0, 0, -mbi, 0);
4262 ret.adjust(
ret.width() - mbi, 0, 0, 0);
4271#if QT_CONFIG(combobox)
4275 const int x =
cb->rect.x(),
y =
cb->rect.y(), wi =
cb->rect.width(), he =
cb->rect.height();
4303 const int controlMargin = 2;
4304 const int controlHeight = tb->rect.height() - controlMargin *2;
4305 const int delta = controlHeight + controlMargin;
4316 ret.adjust(delta, 0, -delta, 0);
4318 ret.adjust(0, 0, -delta, 0);
4320 ret.adjust(0, 0, -delta, 0);
4322 ret.adjust(0, 0, -delta, 0);
4324 ret.adjust(0, 0, -delta, 0);
4368 ret.setRect(tb->rect.right() -
offset, tb->rect.top() + controlMargin,
4369 controlHeight, controlHeight);
4373 ret.setRect(tb->rect.left() + controlMargin, tb->rect.top() + controlMargin,
4374 controlHeight, controlHeight);
4383#if QT_CONFIG(groupbox)
4397 topMargin = topHeight / 2;
4399 topMargin = topHeight;
4403 frameRect.
setTop(topMargin);
4413 ret = frameRect.
adjusted(frameWidth, frameWidth + topHeight - topMargin,
4414 -frameWidth, -frameWidth);
4429 int checkBoxWidth = hasCheckBox ? (indicatorWidth + indicatorSpace) : 0;
4430 int checkBoxHeight = hasCheckBox ? indicatorHeight : 0;
4432 int h =
qMax(th, checkBoxHeight);
4445 left = ltr ? totalRect.
left() : (totalRect.
right() - indicatorWidth);
4446 int top = totalRect.
top() + (
h - checkBoxHeight) / 2;
4450 left = ltr ? (totalRect.
left() + checkBoxWidth - 2) : totalRect.
left();
4451 int top = totalRect.
top() + (
h - th) / 2;
4465#if QT_CONFIG(mdiarea)
4468 int numSubControls = 0;
4475 if (numSubControls == 0)
4478 int buttonWidth =
opt->
rect.
width() / numSubControls - 1;
4483 if (numSubControls == 1)
4485 offset += buttonWidth + 2;
4491 if (numSubControls == 1 || (numSubControls == 2 && !(
opt->subControls &
SC_MdiMinButton)))
4503 if (numSubControls == 1)
4510 qCWarning(lcCommonStyle,
"QCommonStyle::subControlRect: Case %d not handled", cc);
4512#if !QT_CONFIG(slider) && !QT_CONFIG(spinbox) && !QT_CONFIG(toolbutton) && !QT_CONFIG(groupbox)
4546#if QT_CONFIG(dockwidget)
4547 }
else if (qobject_cast<const QDockWidget*>(
widget)) {
4608#if QT_CONFIG(scrollbar)
4610 if (qstyleoption_cast<const QStyleOptionSlider *>(
opt))
4620#if QT_CONFIG(slider)
4626 if (
const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
4627 int space = (sl->orientation ==
Qt::Horizontal) ? sl->rect.height()
4630 int ticks = sl->tickPosition;
4633 ret = (space - thickness) / 2;
4635 ret = space - thickness;
4644 if (
const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(
opt)) {
4654#if QT_CONFIG(dockwidget)
4679#if QT_CONFIG(toolbar)
4705#if QT_CONFIG(tabbar)
4724 const QStyleOptionTab *tb = qstyleoption_cast<const QStyleOptionTab *>(
opt);
4820#if QT_CONFIG(filedialog)
4821 if (qobject_cast<const QSidebar *>(
widget))
4904 switch (contentsType) {
4906 if (
const auto *buttonOpt = qstyleoption_cast<const QStyleOptionButton *>(
opt)) {
4911 width += buttonMargin + defaultFrameWidth;
4912 height += buttonMargin + defaultFrameWidth;
4917 width += buttonIndicator;
4918 height += buttonIndicator;
4925 if (
const auto *buttonOpt = qstyleoption_cast<const QStyleOptionButton *>(
opt)) {
4936 if (!buttonOpt->icon.isNull() || !buttonOpt->text.isEmpty()) {
4947 if (
const auto *menuItemOpt = qstyleoption_cast<const QStyleOptionMenuItem *>(
opt)) {
4948 const bool checkable = menuItemOpt->menuHasCheckableItems;
4949 const int maxpmw = menuItemOpt->maxIconWidth;
4956 height = menuItemOpt->fontMetrics.height() + 8;
4957 if (!menuItemOpt->icon.isNull()) {
4960 menuItemOpt->icon.actualSize(
QSize(iconExtent,
4961 iconExtent)).
height() + 4);
4964 if (menuItemOpt->text.contains(u
'\t'))
4967 width += maxpmw + 6;
4968 if (checkable && maxpmw < 20)
4969 width += 20 - maxpmw;
4970 if (checkable || maxpmw > 0)
4977#if QT_CONFIG(toolbutton)
4982#if QT_CONFIG(combobox)
4984 if (
const auto *comboBoxOpt = qstyleoption_cast<const QStyleOptionComboBox *>(
opt)) {
4991 const int other =
qMax(23, 2 * textMargins
5000 if (
const auto *headerOpt = qstyleoption_cast<const QStyleOptionHeader *>(
opt)) {
5001 const bool nullIcon = headerOpt->icon.isNull();
5006 const QSize textSize = headerOpt->fontMetrics.size(0, headerOpt->text);
5009 + (headerOpt->text.isNull() ? 0 : margin) + textSize.
width() + margin);
5013 size.rwidth() +=
size.height() + margin;
5015 size.rheight() +=
size.width() + margin;
5023 if (
const auto *frameOpt = qstyleoption_cast<const QStyleOptionFrame *>(
opt))
5024 size +=
QSize(2 * frameOpt->lineWidth, 2 * frameOpt->lineWidth);
5026#if QT_CONFIG(groupbox)
5028 if (
const auto *groupBoxOpt = qstyleoption_cast<const QStyleOptionGroupBox *>(
opt))
5033 if (
const auto *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(
opt)) {
5037 width += buttonSize + 1;
5039 width += buttonSize + 1;
5041 width += buttonSize + 1;
5045 size =
QSize(1 + 3 * (buttonSize + 1), buttonSize);
5048#if QT_CONFIG(itemviews)
5050 if (
const auto *viewItemOpt = qstyleoption_cast<const QStyleOptionViewItem *>(
opt)) {
5051 QRect decorationRect, displayRect, checkRect;
5052 d->viewItemLayout(viewItemOpt, &checkRect, &decorationRect, &displayRect,
true);
5053 size = (decorationRect|displayRect|checkRect).
size();
5055 size.rheight() += 2;
5061#if QT_CONFIG(spinbox)
5063 if (
const auto *spinBoxOpt = qstyleoption_cast<const QStyleOptionSpinBox *>(
opt)) {
5071 size +=
QSize(buttonWidth + 2 * frameWidth, 2 * frameWidth);
5110#if QT_CONFIG(dialogbuttonbox)
5115#if QT_CONFIG(groupbox)
5175#if defined(Q_OS_DARWIN)
5256#if QT_CONFIG(rubberband)
5258 if (
const QStyleOptionRubberBand *rbOpt = qstyleoption_cast<const QStyleOptionRubberBand *>(
opt)) {
5305#if QT_CONFIG(dialogbuttonbox)
5332#if QT_CONFIG(tabwidget)
5346 vret->variant =
fmt;
5349#if QT_CONFIG(wizard)
5354#if QT_CONFIG(formlayout)
5374#if QT_CONFIG(tabbar)
5399#if QT_CONFIG(tooltip)
5410#if QT_CONFIG(treeview)
5411 if (qobject_cast<const QTreeView*>(
widget)) {
5422#if QT_CONFIG(itemviews)
5499#if QT_CONFIG(imageformat_xpm)
5500static QPixmap cachedPixmapFromXPM(
const char *
const *xpm)
5511static inline QPixmap titleBarMenuCachedPixmapFromXPM() {
return cachedPixmapFromXPM(
qt_menu_xpm); }
5514#ifndef QT_NO_IMAGEFORMAT_PNG
5517 return QStringLiteral(
":/qt-project.org/styles/commonstyle/images/cleartext-16.png");
5521#if defined(Q_OS_WIN) || QT_CONFIG(imageformat_png)
5522static QIcon clearTextIcon(
bool rtl)
5524 const QString directionalThemeName = rtl
5533#ifndef QT_NO_IMAGEFORMAT_PNG
5535 Q_ASSERT(!clearText16.size().isEmpty());
5538 Q_ASSERT(!clearText32.size().isEmpty());
5540 clearText32.setDevicePixelRatio(2);
5552#ifdef QT_NO_IMAGEFORMAT_PNG
5695 if (!fileIcon.
isNull()) {
5714 pixmap = clearTextIcon(rtl).pixmap(16);
5725#ifndef QT_NO_IMAGEFORMAT_XPM
5740#ifndef QT_NO_IMAGEFORMAT_PNG
5751 return QPixmap(
":/qt-project.org/styles/commonstyle/images/left-16.png"_L1);
5753 return QPixmap(
":/qt-project.org/styles/commonstyle/images/right-16.png"_L1);
5755 return QPixmap(
":/qt-project.org/styles/commonstyle/images/up-16.png"_L1);
5757 return QPixmap(
":/qt-project.org/styles/commonstyle/images/down-16.png"_L1);
5761 return QPixmap(
":/qt-project.org/styles/commonstyle/images/newdirectory-16.png"_L1);
5763 return QPixmap(
":/qt-project.org/styles/commonstyle/images/viewdetailed-16.png"_L1);
5765 return QPixmap(
":/qt-project.org/styles/commonstyle/images/fileinfo-16.png"_L1);
5767 return QPixmap(
":/qt-project.org/styles/commonstyle/images/filecontents-16.png"_L1);
5769 return QPixmap(
":/qt-project.org/styles/commonstyle/images/viewlist-16.png"_L1);
5773 return QPixmap(
":/qt-project.org/styles/commonstyle/images/harddrive-16.png"_L1);
5775 return QPixmap(
":/qt-project.org/styles/commonstyle/images/trash-16.png"_L1);
5777 return QPixmap(
":/qt-project.org/styles/commonstyle/images/floppy-16.png"_L1);
5779 return QPixmap(
":/qt-project.org/styles/commonstyle/images/networkdrive-16.png"_L1);
5781 return QPixmap(
":/qt-project.org/styles/commonstyle/images/desktop-16.png"_L1);
5783 return QPixmap(
":/qt-project.org/styles/commonstyle/images/computer-16.png"_L1);
5785 return QPixmap(
":/qt-project.org/styles/commonstyle/images/cdr-16.png"_L1);
5787 return QPixmap(
":/qt-project.org/styles/commonstyle/images/dvd-16.png"_L1);
5790 return QPixmap(
":/qt-project.org/styles/commonstyle/images/diropen-16.png"_L1);
5793 return QPixmap(
":/qt-project.org/styles/commonstyle/images/dirclosed-16.png"_L1);
5795 return QPixmap(
":/qt-project.org/styles/commonstyle/images/dirlink-16.png"_L1);
5797 return QPixmap(
":/qt-project.org/styles/commonstyle/images/file-16.png"_L1);
5799 return QPixmap(
":/qt-project.org/styles/commonstyle/images/filelink-16.png"_L1);
5801 return QPixmap(
":/qt-project.org/styles/commonstyle/images/standardbutton-ok-16.png"_L1);
5803 return QPixmap(
":/qt-project.org/styles/commonstyle/images/standardbutton-cancel-16.png"_L1);
5805 return QPixmap(
":/qt-project.org/styles/commonstyle/images/standardbutton-help-16.png"_L1);
5807 return QPixmap(
":/qt-project.org/styles/commonstyle/images/standardbutton-open-16.png"_L1);
5809 return QPixmap(
":/qt-project.org/styles/commonstyle/images/standardbutton-save-16.png"_L1);
5811 return QPixmap(
":/qt-project.org/styles/commonstyle/images/standardbutton-close-16.png"_L1);
5813 return QPixmap(
":/qt-project.org/styles/commonstyle/images/standardbutton-apply-16.png"_L1);
5815 return QPixmap(
":/qt-project.org/styles/commonstyle/images/standardbutton-clear-16.png"_L1);
5817 return QPixmap(
":/qt-project.org/styles/commonstyle/images/standardbutton-delete-16.png"_L1);
5819 return QPixmap(
":/qt-project.org/styles/commonstyle/images/standardbutton-yes-16.png"_L1);
5821 return QPixmap(
":/qt-project.org/styles/commonstyle/images/standardbutton-no-16.png"_L1);
5823 return QPixmap(
":/qt-project.org/styles/commonstyle/images/refresh-24.png"_L1);
5825 return QPixmap(
":/qt-project.org/styles/commonstyle/images/stop-24.png"_L1);
5827 return QPixmap(
":/qt-project.org/styles/commonstyle/images/media-play-32.png"_L1);
5829 return QPixmap(
":/qt-project.org/styles/commonstyle/images/media-pause-32.png"_L1);
5831 return QPixmap(
":/qt-project.org/styles/commonstyle/images/media-stop-32.png"_L1);
5833 return QPixmap(
":/qt-project.org/styles/commonstyle/images/media-seek-forward-32.png"_L1);
5835 return QPixmap(
":/qt-project.org/styles/commonstyle/images/media-seek-backward-32.png"_L1);
5837 return QPixmap(
":/qt-project.org/styles/commonstyle/images/media-skip-forward-32.png"_L1);
5839 return QPixmap(
":/qt-project.org/styles/commonstyle/images/media-skip-backward-32.png"_L1);
5841 return QPixmap(
":/qt-project.org/styles/commonstyle/images/media-volume-16.png"_L1);
5843 return QPixmap(
":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png"_L1);
5847 return QPixmap(
":/qt-project.org/styles/commonstyle/images/standardbutton-closetab-16.png"_L1);
5853#ifndef QT_NO_IMAGEFORMAT_XPM
5856 return titleBarMenuCachedPixmapFromXPM();
5886#if !QT_CONFIG(imageformat_png) && !QT_CONFIG(imageformat_xpm) && !QT_CONFIG(imageformat_png)
5893#if QT_CONFIG(imageformat_png)
5894static inline QString iconResourcePrefix() {
return QStringLiteral(
":/qt-project.org/styles/commonstyle/images/"); }
5903static const int dockTitleIconSizes[] = {10, 16, 20, 32, 48, 64};
5904static const int titleBarSizes[] = {16, 32, 48};
5905static const int toolBarExtHSizes[] = {8, 16, 32};
5906static const int toolBarExtVSizes[] = {5, 10, 20};
5952 pixmap = theme->standardPixmap(spOn, pixSize);
5958 icon = clearTextIcon(rtl);
6109 if (!linkIcon.
isNull()) {
6112 for (
int i = 0 ;
i <
sizes.size() ; ++
i) {
6126 if (!linkIcon.
isNull()) {
6129 for (
int i = 0 ;
i <
sizes.size() ; ++
i) {
6148#if defined(Q_OS_MAC)
6166 ?
QStringLiteral(
":/qt-project.org/styles/macstyle/images/closedock-")
6167 :
QStringLiteral(
":/qt-project.org/styles/macstyle/images/dockdock-");
6168 for (
const auto size : dockTitleIconSizes) {
6174 return titleBarIcon;
6221#ifndef QT_NO_IMAGEFORMAT_PNG
6223 addIconFiles(iconResourcePrefix() +
QStringLiteral(
"titlebar-min-"),
6224 titleBarSizes,
sizeof(titleBarSizes)/
sizeof(titleBarSizes[0]),
icon);
6227 addIconFiles(iconResourcePrefix() +
QStringLiteral(
"titlebar-max-"),
6228 titleBarSizes,
sizeof(titleBarSizes)/
sizeof(titleBarSizes[0]),
icon);
6231 addIconFiles(iconResourcePrefix() +
QStringLiteral(
"titlebar-shade-"),
6232 titleBarSizes,
sizeof(titleBarSizes)/
sizeof(titleBarSizes[0]),
icon);
6236 addIconFiles(iconResourcePrefix() +
QStringLiteral(
"titlebar-unshade-"),
6237 titleBarSizes,
sizeof(titleBarSizes)/
sizeof(titleBarSizes[0]),
icon);
6240 addIconFiles(iconResourcePrefix() +
QStringLiteral(
"titlebar-contexthelp-"),
6241 titleBarSizes,
sizeof(titleBarSizes)/
sizeof(titleBarSizes[0]),
icon);
6244 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/newdirectory-16.png"_L1,
QSize(16, 16));
6245 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/newdirectory-32.png"_L1,
QSize(32, 32));
6246 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/newdirectory-128.png"_L1,
QSize(128, 128));
6253 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/viewdetailed-16.png"_L1,
QSize(16, 16));
6254 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/viewdetailed-32.png"_L1,
QSize(32, 32));
6255 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/viewdetailed-128.png"_L1,
QSize(128, 128));
6258 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/fileinfo-16.png"_L1,
QSize(16, 16));
6259 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/fileinfo-32.png"_L1,
QSize(32, 32));
6260 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/fileinfo-128.png"_L1,
QSize(128, 128));
6263 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/filecontents-16.png"_L1,
QSize(16, 16));
6264 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/filecontents-32.png"_L1,
QSize(32, 32));
6265 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/filecontents-128.png"_L1,
QSize(128, 128));
6268 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/viewlist-16.png"_L1,
QSize(16, 16));
6269 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/viewlist-32.png"_L1,
QSize(32, 32));
6270 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/viewlist-128.png"_L1,
QSize(128, 128));
6273 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-ok-16.png"_L1,
QSize(16, 16));
6274 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-ok-32.png"_L1,
QSize(32, 32));
6275 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-ok-128.png"_L1,
QSize(128, 128));
6278 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-cancel-16.png"_L1,
QSize(16, 16));
6279 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-cancel-32.png"_L1,
QSize(32, 32));
6280 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-cancel-128.png"_L1,
QSize(128, 128));
6283 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-help-16.png"_L1,
QSize(16, 16));
6284 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-help-32.png"_L1,
QSize(32, 32));
6285 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-help-128.png"_L1,
QSize(128, 128));
6288 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-open-16.png"_L1,
QSize(16, 16));
6289 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-open-32.png"_L1,
QSize(32, 32));
6290 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-open-128.png"_L1,
QSize(128, 128));
6293 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-save-16.png"_L1,
QSize(16, 16));
6294 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-save-32.png"_L1,
QSize(32, 32));
6295 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-save-128.png"_L1,
QSize(128, 128));
6298 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-close-16.png"_L1,
QSize(16, 16));
6299 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-close-32.png"_L1,
QSize(32, 32));
6300 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-close-128.png"_L1,
QSize(128, 128));
6303 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-apply-16.png"_L1,
QSize(16, 16));
6304 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-apply-32.png"_L1,
QSize(32, 32));
6305 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-apply-128.png"_L1,
QSize(128, 128));
6308 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-clear-16.png"_L1,
QSize(16, 16));
6309 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-clear-32.png"_L1,
QSize(32, 32));
6310 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-clear-128.png"_L1,
QSize(128, 128));
6313 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-delete-16.png"_L1,
QSize(16, 16));
6314 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-delete-32.png"_L1,
QSize(32, 32));
6315 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-delete-128.png"_L1,
QSize(128, 128));
6318 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-yes-16.png"_L1,
QSize(16, 16));
6319 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-yes-32.png"_L1,
QSize(32, 32));
6320 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-yes-128.png"_L1,
QSize(128, 128));
6323 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-no-16.png"_L1,
QSize(16, 16));
6324 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-no-32.png"_L1,
QSize(32, 32));
6325 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/standardbutton-no-128.png"_L1,
QSize(128, 128));
6336 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/left-16.png"_L1,
QSize(16, 16));
6337 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/left-32.png"_L1,
QSize(32, 32));
6338 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/left-128.png"_L1,
QSize(128, 128));
6341 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/right-16.png"_L1,
QSize(16, 16));
6342 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/right-32.png"_L1,
QSize(32, 32));
6343 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/right-128.png"_L1,
QSize(128, 128));
6346 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/up-16.png"_L1,
QSize(16, 16));
6347 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/up-32.png"_L1,
QSize(32, 32));
6348 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/up-128.png"_L1,
QSize(128, 128));
6351 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/down-16.png"_L1,
QSize(16, 16));
6352 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/down-32.png"_L1,
QSize(32, 32));
6353 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/down-128.png"_L1,
QSize(128, 128));
6357 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/dirclosed-16.png"_L1,
6359 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/diropen-16.png"_L1,
6361 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/dirclosed-32.png"_L1,
6363 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/diropen-32.png"_L1,
6365 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/dirclosed-128.png"_L1,
6367 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/diropen-128.png"_L1,
6371 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/cdr-16.png"_L1,
QSize(16, 16));
6372 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/cdr-32.png"_L1,
QSize(32, 32));
6373 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/cdr-128.png"_L1,
QSize(128, 128));
6376 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/dvd-16.png"_L1,
QSize(16, 16));
6377 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/dvd-32.png"_L1,
QSize(32, 32));
6378 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/dvd-128.png"_L1,
QSize(128, 128));
6381 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/file-16.png"_L1,
QSize(16, 16));
6382 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/file-32.png"_L1,
QSize(32, 32));
6383 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/file-128.png"_L1,
QSize(128, 128));
6386 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/filelink-16.png"_L1,
QSize(16, 16));
6387 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/filelink-32.png"_L1,
QSize(32, 32));
6388 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/filelink-128.png"_L1,
QSize(128, 128));
6391 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/trash-16.png"_L1,
QSize(16, 16));
6392 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/trash-32.png"_L1,
QSize(32, 32));
6393 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/trash-128.png"_L1,
QSize(128, 128));
6396 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/refresh-24.png"_L1,
QSize(24, 24));
6397 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/refresh-32.png"_L1,
QSize(32, 32));
6400 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/stop-24.png"_L1,
QSize(24, 24));
6401 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/stop-32.png"_L1,
QSize(32, 32));
6404 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/media-play-16.png"_L1,
QSize(16, 16));
6405 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/media-play-32.png"_L1,
QSize(32, 32));
6408 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/media-pause-16.png"_L1,
QSize(16, 16));
6409 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/media-pause-32.png"_L1,
QSize(32, 32));
6412 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/media-stop-16.png"_L1,
QSize(16, 16));
6413 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/media-stop-32.png"_L1,
QSize(32, 32));
6416 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/media-seek-forward-16.png"_L1,
QSize(16, 16));
6417 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/media-seek-forward-32.png"_L1,
QSize(32, 32));
6420 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/media-seek-backward-16.png"_L1,
QSize(16, 16));
6421 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/media-seek-backward-32.png"_L1,
QSize(32, 32));
6424 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/media-skip-forward-16.png"_L1,
QSize(16, 16));
6425 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/media-skip-forward-32.png"_L1,
QSize(32, 32));
6428 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/media-skip-backward-16.png"_L1,
QSize(16, 16));
6429 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/media-skip-backward-32.png"_L1,
QSize(32, 32));
6432 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/media-volume-16.png"_L1,
QSize(16, 16));
6435 icon.
addFile(
":/qt-project.org/styles/commonstyle/images/media-volume-muted-16.png"_L1,
QSize(16, 16));
6438 addIconFiles(iconResourcePrefix() +
QStringLiteral(
"closedock-"),
6439 dockTitleIconSizes,
sizeof(dockTitleIconSizes)/
sizeof(dockTitleIconSizes[0]),
icon);
6442# ifndef QT_NO_IMAGEFORMAT_XPM
6445 icon.
addFile(
":/qt-project.org/qmessagebox/images/qtlogo-64.png"_L1);
6448 addIconFiles(iconResourcePrefix() +
QStringLiteral(
"normalizedockup-"),
6449 dockTitleIconSizes,
sizeof(dockTitleIconSizes)/
sizeof(dockTitleIconSizes[0]),
icon);
6455 addIconFiles(prefix, toolBarExtHSizes,
sizeof(toolBarExtHSizes)/
sizeof(toolBarExtHSizes[0]),
icon);
6459 addIconFiles(iconResourcePrefix() +
QStringLiteral(
"toolbar-ext-v-"),
6460 toolBarExtVSizes,
sizeof(toolBarExtVSizes)/
sizeof(toolBarExtVSizes[0]),
icon);
6463 icon.
addFile(iconResourcePrefix() + u
"standardbutton-closetab-16.png",
QSize(16, 16),
6465 icon.
addFile(iconResourcePrefix() + u
"standardbutton-closetab-32.png",
QSize(32, 32),
6467 icon.
addFile(iconResourcePrefix() + u
"standardbutton-closetab-down-16.png",
QSize(16, 16),
6469 icon.
addFile(iconResourcePrefix() + u
"standardbutton-closetab-down-32.png",
QSize(32, 32),
6471 icon.
addFile(iconResourcePrefix() + u
"standardbutton-closetab-hover-16.png",
QSize(16, 16),
6473 icon.
addFile(iconResourcePrefix() + u
"standardbutton-closetab-hover-32.png",
QSize(32, 32),
6487 return (77 *
r + 150 *
g + 28 *
b) / 255;
6503 uchar reds[256], greens[256], blues[256];
6504 for (
int i=0;
i<128; ++
i) {
6509 for (
int i=0;
i<128; ++
i) {
6516 const int factor = 191;
6524 intensity =
qMin(255, intensity + 91);
6525 else if (intensity <= 128)
6531 QRgb pixel = *scanLine;
6535 *scanLine =
qRgba(reds[ci], greens[ci], blues[ci],
qAlpha(pixel));
6545 color.setAlphaF(0.3f);
6607 d->tabBarcloseButtonIcon =
QIcon();
6614#include "moc_qcommonstyle.cpp"
void stop()
Stops the animation.
void start(QAbstractAnimation::DeletionPolicy policy=KeepWhenStopped)
Starts the animation.
The QApplication class manages the GUI application's control flow and main settings.
const QColor & color() const
Returns the brush color.
constexpr char16_t unicode() const noexcept
Returns the numeric Unicode value of the QChar.
The QColor class provides colors based on RGB, HSV or CMYK values.
QRgb rgba() const noexcept
Returns the RGB value of the color, including its alpha.
int red() const noexcept
Returns the red 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 getHsv(int *h, int *s, int *v, int *a=nullptr) const
Sets the contents pointed to by h, s, v, and a, to the hue, saturation, value, and alpha-channel (tra...
bool isValid() const noexcept
Returns true if the color is valid; otherwise returns false.
QString calculateElidedText(const QString &text, const QTextOption &textOption, const QFont &font, const QRect &textRect, const Qt::Alignment valign, Qt::TextElideMode textElideMode, int flags, bool lastVisibleLineShouldBeElided, QPointF *paintStartPosition) const
The QCommonStyle class encapsulates the common Look and Feel of a GUI.
~QCommonStyle()
Destroys the style.
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
QCommonStyle()
Constructs a QCommonStyle.
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 layoutSpacing(QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option=nullptr, const QWidget *widget=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
\reentrant \inmodule QtGui
int height() const
Returns the height of the font.
QRect boundingRect(QChar) const
Returns the rectangle that is covered by ink if character ch were to be drawn at the origin of the co...
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{...
int midLineWidth
the width of the mid-line
int lineWidth
the line width
void setColorAt(qreal pos, const QColor &color)
Creates a stop point at the given position with the given color.
static QPlatformTheme * platformTheme()
static bool isRightToLeft()
Returns true if the application's layout direction is Qt::RightToLeft; otherwise returns false.
static bool desktopSettingsAware()
Returns true if Qt is set to use the system's standard colors, fonts, etc.; otherwise returns false.
QIcon windowIcon
the default window icon
The QIcon class provides scalable icons in different modes and states.
static bool hasThemeIcon(const QString &name)
static QString themeName()
void addPixmap(const QPixmap &pixmap, Mode mode=Normal, State state=Off)
Adds pixmap to the icon, as a specialization for mode and state.
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
qint64 cacheKey() const
Returns a number that identifies the contents of this QIcon object.
void addFile(const QString &fileName, const QSize &size=QSize(), Mode mode=Normal, State state=Off)
Adds an image from the file with the given fileName to the icon, as a specialization for size,...
State
This enum describes the state for which a pixmap is intended to be used.
QSize actualSize(const QSize &size, Mode mode=Normal, State state=Off) const
Returns the actual size of the icon for the requested size, mode, and state.
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.
static QIcon fromTheme(const QString &name)
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.
int width() const
Returns the width of the image.
int height() const
Returns the height of the image.
@ Format_ARGB32_Premultiplied
QImage mirrored(bool horizontally=false, bool vertically=true) const &
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const &
T value(qsizetype i) const
constexpr int bottom() const noexcept
Returns the bottom margin.
constexpr int left() const noexcept
Returns the left margin.
constexpr int right() const noexcept
Returns the right margin.
constexpr int top() const noexcept
Returns the top margin.
QObject * parent() const
Returns a pointer to the parent object.
QObject * sender() const
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; othe...
qreal devicePixelRatio() const
void moveTo(const QPointF &p)
Moves the current point to the given point, implicitly starting a new subpath and closing the previou...
void lineTo(const QPointF &p)
Adds a straight line from the current position to the given endPoint.
The QPainter class performs low-level painting on widgets and other paint devices.
void setBackground(const QBrush &bg)
Sets the background brush of the painter to the given brush.
void drawRect(const QRectF &rect)
Draws the current rectangle with the current pen and brush.
void setPen(const QColor &color)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void setBackgroundMode(Qt::BGMode mode)
Sets the background mode of the painter to the given mode.
void setCompositionMode(CompositionMode mode)
Sets the composition mode to the given mode.
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 setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
@ CompositionMode_SourceAtop
void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule=Qt::OddEvenFill)
Draws the polygon defined by the first pointCount points in the array points using the current pen an...
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.
The QPalette class contains color groups for each widget state.
const QBrush & highlight() const
Returns the highlight brush of the current color group.
const QBrush & button() const
Returns the button brush of the current color group.
const QBrush & text() const
Returns the text foreground brush of the current color group.
const QBrush & toolTipBase() const
const QBrush & windowText() const
Returns the window text (general foreground) brush of the current color group.
const QBrush & dark() const
Returns the dark 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 & toolTipText() const
const QBrush & light() const
Returns the light brush of the current color group.
void setCurrentColorGroup(ColorGroup cg)
Set the palette's current color group to cg.
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
const QBrush & mid() const
Returns the mid 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.
ColorGroup
\value Disabled \value Active \value Inactive \value Normal synonym for Active
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 & window() const
Returns the window (general background) brush of the current color group.
const QBrush & base() const
Returns the base brush of the current color group.
const QBrush & buttonText() const
Returns the button text foreground brush of the current color group.
const QBrush & highlightedText() const
Returns the highlighted text brush of the current color group.
void setWidth(int width)
Sets the pen width to the given width in pixels with integer precision.
void setColor(const QColor &color)
Sets the color of this pen's brush to the given color.
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...
int height() const
Returns the height of the pixmap.
QImage toImage() const
Converts the pixmap to a QImage.
QSize size() const
Returns the size of the pixmap.
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
int width() const
Returns the width of the pixmap.
qreal devicePixelRatio() const
Returns the device pixel ratio for the pixmap.
static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
Converts the given image to a pixmap using the specified flags to control the conversion.
\inmodule QtCore\reentrant
constexpr qreal & ry() noexcept
Returns a reference to the y coordinate of this point.
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
The QPolygon class provides a list of points using integer precision.
\inmodule QtCore\reentrant
constexpr QSizeF size() const noexcept
Returns the size of the rectangle.
\inmodule QtCore\reentrant
constexpr bool isEmpty() const noexcept
Returns true if the rectangle is empty, otherwise returns false.
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 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 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 void setRect(int x, int y, int w, int h) noexcept
Sets the coordinates of the rectangle's top-left corner to ({x}, {y}), and its size to the given widt...
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 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 void setCoords(int x1, int y1, int x2, int y2) noexcept
Sets the coordinates of the rectangle's top-left corner to (x1, y1), and the coordinates of its botto...
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 QRect translated(int dx, int dy) const noexcept
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis,...
QRect united(const QRect &other) const noexcept
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 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.
constexpr QSize toSize() const noexcept
Returns an integer based copy of this size.
constexpr QSize boundedTo(const QSize &) const noexcept
Returns a size holding the minimum width and height of this size and the given otherSize.
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 QSize transposed() const noexcept
constexpr int & rwidth() noexcept
Returns a reference to the width.
constexpr void setHeight(int h) noexcept
Sets the height to the given height.
\macro QT_RESTRICTED_CAST_FROM_ASCII
QString & replace(qsizetype i, qsizetype len, QChar after)
void chop(qsizetype n)
Removes n characters from the end of the string.
bool isNull() const
Returns true if this string is null; otherwise returns false.
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 endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
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...
static QString static QString asprintf(const char *format,...) Q_ATTRIBUTE_FORMAT_PRINTF(1
The QStyleHintReturnMask class provides style hints that return a QRegion.
The QStyleHintReturnVariant class provides style hints that return a QVariant.
\variable QStyleOptionGraphicsItem::exposedRect
\variable QStyleOptionToolButton::features
\variable QStyleOptionMenuItem::menuItemType
QStyle::SubControls subControls
QStyle::SubControls activeSubControls
\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
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI.
@ State_KeyboardFocusChange
ContentsType
This enum describes the available contents types.
virtual void polish(QWidget *widget)
Initializes the appearance of the given widget.
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 QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget=nullptr) const =0
Returns the rectangle containing the specified subControl of the given complex control (with the styl...
static Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment)
Transforms an alignment of Qt::AlignLeft or Qt::AlignRight without Qt::AlignAbsolute into Qt::AlignLe...
virtual QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
StyleHint
This enum describes the available style hints.
@ SH_TitleBar_ShowToolTipsOnButtons
@ SH_ComboBox_ListMouseTracking
@ SH_GroupBox_TextLabelColor
@ SH_TabBar_CloseButtonPosition
@ SH_Slider_PageSetButtons
@ SH_ScrollView_FrameOnlyAroundContents
@ SH_Splitter_OpaqueResize
@ SH_MainWindow_SpaceBelowMenuBar
@ SH_ProgressDialog_CenterCancelButton
@ SH_SpinBox_AnimateButton
@ SH_Menu_SubMenuUniDirectionFailCount
@ SH_TextControl_FocusIndicatorTextCharFormat
@ SH_MessageBox_UseBorderForButtonSpacing
@ SH_SpinBox_ClickAutoRepeatRate
@ SH_ItemView_PaintAlternatingRowColorsForEmptyArea
@ SH_ComboBox_UseNativePopup
@ SH_ItemView_ChangeHighlightOnFocus
@ SH_SpinBox_KeyPressAutoRepeatRate
@ SH_ItemView_MovementWithoutUpdatingSelection
@ SH_MenuBar_AltKeyNavigation
@ SH_Menu_SubMenuUniDirection
@ SH_ScrollBar_RollBetweenButtons
@ SH_TabBar_AllowWheelScrolling
@ SH_SpinControls_DisableOnBounds
@ SH_ScrollBar_MiddleClickAbsolutePosition
@ SH_Menu_FlashTriggeredItem
@ SH_Menu_SubMenuPopupDelay
@ SH_ItemView_ArrowKeysNavigateIntoChildren
@ SH_Slider_AbsoluteSetButtons
@ SH_Widget_Animation_Duration
@ SH_Menu_SubMenuResetWhenReenteringParent
@ SH_ComboBox_PopupFrameStyle
@ SH_Slider_SloppyKeyEvents
@ SH_TabWidget_DefaultTabPosition
@ SH_TabBar_ChangeCurrentDelay
@ SH_Header_ArrowAlignment
@ SH_ToolBox_SelectedPageTitleBold
@ SH_LineEdit_PasswordMaskDelay
@ SH_SpinBox_SelectOnStep
@ SH_TabBar_PreferNoArrows
@ SH_Menu_SupportsSections
@ SH_Menu_SubMenuSloppySelectOtherActions
@ SH_FormLayoutWrapPolicy
@ SH_Widget_ShareActivation
@ SH_ComboBox_LayoutDirection
@ SH_DialogButtons_DefaultButton
@ SH_ComboBox_AllowWheelScrolling
@ SH_ToolButton_PopupDelay
@ SH_Menu_AllowActiveAndDisabled
@ SH_SpinBox_StepModifier
@ SH_TabBar_SelectMouseType
@ SH_Menu_FillScreenWithScroll
@ SH_Table_AlwaysDrawLeftTopGridLines
@ SH_FontDialog_SelectAssociatedText
@ SH_ToolTipLabel_Opacity
@ SH_ScrollBar_LeftClickAbsolutePosition
@ SH_DialogButtonBox_ButtonsHaveIcons
@ SH_MenuBar_MouseTracking
@ SH_FormLayoutFieldGrowthPolicy
@ SH_SpinBox_ClickAutoRepeatThreshold
@ SH_ScrollBar_ContextMenu
@ SH_FormLayoutFormAlignment
@ SH_Menu_SubMenuDontStartSloppyOnLeave
@ SH_MessageBox_CenterButtons
@ SH_TitleBar_ModifyNotification
@ SH_Slider_StopMouseOverSlider
@ SH_DrawMenuBarSeparator
@ SH_RequestSoftwareInputPanel
@ SH_LineEdit_PasswordCharacter
@ SH_SpinBox_ButtonsInsideFrame
@ SH_ItemView_DrawDelegateFrame
@ SH_GroupBox_TextLabelVerticalAlignment
@ SH_ScrollBar_ScrollWhenPointerLeavesControl
@ SH_ToolTip_FallAsleepDelay
@ SH_PrintDialog_RightAlignButtons
@ SH_BlinkCursorWhenTextSelected
@ SH_ListViewExpand_SelectMouseType
@ SH_ItemView_EllipsisLocation
@ SH_ItemView_ActivateItemOnSingleClick
@ SH_MessageBox_TextInteractionFlags
@ SH_RichText_FullWidthSelection
@ SH_FormLayoutLabelAlignment
@ SH_ItemView_ShowDecorationSelected
@ SH_DockWidget_ButtonsHaveFrame
@ SH_Menu_SpaceActivatesItem
@ SH_FocusFrame_AboveWidget
@ SH_ProgressDialog_TextLabelAlignment
@ SH_Menu_SubMenuSloppyCloseTimeout
@ SH_Workspace_FillSpaceOnMaximize
virtual int styleHint(StyleHint stylehint, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr, QStyleHintReturn *returnData=nullptr) const =0
Returns an integer representing the specified style hint for the given widget described by the provid...
virtual ~QStyle()
Destroys the style object.
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,...
virtual QRect itemTextRect(const QFontMetrics &fm, const QRect &r, int flags, bool enabled, const QString &text) const
Returns the area within the given rectangle in which to draw the provided text according to the speci...
StandardPixmap
This enum describes the available standard pixmaps.
@ SP_DockWidgetCloseButton
@ SP_TitleBarContextHelpButton
@ SP_TitleBarNormalButton
@ SP_FileDialogDetailedView
@ SP_MessageBoxInformation
@ SP_FileDialogContentsView
@ SP_TitleBarUnshadeButton
@ SP_ToolBarVerticalExtensionButton
@ SP_ToolBarHorizontalExtensionButton
ControlElement
This enum represents a control element.
static QRect alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment, const QSize &size, const QRect &rectangle)
Returns a new rectangle of the specified size that is aligned to the given rectangle according to the...
virtual QRect subElementRect(SubElement subElement, const QStyleOption *option, const QWidget *widget=nullptr) const =0
Returns the sub-area for the given element as described in the provided style option.
static int sliderPositionFromValue(int min, int max, int val, int space, bool upsideDown=false)
Converts the given logicalValue to a pixel position.
static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, const QRect &logicalRect)
Returns the given logicalRectangle converted to screen coordinates based on the specified direction.
PixelMetric
This enum describes the various available pixel metrics.
@ PM_TabBar_ScrollButtonOverlap
@ PM_TitleBarButtonIconSize
@ PM_DockWidgetFrameWidth
@ PM_DockWidgetTitleMargin
@ PM_ExclusiveIndicatorHeight
@ PM_ButtonShiftHorizontal
@ PM_MdiSubWindowFrameWidth
@ PM_DockWidgetTitleBarButtonMargin
@ PM_ToolBarSeparatorExtent
@ PM_HeaderDefaultSectionSizeHorizontal
@ PM_ScrollView_ScrollBarOverlap
@ PM_DockWidgetSeparatorExtent
@ PM_TabCloseIndicatorWidth
@ PM_CheckBoxLabelSpacing
@ PM_LayoutVerticalSpacing
@ PM_TabBarTabShiftVertical
@ PM_LayoutHorizontalSpacing
@ PM_SliderTickmarkOffset
@ PM_ButtonDefaultIndicator
@ PM_SliderControlThickness
@ PM_SliderSpaceAvailable
@ PM_MenuDesktopFrameWidth
@ PM_ProgressBarChunkWidth
@ PM_DialogButtonsSeparator
@ PM_TabBarScrollButtonWidth
@ PM_DockWidgetHandleExtent
@ PM_ToolBarExtensionExtent
@ PM_TabCloseIndicatorHeight
@ PM_HeaderDefaultSectionSizeVertical
@ PM_DialogButtonsButtonHeight
@ PM_DialogButtonsButtonWidth
@ PM_RadioButtonLabelSpacing
@ PM_TabBarTabShiftHorizontal
@ PM_ScrollView_ScrollBarSpacing
@ PM_MdiSubWindowMinimizedWidth
@ PM_ExclusiveIndicatorWidth
@ PM_ToolTipLabelFrameWidth
ComplexControl
This enum describes the available complex controls.
PrimitiveElement
This enum describes the various primitive elements.
@ PE_IndicatorToolBarHandle
@ PE_IndicatorHeaderArrow
@ PE_PanelScrollAreaCorner
@ PE_IndicatorButtonDropDown
@ PE_IndicatorProgressChunk
@ PE_IndicatorColumnViewArrow
@ PE_IndicatorItemViewItemDrop
@ PE_IndicatorRadioButton
@ PE_IndicatorToolBarSeparator
@ PE_IndicatorMenuCheckMark
@ PE_IndicatorItemViewItemCheck
virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=nullptr) const =0
Draws the given element with the provided painter with the style options specified by option.
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
Returns the value of the given pixel metric.
virtual void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole) const
Draws the given text in the specified rectangle using the provided painter and palette.
virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr) const =0
virtual void unpolish(QWidget *widget)
Uninitialize the given {widget}'s appearance.
SubElement
This enum represents a sub-area of a widget.
@ SE_TreeViewDisclosureItem
@ SE_TabBarTabRightButton
@ SE_ItemViewItemDecoration
@ SE_ItemViewItemFocusRect
@ SE_TabWidgetRightCorner
@ SE_ItemViewItemCheckIndicator
@ SE_RadioButtonFocusRect
@ SE_DockWidgetTitleBarText
@ SE_TabBarScrollRightButton
@ SE_TabBarScrollLeftButton
@ SE_DockWidgetFloatButton
@ SE_RadioButtonIndicator
@ SE_RadioButtonClickRect
@ SE_DockWidgetCloseButton
@ SE_TabWidgetTabContents
virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=nullptr) const =0
Draws the given primitive element with the provided painter using the style options specified by opti...
const QStyle * proxy() const
SubControl
This enum describes the available sub controls.
@ SC_TitleBarUnshadeButton
@ SC_TitleBarNormalButton
@ SC_ComboBoxListBoxPopup
@ SC_TitleBarContextHelpButton
QTextLine createLine()
Returns a new text line to be laid out if there is text to be inserted into the layout; otherwise ret...
void beginLayout()
Begins the layout process.
QString text() const
Returns the layout's text.
int lineCount() const
Returns the number of lines in this text layout.
QTextLine lineAt(int i) const
Returns the {i}-th line of text in this text layout.
void setTextOption(const QTextOption &option)
Sets the text option structure that controls the layout process to the given option.
void draw(QPainter *p, const QPointF &pos, const QList< FormatRange > &selections=QList< FormatRange >(), const QRectF &clip=QRectF()) const
Draws the whole layout on the painter p at the position specified by pos.
void endLayout()
Ends the layout process.
QRectF boundingRect() const
The smallest rectangle that contains all the lines in the layout.
qreal height() const
Returns the line's height.
bool isValid() const
Returns true if this text line is valid; otherwise returns false.
void setTextDirection(Qt::LayoutDirection aDirection)
Sets the direction of the text layout defined by the option to the given direction.
void setWrapMode(WrapMode wrap)
Sets the option's text wrap mode to the given mode.
void setAlignment(Qt::Alignment alignment)
Sets the option's text alignment to the specified alignment.
QChar toChar() const
Returns the variant as a QChar if the variant has userType() \l QMetaType::QChar, \l QMetaType::Int,...
int toInt(bool *ok=nullptr) const
Returns the variant as an int if the variant has userType() \l QMetaType::Int, \l QMetaType::Bool,...
QStyleOptionButton subopt
[2]
const QStyleOptionButton * btn
[3]
struct wl_display * display
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)
Combined button and popup list for selecting options.
@ WindowContextHelpButtonHint
@ WindowMaximizeButtonHint
@ WindowMinimizeButtonHint
@ ToolButtonTextUnderIcon
static jboolean copy(JNIEnv *, jobject)
static QString wrapText(const QString &names, int optionNameMaxWidth, const QString &description)
static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth, int maxHeight=-1, int *lastVisibleLine=nullptr)
static QString clearText16IconPath()
static uint qt_intensity(uint r, uint g, uint b)
static qreal qt_getDevicePixelRatio(const QWidget *widget)
static const char *const filedialog_end_xpm[]
static const char *const tb_extension_arrow_v_xpm[]
static const char *const information_xpm[]
static const char *const qt_help_xpm[]
static const char *const tb_extension_arrow_h_xpm[]
static const char *const qt_normalizeup_xpm[]
static const char *const qt_shade_xpm[]
static const char *const dock_widget_close_xpm[]
static const char *const qt_unshade_xpm[]
static const char *const qt_menu_xpm[]
static const char *const warning_xpm[]
static const char *const qt_minimize_xpm[]
static const char *const filedialog_start_xpm[]
static const char *const question_xpm[]
static const char *const critical_xpm[]
static const char *const qt_close_xpm[]
static const char *const qt_maximize_xpm[]
AudioChannelLayoutTag tag
static QString header(const QString &name)
void qDrawShadePanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken, int lineWidth, const QBrush *fill)
void qDrawShadeLine(QPainter *p, int x1, int y1, int x2, int y2, const QPalette &pal, bool sunken, int lineWidth, int midLineWidth)
void qDrawWinPanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken, const QBrush *fill)
void qDrawShadeRect(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken, int lineWidth, int midLineWidth, const QBrush *fill)
void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &c, int lineWidth, const QBrush *fill)
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
int qRound(qfloat16 d) noexcept
#define Q_LOGGING_CATEGORY(name,...)
#define qCWarning(category,...)
static QT_BEGIN_NAMESPACE const qreal Q_PI
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
static QString themeName()
GLint GLfloat GLfloat GLfloat v2
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLuint GLfloat GLfloat GLfloat x1
GLenum GLuint GLenum GLsizei length
GLdouble GLdouble GLdouble GLdouble top
GLenum GLenum GLsizei count
GLint GLenum GLsizei GLsizei GLsizei GLint border
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLuint GLsizei const GLchar * label
[43]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
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
GLuint GLsizei const GLuint const GLintptr const GLsizeiptr * sizes
GLdouble GLdouble GLdouble GLdouble q
GLsizei const GLchar *const * path
static const QRectF boundingRect(const QPointF *points, int pointCount)
static void stopAnimation(QObject *object)
static bool isWindow(QObject *object)
QT_BEGIN_NAMESPACE typedef unsigned int QRgb
constexpr int qGray(int r, int g, int b)
constexpr QRgb qRgba(int r, int g, int b, int a)
constexpr int qAlpha(QRgb rgb)
Int aligned(Int v, Int byteAlign)
static const struct TessellationWindingOrderTab cw[]
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
#define QStringLiteral(str)
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
constexpr bool verticalTabs(QTabBar::Shape shape) noexcept
QVideoFrameFormat::PixelFormat fmt
const char className[16]
[1]
obj metaObject() -> className()
QApplication app(argc, argv)
[0]