25inline QPoint JavaStyle::adjustScrollPoint(
const QPoint &point,
29 int adder =
add ? -1 : 1;
33 retPoint =
QPoint(point.
y() * adder, point.
x());
35 retPoint =
QPoint(point.
x(), point.
y() * adder);
41QPalette JavaStyle::standardPalette()
const
92 const QStyleOptionSlider *
option,
119 if (
option->state & State_Sunken)
122 fillColor =
option->palette.color(QPalette::Background);
127 int adjust =
option->state & State_Sunken ? 0 : 1;
140 const QPoint &point)
const
147 retPoint =
QPoint(point.
y(), point.
x());
159 case CE_ToolBoxTabShape: {
161 qstyleoption_cast<const QStyleOptionToolBox *>(
option);
170 int textWidth =
box->fontMetrics.horizontalAdvance(
box->text) + 20;
173 innerLine << (
box->rect.topLeft() +
QPoint(0, 1)) <<
174 (
box->rect.topLeft() +
QPoint(textWidth, 1)) <<
175 (
box->rect.bottomLeft() +
QPoint(textWidth + 15, -3)) <<
176 (
box->rect.bottomRight() +
QPoint(0, -3)) <<
177 box->rect.bottomRight() <<
178 box->rect.bottomLeft() <<
186 outerLine << (
box->rect.bottomRight() +
QPoint(0, -3)) <<
187 box->rect.bottomRight() <<
188 box->rect.bottomLeft() <<
189 box->rect.topLeft() <<
190 (
box->rect.topLeft() +
QPoint(textWidth, 0)) <<
191 (
box->rect.bottomLeft() +
QPoint(textWidth + 15, -4)) <<
192 (
box->rect.bottomRight() +
QPoint(0, -4));
201 case CE_DockWidgetTitle: {
203 qstyleoption_cast<const QStyleOptionDockWidget *>(
option);
212 r.top() + titleRect.
left() -
rect.left(),
224 gradient.setColorAt(1.0,
QColor(191, 212, 231));
226 gradient.setColorAt(0.0,
QColor(221, 232, 243));
246 case CE_RubberBand: {
255 case CE_HeaderSection: {
257 qstyleoption_cast<const QStyleOptionHeader *>(
option);
261 QPalette::Background));
280 header->rect.bottomRight());
298 header->rect.bottomRight());
300 header->rect.bottomLeft());
302 header->rect.bottomRight());
316 gradient.setColorAt(1.0,
QColor(221, 221, 221));
317 gradient.setColorAt(0.0,
QColor(241, 241, 241));
319 if (
option->state & State_Horizontal) {
329 case CE_ProgressBar: {
331 qstyleoption_cast<const QStyleOptionProgressBar *>(
option);
337 m.translate(
rect.height()-1, 0);
345 QRect grooveRect = subElementRect(SE_ProgressBarGroove, bar,
353 grooveBar.
rect = grooveRect;
357 QRect progressRect = subElementRect(SE_ProgressBarContents, bar,
360 progressRect =
QRect(progressRect.
left(), progressRect.
top(),
362 progressRect.
adjust(0, 0, 0, -1);
365 progressOpt.
rect = progressRect;
368 QRect labelRect = subElementRect(SE_ProgressBarLabel, bar,
widget);
374 subBar.
rect = labelRect;
380 case CE_ProgressBarGroove: {
390 case CE_ProgressBarContents: {
392 qstyleoption_cast<const QStyleOptionProgressBar *>(
option);
393 int progress = int((
double(bar->
progress) /
411 case CE_ProgressBarLabel: {
414 qstyleoption_cast<const QStyleOptionProgressBar *>(
option);
419 int progressIndicatorPos = int((
double(bar->
progress) /
428 if (progressIndicatorPos >= 0 &&
429 progressIndicatorPos <=
rect.width()) {
431 QPoint(progressIndicatorPos,
433 }
else if (progressIndicatorPos >
rect.width()) {
453 case CE_MenuBarEmptyArea: {
458 gradient.setColorAt(1.0,
QColor(223, 223, 223));
465 case CE_MenuBarItem: {
466 if (!(
option->state & State_Sunken)) {
468 option->rect.bottomLeft());
470 gradient.setColorAt(1.0,
QColor(223, 223, 223));
479 if (
option->state & State_Sunken) {
492 qstyleoption_cast<const QStyleOptionMenuItem *>(
option);
494 bool selected = menuItem->
state & State_Selected;
497 bool checked = menuItem->
checked;
528 option->rect.center().y() - 5, 10, 10);
533 if (
button.state & State_Sunken)
534 button.state ^= State_Sunken;
555 bool dis = !(menuItem->
state & State_Enabled);
556 bool act = menuItem->
state & State_Selected;
578 pixelMetric(PM_SmallIconSize),
mode);
579 int pixw =
pixmap.width();
580 int pixh =
pixmap.height();
582 int adjustedIcon = checkable ? 15 : 0;
583 QRect pmr(0, 0, pixw, pixh);
584 pmr.moveCenter(vCheckRect.
center());
586 if (checkable && checked)
588 adjustedIcon, pmr.top() + 1),
pixmap);
601 int tab = menuitem->tabWidth;
608 int xpos = menuitem->
rect.
x() + xm;
629 if (!styleHint(SH_UnderlineShortcut, menuitem,
widget))
639 p->drawText(vShortcutRect.
adjusted(1, 1, 1, 1),
644 p->drawText(vShortcutRect, text_flags,
s.mid(
t + 1));
653 p->drawText(vTextRect.
adjusted(1,1,1,1), text_flags,
657 p->drawText(vTextRect, text_flags,
s.left(
t));
680 case CE_MenuVMargin: {
683 case CE_MenuHMargin: {
690 case CE_ScrollBarAddPage: {
691 case CE_ScrollBarSubPage:
693 qstyleoption_cast<const QStyleOptionSlider *>(
option);
716 case CE_ScrollBarSubLine: {
718 qstyleoption_cast<const QStyleOptionSlider *>(
option);
719 int scrollBarExtent = pixelMetric(PM_ScrollBarExtent);
727 16, scrollBarExtent);
729 scrollBarSubLine.
top(), 16, scrollBarExtent);
732 scrollBarExtent, 16);
734 scrollBarSubLine.
bottom() - 15, scrollBarExtent, 16);
743 case CE_ScrollBarAddLine: {
745 qstyleoption_cast<const QStyleOptionSlider *>(
option);
750 case CE_ScrollBarSlider: {
752 qstyleoption_cast<const QStyleOptionSlider *>(
option);
759 g1 =
option->rect.topLeft();
760 g2 =
option->rect.bottomLeft();
762 g1 =
option->rect.topLeft();
763 g2 =
option->rect.topRight();
768 gradient.setColorAt(1.0,
QColor(188, 210, 230));
770 gradient.setColorAt(0.0,
QColor(223, 233, 243));
778 int sliderLength =
option->rect.height();
784 origin =
option->rect.bottomLeft();
786 origin =
option->rect.topLeft();
792 origin + adjustScrollHandlePoint(
798 origin + adjustScrollHandlePoint(
800 QPoint(13, 2 - drawPos)));
804 origin + adjustScrollHandlePoint(
806 QPoint(13, 4 - drawPos)));
811 QPoint(3, -(drawPos + 1))),
812 origin + adjustScrollHandlePoint(
814 QPoint(12, -(drawPos + 1))));
818 origin + adjustScrollHandlePoint(
820 QPoint(12, 1 - drawPos)));
824 origin + adjustScrollHandlePoint(
826 QPoint(12, 3 - drawPos)));
830 case CE_TabBarTabLabel: {
831 QStyleOptionTab
copy =
832 *qstyleoption_cast<const QStyleOptionTab *>(
option);
833 if (
copy.state & State_HasFocus)
834 copy.state ^= State_HasFocus;
840 case CE_TabBarTabShape: {
841 const QStyleOptionTab *tab =
842 qstyleoption_cast<const QStyleOptionTab *>(
option);
844 QPoint bottomLeft, bottomRight, topLeft, topRight;
846 if ((tab->position == QStyleOptionTab::Beginning) ||
847 (tab->position == QStyleOptionTab::OnlyOneTab)) {
850 myRect = myRect.
adjusted(2, 0, 0, 0);
852 myRect = myRect.
adjusted(0, 2, 0, 0);
856 switch (tab->shape) {
886 outerPath.
moveTo(bottomLeft + adjustTabPoint(
QPoint(0, -2),
888 outerPath.
lineTo(bottomLeft + adjustTabPoint(
QPoint(0, -14),
890 outerPath.
lineTo(topLeft + adjustTabPoint(
QPoint(6 , 0),
892 outerPath.
lineTo(topRight + adjustTabPoint(
QPoint(0, 0),
894 outerPath.
lineTo(bottomRight + adjustTabPoint(
QPoint(0, -2),
897 if (tab->state & State_Selected ||
898 tab->position == QStyleOptionTab::OnlyOneTab) {
902 innerPath.
lineTo(topRight + adjustTabPoint(
QPoint(-1, 2),
904 innerPath.
lineTo(bottomRight + adjustTabPoint(
QPoint(-1 , -2),
906 innerPath.
lineTo(bottomLeft + adjustTabPoint(
QPoint(2 , -2),
908 innerPath.
lineTo(bottomLeft + adjustTabPoint(
QPoint(2 , -14),
914 whitePath.
moveTo(bottomLeft + adjustTabPoint(
QPoint(1, -2),
916 whitePath.
lineTo(bottomLeft + adjustTabPoint(
QPoint(1, -14),
920 whitePath.
lineTo(topRight + adjustTabPoint(
QPoint(-1, 1),
928 QPoint(2, -3), tab->shape),
929 bottomRight + adjustTabPoint(
930 QPoint(-2, 0), tab->shape)));
935 if (
option->state & State_HasFocus) {
945 case CE_PushButtonLabel:
949 qstyleoption_cast<const QStyleOptionButton *>(
option)) {
963 if (
button->state & State_On)
1012inline QPoint JavaStyle::adjustTabPoint(
const QPoint &point,
1019 rPoint =
QPoint(point.
y(), point.
x());
1022 rPoint =
QPoint(point.
x(), point.
y() * -1);
1025 rPoint =
QPoint(point.
y() * -1, point.
x());
1033QRect JavaStyle::subControlRect(ComplexControl control,
1035 SubControl subControl,
1044 qstyleoption_cast<const QStyleOptionTitleBar *>(
option);
1046 switch (subControl) {
1047 case SC_TitleBarMinButton: {
1052 case SC_TitleBarMaxButton: {
1057 case SC_TitleBarCloseButton: {
1062 case SC_TitleBarLabel: {
1067 rect.adjust(0, 2, 2, 2);
1070 case SC_TitleBarSysMenu: {
1082 qstyleoption_cast<const QStyleOptionGroupBox *>(
option);
1083 bool hasCheckbox =
box->subControls & SC_GroupBoxCheckBox;
1084 int checkAdjust = 13;
1088 switch (subControl) {
1089 case SC_GroupBoxFrame: {
1093 case SC_GroupBoxCheckBox: {
1097 QSize(checkAdjust, checkAdjust));
1104 case SC_GroupBoxLabel: {
1109 case SC_GroupBoxContents: {
1120 const QStyleOptionSpinBox *
spinBox =
1121 qstyleoption_cast<const QStyleOptionSpinBox *>(
option);
1122 int spinnerWidth = 16;
1125 int frameWidth = pixelMetric(PM_SpinBoxFrameWidth,
spinBox,
widget);
1127 switch (subControl) {
1128 case SC_SpinBoxUp: {
1133 case SC_SpinBoxDown: {
1140 case SC_SpinBoxFrame: {
1145 case SC_SpinBoxEditField: {
1155 case CC_ToolButton: {
1157 qstyleoption_cast<const QStyleOptionToolButton *>(
option);
1159 switch (subControl) {
1160 case SC_ToolButton: {
1164 case SC_ToolButtonMenu: {
1174 qstyleoption_cast<const QStyleOptionComboBox *>(
option);
1178 switch (subControl) {
1179 case SC_ComboBoxFrame:
1182 case SC_ComboBoxArrow:
1191 case SC_ComboBoxEditField:
1200 case SC_ComboBoxListBoxPopup:
1206 case CC_ScrollBar: {
1208 qstyleoption_cast<const QStyleOptionSlider *>(
option);
1209 int scrollBarExtent = pixelMetric(PM_ScrollBarExtent,
scrollBar,
1214 int sliderMinLength = pixelMetric(PM_ScrollBarSliderMin,
scrollBar,
1223 if (sliderLength < sliderMinLength || valueRange > INT_MAX / 2)
1224 sliderLength = sliderMinLength;
1225 if (sliderLength > sliderMaxLength)
1226 sliderLength = sliderMaxLength;
1228 sliderLength = sliderMaxLength;
1233 sliderMaxLength - sliderLength,
1237 switch (subControl) {
1238 case SC_ScrollBarSubLine:
1240 rect.setRect(scrollBarRect.
left(), scrollBarRect.
top(),
1241 scrollBarRect.
width() - 16, scrollBarExtent);
1243 rect.setRect(scrollBarRect.
left(), scrollBarRect.
top(),
1244 scrollBarExtent, scrollBarRect.
height() - 16);
1247 case SC_ScrollBarAddLine:
1249 rect.setRect(scrollBarRect.
right() - 15,
1250 scrollBarRect.
top(), 16, scrollBarExtent);
1253 - 15, scrollBarExtent, 16);
1256 case SC_ScrollBarSubPage:
1258 rect.setRect(scrollBarRect.
left() + 16, scrollBarRect.
top(),
1259 sliderStart - (scrollBarRect.
left() + 16),
1262 rect.setRect(scrollBarRect.
left(), scrollBarRect.
top() + 16,
1264 sliderStart - (scrollBarRect.
left() + 16));
1267 case SC_ScrollBarAddPage:
1269 rect.setRect(sliderStart + sliderLength, 0,
1270 sliderMaxLength - sliderStart -
1271 sliderLength + 16, scrollBarExtent);
1273 rect.setRect(0, sliderStart + sliderLength,
1274 scrollBarExtent, sliderMaxLength -
1275 sliderStart - sliderLength + 16);
1277 case SC_ScrollBarGroove:
1284 case SC_ScrollBarSlider:
1286 rect.setRect(sliderStart, 0, sliderLength,
1289 rect.setRect(0, sliderStart, scrollBarExtent,
1300 const QStyleOptionSlider *slider =
1301 qstyleoption_cast<const QStyleOptionSlider *>(
option);
1302 rect = slider->rect;
1303 int tickSize = pixelMetric(PM_SliderTickmarkOffset,
option,
widget);
1304 int handleSize = pixelMetric(PM_SliderControlThickness,
option,
1308 slider->rect.width();
1310 slider->maximum, slider->sliderValue,
dist - handleSize);
1312 switch (subControl) {
1313 case SC_SliderGroove: {
1317 rect.setHeight(handleSize);
1322 rect.adjust(0, 0, 0, 0);
1323 rect.setWidth(handleSize);
1328 rect.moveCenter(center);
1331 case SC_SliderHandle: {
1335 rect.setHeight(handleSize);
1340 rect.moveCenter(center);
1342 if (slider->upsideDown)
1343 rect.setLeft(slider->rect.right() -
1344 pos - (handleSize - 1));
1348 rect.setWidth(handleSize - 1);
1350 rect.setWidth(handleSize);
1355 rect.moveCenter(center);
1357 if (slider->upsideDown)
1358 rect.setTop(slider->rect.bottom() -
1359 ((
pos + handleSize) - 2));
1361 rect.setTop(slider->rect.top() +
pos);
1363 rect.setHeight(handleSize);
1367 case SC_SliderTickmarks: {
1372 rect.setHeight(tickSize);
1373 center.ry() += tickSize / 2;
1374 rect.adjust(6, 0, -10, 0);
1376 rect.setWidth(tickSize);
1377 center.rx() += tickSize / 2;
1378 rect.adjust(0, 6, 0, -10);
1383 rect.moveCenter(center);
1425void JavaStyle::drawComplexControl(ComplexControl control,
1435 qstyleoption_cast<const QStyleOptionTitleBar *>(
option);
1437 bool sunken = bar->
state & State_Sunken;
1441 gradient.setColorAt(0.0,
QColor(191, 212, 231));
1443 gradient.setColorAt(1.0,
QColor(221, 232, 243));
1451 QPalette::Background));
1459 QRect minButtonRect = subControlRect(control, bar,
1460 SC_TitleBarMinButton);
1461 QRect maxButtonRect = subControlRect(control, bar,
1462 SC_TitleBarMaxButton);
1463 QRect closeButtonRect = subControlRect(control, bar,
1464 SC_TitleBarCloseButton);
1465 QRect systemButtonRect = subControlRect(control, bar,
1466 SC_TitleBarSysMenu);
1467 QRect labelRect = subControlRect(control, bar, SC_TitleBarLabel);
1482 for (
int i = 0;
i < gripRect.
width(); ++
i) {
1486 for (
int j = 0;
j < 4; ++
j) {
1488 gripRect.
top() - 2 +
i % 4 + 4 *
j);
1492 QPixmap maximizePixmap(
":/images/internalmaximize.png");
1493 QPixmap minimizePixmap(
":/images/internalminimize.png");
1494 QPixmap closePixmap(
":/images/internalclose.png");
1495 QPixmap internalPixmap(
":/images/internalsystem.png");
1496 QPixmap internalCloseDownPixmap(
":/images/internalclosedown.png");
1497 QPixmap minimizeDownPixmap(
":/images/internalminimizedown.png");
1498 QPixmap maximizeDownPixmap(
":/images/internalmaximizedown.png");
1501 bar->
state & State_Sunken)
1503 internalCloseDownPixmap);
1508 bar->
state & State_Sunken)
1510 minimizeDownPixmap);
1515 bar->
state & State_Sunken)
1517 maximizeDownPixmap);
1527 qstyleoption_cast<const QStyleOptionGroupBox *>(
option);
1529 QRect frameRect = subControlRect(control,
box, SC_GroupBoxFrame);
1530 QRect labelRect = subControlRect(control,
box, SC_GroupBoxLabel);
1531 QRect contentsRect = subControlRect(control,
box,
1532 SC_GroupBoxContents);
1533 QRect checkerRect = subControlRect(control,
box,
1534 SC_GroupBoxCheckBox);
1544 if (
box->subControls & SC_GroupBoxCheckBox) {
1546 checkerRect.
right() + 2,
y);
1548 checker.QStyleOption::operator=(*box);
1549 checker.
rect = checkerRect;
1553 if (
box->subControls & SC_GroupBoxLabel && !
box->text.isEmpty()) {
1555 labelRect.
right() +1,
y);
1563 box->palette,
box->state & State_Enabled,
1570 const QStyleOptionSpinBox *spinner =
1571 qstyleoption_cast<const QStyleOptionSpinBox *>(
option);
1573 QRect frameRect = subControlRect(control, spinner, SC_SpinBoxFrame);
1574 QRect upRect = subControlRect(control, spinner, SC_SpinBoxUp);
1575 QRect downRect = subControlRect(control, spinner, SC_SpinBoxDown);
1584 bool isEnabled = (spinner->state & State_Enabled);
1585 bool hover =
isEnabled && (spinner->state & State_MouseOver);
1586 bool sunken = (spinner->state & State_Sunken);
1587 bool upIsActive = (spinner->activeSubControls == SC_SpinBoxUp);
1588 bool downIsActive = (spinner->activeSubControls == SC_SpinBoxDown);
1589 bool stepUpEnabled = spinner->stepEnabled &
1591 bool stepDownEnabled = spinner->stepEnabled &
1597 if (upIsActive && stepUpEnabled) {
1599 drawSunkenButtonShadow(
painter, upRect,
1602 drawButtonHoverFrame(
painter, upRect,
1608 QStyleOptionSpinBox upSpin = *spinner;
1609 upSpin.rect = upRect;
1613 if (downIsActive && stepDownEnabled) {
1615 drawSunkenButtonShadow(
painter, downRect,
1618 drawButtonHoverFrame(
painter, downRect,
1624 QStyleOptionSpinBox downSpin = *spinner;
1625 downSpin.rect = downRect;
1630 case CC_ToolButton: {
1632 qstyleoption_cast<const QStyleOptionToolButton *>(
option);
1639 if (!(
button->state & State_MouseOver) &&
1640 !(
button->state & State_On)) {
1644 panelRect = subControlRect(control,
option, SC_ToolButton);
1645 panelOption.
rect = panelRect;
1650 QRect menuRect = subControlRect(control,
option, SC_ToolButtonMenu);
1655 menuOption.
rect = menuRect;
1661 if (
button->subControls & SC_ToolButtonMenu) {
1666 if (
button->state & State_HasFocus) {
1677 qstyleoption_cast<const QStyleOptionComboBox *>(
option);
1679 QRect frameRect = subControlRect(control,
option, SC_ComboBoxFrame,
1683 if (
option->state & State_HasFocus)
1690 QRect arrowRect = subControlRect(control,
option, SC_ComboBoxArrow,
1708 if (
button.state & State_On)
1709 button.state ^= State_On;
1731 SC_ComboBoxEditField,
widget);
1736 const QStyleOptionSlider *slider =
1737 qstyleoption_cast<const QStyleOptionSlider *>(
option);
1741 QRect groove = subControlRect(control,
option, SC_SliderGroove,
1743 QRect ticks = subControlRect(control,
option, SC_SliderTickmarks,
1751 handle.bottomRight() + xySwitch(
QPoint(-4, -6), horizontal));
1753 if (slider->upsideDown || !horizontal) {
1755 remember = afterHandle;
1756 afterHandle = beforeHandle;
1757 beforeHandle = remember;
1780 gradient.setColorAt(1.0,
QColor(188, 210, 230));
1782 gradient.setColorAt(0.0,
QColor(223, 233, 243));
1791 QPoint topLeft, topRight, bottomLeft;
1793 topLeft =
handle.topLeft();
1794 topRight =
handle.topRight();
1795 bottomLeft =
handle.bottomLeft();
1797 topLeft =
handle.bottomLeft();
1798 topRight =
handle.topLeft();
1799 bottomLeft =
handle.topRight();
1810 if (!(slider->state & State_Enabled)) {
1811 image.setColor(4, slider->palette.color(QPalette::Background).rgb());
1812 image.setColor(5, slider->palette.color(QPalette::Background).rgb());
1813 image.setColor(6, slider->palette.color(QPalette::Background).rgb());
1818 QImage image(
":/images/verticalsliderhandle.png");
1824 int tickInterval = slider->tickInterval ? slider->tickInterval :
1827 for (
int i = 0;
i <= slider->maximum;
i += tickInterval) {
1829 int pos = int(((
i /
double(slider->maximum)) *
1830 ticks.
width()) - 1);
1834 int pos = int(((
i /
double(slider->maximum)) *
1858 const QColor &frameColor,
1880 const QColor &frameColor,
1881 const QColor &activeFrame)
const
1887 rect.adjust(1, 1, -1, -1);
1890 rect.adjust(1, 1, -1, -1);
1902 SubControl
ret = SC_None;
1907 qstyleoption_cast<const QStyleOptionTitleBar *>(
option);
1909 QRect maximize = subControlRect(control, bar, SC_TitleBarMaxButton);
1911 ret = SC_TitleBarMaxButton;
1914 QRect minimize = subControlRect(control, bar, SC_TitleBarMinButton);
1916 ret = SC_TitleBarMinButton;
1919 QRect close = subControlRect(control, bar, SC_TitleBarCloseButton);
1921 ret = SC_TitleBarCloseButton;
1924 QRect system = subControlRect(control, bar, SC_TitleBarSysMenu);
1926 ret = SC_TitleBarSysMenu;
1929 ret = SC_TitleBarLabel;
1933 if (
const QStyleOptionSlider *
scrollBar =
1934 qstyleoption_cast<const QStyleOptionSlider *>(
option)) {
1936 SC_ScrollBarSlider,
widget);
1938 ret = SC_ScrollBarSlider;
1943 SC_ScrollBarAddLine,
widget);
1945 ret = SC_ScrollBarAddLine;
1950 SC_ScrollBarSubPage,
widget);
1952 ret = SC_ScrollBarSubPage;
1957 SC_ScrollBarAddPage,
widget);
1959 ret = SC_ScrollBarAddPage;
1964 SC_ScrollBarSubLine,
widget);
1966 ret = SC_ScrollBarSubLine;
1981 if (qobject_cast<QCheckBox *>(
widget) ||
1982 qobject_cast<QRadioButton *>(
widget) ||
1983 qobject_cast<QPushButton *>(
widget) ||
1984 qobject_cast<QToolButton *>(
widget) ||
1985 qobject_cast<QSpinBox *>(
widget) ||
1986 qobject_cast<QGroupBox *>(
widget))
1992 if (qobject_cast<QPushButton *>(
widget) ||
1993 qobject_cast<QCheckBox *>(
widget) ||
1994 qobject_cast<QRadioButton *>(
widget) ||
1995 qobject_cast<QToolButton *>(
widget) ||
1996 qobject_cast<QSpinBox *>(
widget) ||
1997 qobject_cast<QGroupBox *>(
widget))
2002 bool horizontal)
const
2012 int iterations = horizontal ?
rect.height() - 1 :
rect.width() - 1;
2013 for (
int i = 0;
i < iterations; ++
i) {
2016 rect.y() +
i), horizontal));
2020inline QPoint JavaStyle::xySwitch(
const QPoint &point,
bool horizontal)
const
2025 retPoint =
QPoint(point.
y(), point.
x());
2031void JavaStyle::drawPrimitive(PrimitiveElement element,
2039 case PE_PanelButtonBevel:
2040 case PE_FrameButtonBevel: {
2048 case PE_IndicatorBranch: {
2050 QColor lineColor(204, 204, 255);
2051 QPixmap openPixmap(
":/images/jtreeopen.png");
2052 QPixmap closedPixmap(
":/images/jtreeclosed.png");
2054 pixmapRect.moveCenter(
option->rect.center());
2055 pixmapRect.translate(2, 0);
2061 if (
option->state & State_Item) {
2068 if (
option->state & State_Sibling) {
2073 if (
option->state & State_Children)
2074 if (
option->state & State_Open)
2078 }
else if (
option->state & State_Sibling) {
2086 case PE_IndicatorItemViewItemCheck: {
2089 case PE_FrameWindow: {
2091 bool active =
option->state & State_Active;
2133 case PE_IndicatorSpinUp: {
2134 const QStyleOptionSpinBox *spinner =
2135 qstyleoption_cast<const QStyleOptionSpinBox *>(
option);
2136 int add = spinner->state & State_Sunken &&
2137 spinner->activeSubControls & SC_SpinBoxUp ? 1 : 0;
2145 case PE_IndicatorSpinDown: {
2146 const QStyleOptionSpinBox *spinner =
2147 qstyleoption_cast<const QStyleOptionSpinBox *>(
option);
2149 int add = spinner->state & State_Sunken &&
2150 spinner->activeSubControls & SC_SpinBoxDown ? 1 : 0;
2157 case PE_FrameDockWidget: {
2161 case PE_IndicatorToolBarHandle: {
2163 bool horizontal =
option->state & State_Horizontal;
2170 int iterations = horizontal ?
option->rect.height() :
2173 for (
int i = 0;
i < iterations; ++
i) {
2188 case PE_IndicatorToolBarSeparator: {
2191 case PE_PanelButtonTool: {
2193 qstyleoption_cast<const QStyleOptionToolButton *>(
option);
2197 if (!(
option->state & State_Enabled))
2203 if (
button->state & State_MouseOver ||
button->state & State_On) {
2209 drawButtonBackground(&bevel,
painter,
false);
2218 case PE_FrameMenu: {
2223 case PE_PanelButtonCommand: {
2225 qstyleoption_cast<const QStyleOptionButton *>(
option);
2226 bool hover = (
btn->
state & State_Enabled) &&
2228 bool sunken =
btn->
state & State_Sunken;
2230 bool on =
option->state & State_On;
2235 if (hover && !sunken && !isDefault && !on) {
2239 }
else if (isDefault) {
2244 case PE_FrameDefaultButton: {
2252 case PE_IndicatorCheckBox: {
2256 if (
option->state & State_Enabled &&
2257 option->state & State_MouseOver &&
2258 !(
option->state & State_Sunken)) {
2262 rect =
rect.adjusted(1, 1, -1, -1);
2266 if (
option->state & State_On) {
2274 case PE_IndicatorRadioButton: {
2278 if (!(
option->state & State_Sunken) &&
2279 option->state & State_Enabled)
2280 radioBrush = gradientBrush(
option->rect);
2283 if (
option->state & State_Enabled)
2290 if (
option->state & State_MouseOver &&
2291 option->state & State_Enabled &&
2292 !(
option->state & State_Sunken)) {
2293 gradientBrush(
option->rect);
2298 rect =
rect.adjusted(1, 1, -1, -1);
2302 if (
option->state & State_On) {
2307 if (
option->state & State_Sunken &&
2308 option->state & State_Enabled) {
2316 case PE_FrameTabWidget: {
2324 case PE_FrameLineEdit: {
2326 qstyleoption_cast<const QStyleOptionFrame *>(
option);
2333 QPalette::Background));
2340 case PE_FrameFocusRect: {
2359 bool sunken =
option->state & State_Sunken;
2361 bool on =
option->state & State_On;
2363 if (!sunken && !
disabled && (!on || isCheckbox))
2364 buttonBrush = gradientBrush(
option->rect);
2389 gradient.setColorAt(1.0,
QColor(188, 210, 230));
2391 gradient.setColorAt(0.0,
QColor(223, 233, 243));
2396QRect JavaStyle::subElementRect(SubElement element,
2403 case SE_ToolBoxTabContents: {
2405 qstyleoption_cast<const QStyleOptionToolBox *>(
option);
2408 rect.setHeight(
box->rect.height() - 4);
2409 rect.setWidth(
box->fontMetrics.horizontalAdvance(
box->text) + 15);
2412 case SE_ProgressBarLabel:
2413 case SE_ProgressBarGroove:
2414 case SE_ProgressBarContents: {
2418 case SE_PushButtonFocusRect: {
2420 qstyleoption_cast<const QStyleOptionButton *>(
option);
2430 rect.adjust(-1, -1, 1, 1);
2435 rect.adjust(-1, 0, 1, 0);
2445int JavaStyle::pixelMetric(PixelMetric metric,
2452 case PM_ButtonShiftHorizontal:
2453 case PM_ButtonShiftVertical:
2454 case PM_TabBarTabShiftHorizontal:
2455 case PM_ButtonDefaultIndicator:
2456 case PM_TabBarTabShiftVertical:
2459 case PM_TabBarBaseOverlap:
2460 case PM_DefaultFrameWidth:
2463 case PM_TabBarTabVSpace:
2466 case PM_ScrollBarExtent:
2469 case PM_ScrollBarSliderMin:
2472 case PM_SplitterWidth:
2475 case PM_SliderThickness:
2478 case PM_SliderControlThickness:
2481 case PM_SliderTickmarkOffset:
2484 case PM_SliderSpaceAvailable:
2486 case PM_MenuPanelWidth:
2489 case PM_MenuVMargin:
2492 case PM_MenuBarPanelWidth:
2495 case PM_MenuBarItemSpacing:
2498 case PM_MenuBarHMargin:
2501 case PM_MenuBarVMargin:
2504 case PM_ComboBoxFrameWidth:
2507 case PM_MenuButtonIndicator:
2510 case PM_ToolBarItemMargin:
2513 case PM_ToolBarHandleExtent:
2516 case PM_SpinBoxFrameWidth:
2519 case PM_TitleBarHeight: {
2522 case PM_MDIFrameWidth:
2526 case PM_DockWidgetFrameWidth: {
2544 case SH_Table_GridLineColor: {
2557QPixmap JavaStyle::standardPixmap(StandardPixmap standardPixmap,
2564 QPixmap maximizePixmap(
":/images/internalmaximize.png");
2565 QPixmap minimizePixmap(
":/images/internalminimize.png");
2566 QPixmap closePixmap(
":/images/internalclose.png");
2567 QPixmap internalPixmap(
":/images/internalsystem.png");
2568 QPixmap internalCloseDownPixmap(
":/images/internalclosedown.png");
2569 QPixmap minimizeDownPixmap(
":/images/internalminimizedown.png");
2570 QPixmap maximizeDownPixmap(
":/images/internalmaximizedown.png");
2571 QPixmap dirOpenPixmap(
":/images/open24.png");
2572 QPixmap filePixmap(
":/images/file.png");
2574 switch (standardPixmap) {
2575 case SP_DirLinkIcon:
2576 case SP_DirClosedIcon:
2578 case SP_DirOpenIcon: {
2586 case SP_FileDialogBack: {
2590 case SP_FileDialogToParent: {
2594 case SP_FileDialogNewFolder: {
2598 case SP_FileDialogListView: {
2602 case SP_FileDialogDetailedView: {
2606 case SP_MessageBoxInformation: {
2610 case SP_MessageBoxWarning: {
2613 case SP_MessageBoxCritical: {
2617 case SP_MessageBoxQuestion: {
2621 case SP_TitleBarNormalButton:
2624 case SP_TitleBarCloseButton:
2634QSize JavaStyle::sizeFromContents(ContentsType
type,
2636 const QSize &contentsSize,
2644 const QStyleOptionSlider *slider =
2645 qstyleoption_cast<const QStyleOptionSlider *>(
option);
2649 return contentsSize;
2652 case CT_MenuBarItem: {
2654 qstyleoption_cast<const QStyleOptionMenuItem *>(
option);
2666 qstyleoption_cast<const QStyleOptionMenuItem *>(
option);
int pageStep
the page step.
Qt::Orientation orientation
the orientation of the slider
int sliderPosition
the current slider position
int minimum
the sliders's minimum value
int maximum
the slider's maximum value
const QColor & color() const
Returns the brush color.
The QColor class provides colors based on RGB, HSV or CMYK values.
bool isValid() const noexcept
Returns true if the color is valid; otherwise returns false.
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
QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr) const override
\reimp
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=nullptr) const override
\reimp
SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *w=nullptr) const override
\reimp
int styleHint(StyleHint sh, const QStyleOption *opt=nullptr, const QWidget *w=nullptr, QStyleHintReturn *shret=nullptr) const override
\reimp
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...
int horizontalAdvance(const QString &, int len=-1) const
Returns the horizontal advance in pixels of the first len characters of text.
void setPointSize(int)
Sets the point size to pointSize.
int pointSize() const
Returns the point size of the font.
void setBold(bool)
If enable is true sets the font's weight to \l{Weight}{QFont::Bold}; otherwise sets the weight to \l{...
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.
State
This enum describes the state for which a pixmap is intended to be used.
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.
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 drawPoint(const QPointF &pt)
Draws a single point at the given position using the current pen's color.
void drawRect(const QRectF &rect)
Draws the current rectangle with the current pen and brush.
void drawPath(const QPainterPath &path)
Draws the given painter path using the current pen for outline and the current brush for filling.
void setClipRect(const QRectF &, Qt::ClipOperation op=Qt::ReplaceClip)
Enables clipping, and sets the clip region to the given rectangle using the given clip operation.
void setPen(const QColor &color)
This is an overloaded member function, provided for convenience. It differs from the above function o...
void drawLine(const QLineF &line)
Draws a line defined by line.
const QFont & font() const
Returns the currently set font used for drawing text.
void restore()
Restores the current painter state (pops a saved state off the stack).
void rotate(qreal a)
Rotates the coordinate system clockwise.
void save()
Saves the current painter state (pushes the state onto a stack).
void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags=Qt::AutoColor)
Draws the rectangular portion source of the given image into the target rectangle in the paint device...
void setFont(const QFont &f)
Sets the painter's font to the given font.
void drawText(const QPointF &p, const QString &s)
Draws the given text with the currently defined text direction, beginning at the given position.
void drawPolyline(const QPointF *points, int pointCount)
Draws the polyline defined by the first pointCount points in points using the current pen.
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 drawArc(const QRectF &rect, int a, int alen)
Draws the arc defined by the given rectangle, startAngle and spanAngle.
void drawEllipse(const QRectF &r)
Draws the ellipse defined by the given rectangle.
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
void 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.
void setTransform(const QTransform &transform, bool combine=false)
The QPalette class contains color groups for each widget state.
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 & light() const
Returns the light brush of the current color group.
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
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.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
\inmodule QtCore\reentrant
constexpr int & rx() noexcept
Returns a reference to the x coordinate of this point.
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
The QPolygon class provides a list of points using integer precision.
constexpr qreal height() const noexcept
Returns the height of the rectangle.
constexpr qreal width() const noexcept
Returns the width of the rectangle.
\inmodule QtCore\reentrant
constexpr QPoint bottomLeft() const noexcept
Returns the position of the rectangle's bottom-left corner.
constexpr void adjust(int x1, int y1, int x2, int y2) noexcept
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
constexpr void moveCenter(const QPoint &p) noexcept
Moves the rectangle, leaving the center point at the given position.
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 isNull() const noexcept
Returns true if the rectangle is a null rectangle, otherwise returns false.
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
constexpr QRect adjusted(int x1, int y1, int x2, int y2) const noexcept
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr QPoint topRight() const noexcept
Returns the position of the rectangle's top-right corner.
bool contains(const QRect &r, bool proper=false) const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
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 translate(int dx, int dy) noexcept
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position.
constexpr QPoint bottomRight() const noexcept
Returns the position of the rectangle's bottom-right corner.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr 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 int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
\macro QT_RESTRICTED_CAST_FROM_ASCII
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
static QString static QString qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
QString & remove(qsizetype i, qsizetype len)
Removes n characters from the string, starting at the given position index, and returns a reference t...
\variable QStyleOptionGraphicsItem::exposedRect
\variable QStyleOptionToolButton::features
\variable QStyleOptionMenuItem::menuItemType
QStyle::SubControls activeSubControls
\variable QStyleOptionFocusRect::backgroundColor
\variable QStyleOptionFrame::features
\variable QStyleOptionButton::features
\variable QStyleOptionToolBox::selectedPosition
The QStyleOption class stores the parameters used by QStyle functions.
Qt::LayoutDirection direction
virtual QPalette standardPalette() const
Returns the style's standard palette.
static int sliderPositionFromValue(int min, int max, int val, int space, bool upsideDown=false)
Converts the given logicalValue to a pixel position.
SubControl
This enum describes the available sub controls.
Shape
This enum type lists the built-in shapes supported by QTabBar.
drawPrimitive(PE_IndicatorCheckBox, &subopt, p, widget)
p drawControl(QStyle::CE_CheckBox, opt)
const QStyleOptionButton * btn
[3]
static const int windowsCheckMarkHMargin
static const int windowsItemFrame
static const int windowsItemHMargin
static const int windowsArrowHMargin
static const int windowsItemVMargin
static const int windowsSepHeight
static const int windowsCheckMarkWidth
static const char *const sliderHandleImage[]
static const int windowsTabSpacing
static const int windowsRightBorder
QTextStream & center(QTextStream &stream)
Calls QTextStream::setFieldAlignment(QTextStream::AlignCenter) on stream and returns stream.
static jboolean copy(JNIEnv *, jobject)
static QString header(const QString &name)
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
static void visualRect(QRectF *geom, Qt::LayoutDirection dir, const QRectF &contentsRect)
constexpr const T & qMax(const T &a, const T &b)
GLuint64 GLenum void * handle
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLsizei GLenum const void GLuint GLsizei GLfloat * metrics
GLuint GLsizei const GLchar * label
[43]
GLenum GLuint GLintptr offset
GLsizei const GLint * box
GLfloat GLfloat GLfloat GLfloat h
static const QRectF boundingRect(const QPointF *points, int pointCount)
static void add(QPainterPath &path, const QWingedEdge &list, int edge, QPathEdge::Traversal traversal)
static QT_BEGIN_NAMESPACE const QRgb colors[][14]
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
static QPalette standardPalette()
std::uniform_real_distribution dist(1, 2.5)
[2]