66 #include <private/qcommonstylepixmaps_p.h> 67 #include <private/qmath_p.h> 76 #include <private/qguiplatformplugin_p.h> 80 #ifndef QT_NO_ITEMVIEWS 81 # include "private/qtextengine_p.h" 85 # include <private/qt_x11_p.h> 86 #elif defined(Q_WS_MAC) 87 # include <private/qt_cocoa_helpers_mac_p.h> 90 #include <private/qstylehelper_p.h> 188 QColor bg = fropt->backgroundColor;
207 const int markH = markW;
217 for (i = 0; i < markW/2; ++i) {
218 a <<
QLineF(xx, yy, xx, yy + 2);
223 for (; i < markH; ++i) {
224 a <<
QLineF(xx, yy, xx, yy + 2);
240 if (
const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
245 qDrawPlainRect(p, frame->rect, frame->palette.foreground().color(), frame->lineWidth);
249 #ifndef QT_NO_TOOLBAR 251 if (widget && qobject_cast<QToolBar *>(widget->
parentWidget()))
253 if (
const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)){
254 qDrawShadePanel(p, frame->rect, frame->palette,
false, frame->lineWidth,
258 else if (
const QStyleOptionToolBar *frame = qstyleoption_cast<const QStyleOptionToolBar *>(opt)){
259 qDrawShadePanel(p, frame->rect, frame->palette,
false, frame->lineWidth,
268 #endif // QT_NO_TOOLBAR 269 #ifndef QT_NO_PROGRESSBAR 272 bool vertical =
false;
284 #endif // QT_NO_PROGRESSBAR 287 #ifndef QT_NO_IMAGEFORMAT_XPM 293 if (lv->items.isEmpty())
295 int x = lv->rect.x(),
297 #define INTARRLEN(x) sizeof(x)/(sizeof(int)*2) 298 static const int pts1[] = {
299 1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 };
300 static const int pts2[] = {
301 2,8, 1,7, 1,4, 2,3, 2,2, 3,2, 4,1, 7,1, 8,2, 9,2 };
302 static const int pts3[] = {
303 2,9, 3,9, 4,10, 7,10, 8,9, 9,9, 9,8, 10,7, 10,4, 9,3 };
304 static const int pts4[] = {
305 2,10, 3,10, 4,11, 7,11, 8,10, 9,10, 10,9, 10,8, 11,7,
312 p->
setPen(lv->palette.text().color());
347 if(lv->items.isEmpty())
350 int x = lv->
rect.
x(),
352 w = lv->rect.width(),
353 h = lv->rect.width(),
354 marg = lv->itemMargin;
357 p->
setPen(
QPen(lv->palette.text().color(), 2));
365 p->
setPen(
QPen(lv->palette.highlightedText().color(), 2));
370 p->
drawRect(x + marg, y + 2, w - 4, h - 4);
379 for (i = 0; i < 3; ++i) {
380 lines[i] =
QLineF(xx, yy, xx, yy + 2);
385 for (i = 3; i < 7; ++i) {
386 lines[i] =
QLineF(xx, yy, xx, yy + 2);
394 #endif // QT3_SUPPORT 402 #ifndef QT_NO_IMAGEFORMAT_XPM 403 static const int decoration_size = 9;
407 int delta = decoration_size / 2;
414 #endif // QT_NO_IMAGEFORMAT_XPM 431 #endif // QT3_SUPPORT 436 if (
const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
465 = qstyleoption_cast<const QStyleOptionTabBarBase *>(opt)) {
467 switch (tbb->shape) {
471 p->
drawLine(tbb->rect.topLeft(), tbb->rect.topRight());
476 p->
drawLine(tbb->rect.topLeft(), tbb->rect.bottomLeft());
481 p->
drawLine(tbb->rect.left(), tbb->rect.bottom(),
482 tbb->rect.right(), tbb->rect.bottom());
484 p->
drawLine(tbb->rect.left(), tbb->rect.bottom() - 1,
485 tbb->rect.right() - 1, tbb->rect.bottom() - 1);
490 p->
drawLine(tbb->rect.topRight(), tbb->rect.bottomRight());
497 if (
d->tabBarcloseButtonIcon.isNull()) {
498 d->tabBarcloseButtonIcon.addPixmap(
QPixmap(
499 QLatin1String(
":/trolltech/styles/commonstyle/images/standardbutton-closetab-16.png")),
501 d->tabBarcloseButtonIcon.addPixmap(
QPixmap(
502 QLatin1String(
":/trolltech/styles/commonstyle/images/standardbutton-closetab-down-16.png")),
504 d->tabBarcloseButtonIcon.addPixmap(
QPixmap(
505 QLatin1String(
":/trolltech/styles/commonstyle/images/standardbutton-closetab-hover-16.png")),
519 QPixmap pixmap =
d->tabBarcloseButtonIcon.pixmap(size, mode, state);
523 #endif // QT_NO_TABBAR 531 #ifndef QT_NO_GROUPBOX 533 if (
const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
536 QRect fr = frame->rect;
540 frame->lineWidth, frame->midLineWidth);
542 qDrawShadeRect(p, frame->rect.x(), frame->rect.y(), frame->rect.width(),
543 frame->rect.height(), frame->palette,
true,
544 frame->lineWidth, frame->midLineWidth);
548 #endif // QT_NO_GROUPBOX 549 #ifndef QT_NO_DOCKWIDGET 551 if (
const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
552 int lw = frame->lineWidth;
559 #endif // QT_NO_DOCKWIDGET 560 #ifndef QT_NO_TOOLBAR 601 #endif // QT_NO_TOOLBAR 602 #ifndef QT_NO_SPINBOX 610 int step = (br.
width() + 4) / 5;
615 p->
fillRect(br.
x() + br.
width() / 2 - step / 2 + offset, br.
y() + offset,
634 int sx = x + w / 2 - sw / 2;
635 int sy = y + h / 2 - sh / 2;
642 a.
setPoints(3, 0, 1, sw-1, 1, sh-2, sh-1);
644 a.
setPoints(3, 0, sh-1, sw-1, sh-1, sh-2, 1);
658 #endif // QT_NO_SPINBOX 671 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
673 QRect rect = tab->rect;
681 for(
int jags = 1; jags <= count; ++jags, rtl = !rtl)
685 p->
setBrush(tab->palette.background());
690 #endif // QT_NO_TABBAR 691 #ifndef QT_NO_LINEEDIT 693 if (
const QStyleOptionFrame *panel = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
694 p->
fillRect(panel->rect.adjusted(panel->lineWidth, panel->lineWidth, -panel->lineWidth, -panel->lineWidth),
697 if (panel->lineWidth > 0)
701 #endif // QT_NO_LINEEDIT 702 #ifndef QT_NO_COLUMNVIEW 704 if (
const QStyleOptionViewItem *viewOpt = qstyleoption_cast<const QStyleOptionViewItem *>(opt)) {
708 int x = viewOpt->rect.x() + 1;
709 int offset = (viewOpt->rect.height() / 3);
710 int height = (viewOpt->rect.height()) - offset * 2;
713 int x2 = x + height - 1;
715 x = viewOpt->rect.x() + viewOpt->rect.width() - 1;
718 path.
moveTo(x, viewOpt->rect.y() + offset);
719 path.
lineTo(x, viewOpt->rect.y() + offset + height);
720 path.
lineTo(x2, viewOpt->rect.y() + offset+height/2);
723 if (viewOpt->showDecorationSelected) {
743 lines.
moveTo(x, viewOpt->rect.y() + offset);
744 lines.
lineTo(x, viewOpt->rect.y() + offset + height);
745 lines.
moveTo(x, viewOpt->rect.y() + offset);
746 lines.
lineTo(x2, viewOpt->rect.y() + offset+height/2);
754 #endif //QT_NO_COLUMNVIEW 762 #ifndef QT_NO_ITEMVIEWS 786 if (vopt->backgroundBrush.style() !=
Qt::NoBrush) {
789 p->
fillRect(vopt->rect, vopt->backgroundBrush);
800 #endif //QT_NO_ITEMVIEWS 810 #ifndef QT_NO_TOOLBUTTON 832 arrowOpt.
rect = rect;
837 #endif // QT_NO_TOOLBUTTON 839 #ifndef QT_NO_ITEMVIEWS 877 qreal height = 0, widthUsed = 0;
920 return QSizeF(widthUsed, height);
929 QRect textRect = rect.
adjusted(textMargin, 0, -textMargin, 0);
945 int elidedIndex = -1;
946 const int lineCount = textLayout.
lineCount();
947 for (
int j = 0; j < lineCount; ++j) {
949 if (j + 1 <= lineCount - 1) {
951 if ((nextLine.
y() + nextLine.
height()) > textRect.
height()) {
957 width = textRect.
width();
968 width = textRect.
width();
972 width = qMax<qreal>(width, line.
width());
977 QSize(
int(width),
int(height)), textRect);
979 for (
int i = 0; i < lineCount; ++i) {
981 if (i == elidedIndex) {
982 qreal x = position.
x() + line.
x();
990 line.
draw(p, position);
1006 QRect *pixmapRect,
QRect *textRect,
bool sizehint)
const 1008 Q_ASSERT(checkRect && pixmapRect && textRect);
1014 const bool hasCheck = checkRect->
isValid();
1015 const bool hasPixmap = pixmapRect->
isValid();
1016 const bool hasText = textRect->
isValid();
1024 if (textRect->
height() == 0 && (!hasPixmap || !sizehint)) {
1031 pm = pixmapRect->
size();
1032 pm.
rwidth() += 2 * pixmapMargin;
1050 cw = checkRect->
width() + 2 * checkMargin;
1051 if (sizehint) w += cw;
1053 check.
setRect(x + w - cw, y, cw, h);
1107 qWarning(
"doLayout: decoration position is invalid");
1108 decoration = *pixmapRect;
1114 checkRect->
size(), check);
1116 pixmapRect->size(), decoration);
1125 *pixmapRect = decoration;
1129 #endif // QT_NO_ITEMVIEWS 1132 #ifndef QT_NO_TABBAR 1155 verticalShift = -verticalShift;
1156 tr.
adjust(hpadding, verticalShift - vpadding, horizontalShift - hpadding, vpadding);
1179 iconSize =
QSize(iconExtent, iconExtent);
1188 *iconRect = proxyStyle->visualRect(opt->
direction, opt->
rect, *iconRect);
1197 #endif //QT_NO_TABBAR 1210 if (
const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
1217 fropt.QStyleOption::operator=(*btn);
1224 if (
const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
1225 QRect br = btn->rect;
1240 QRect ir = btn->rect;
1248 if (
const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
1249 QRect textRect = button->rect;
1254 if (!button->icon.isNull()) {
1264 QPixmap pixmap = button->icon.pixmap(button->iconSize, mode, state);
1265 int labelWidth = pixmap.
width();
1266 int labelHeight = pixmap.
height();
1267 int iconSpacing = 4;
1268 int textWidth = button->fontMetrics.boundingRect(opt->
rect, tf, button->text).width();
1269 if (!button->text.isEmpty())
1270 labelWidth += (textWidth + iconSpacing);
1272 iconRect =
QRect(textRect.
x() + (textRect.
width() - labelWidth) / 2,
1273 textRect.
y() + (textRect.
height() - labelHeight) / 2,
1276 iconRect =
visualRect(button->direction, textRect, iconRect);
1299 textRect = textRect.
adjusted(0, 0, -indicatorSize, 0);
1301 textRect = textRect.
adjusted(indicatorSize, 0, 0, 0);
1309 if (
const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
1315 &subopt, p, widget);
1321 fropt.QStyleOption::operator=(*btn);
1330 if (
const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
1336 QRect textRect = btn->rect;
1337 if (!btn->icon.isNull()) {
1341 textRect.
setRight(textRect.
right() - btn->iconSize.width() - 4);
1343 textRect.
setLeft(textRect.
left() + btn->iconSize.width() + 4);
1345 if (!btn->text.isEmpty()){
1357 &arrowOpt, p, widget);
1372 #endif // QT_NO_MENU 1373 #ifndef QT_NO_MENUBAR 1392 #endif // QT_NO_MENUBAR 1393 #ifndef QT_NO_PROGRESSBAR 1396 = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
1402 if (pb->textVisible) {
1415 bool vertical =
false;
1425 QRect shadowRect(pb->rect);
1427 QColor shadowColor = (pb->palette.color(textRole).value() <= 128)
1429 QPalette shadowPalette = pb->palette;
1430 shadowPalette.
setColor(textRole, shadowColor);
1442 QRect rect = pb->rect;
1443 bool vertical =
false;
1444 bool inverted =
false;
1471 int w = rect.
width();
1472 if (pb->minimum == 0 && pb->maximum == 0) {
1474 int x = (progress - minimum) % (w * 2);
1477 x = reverse ? rect.
right() - x : x + rect.
x();
1487 u = ((rect.
width() + unit_width) / unit_width);
1490 qint64 p_v = progress - minimum;
1491 qint64 t_s = (maximum - minimum) ? (maximum - minimum) :
qint64(1);
1493 if (u > 0 && p_v >=
INT_MAX / u && t_s >= u) {
1501 tnu = nu = p_v * u / t_s;
1503 if (nu * unit_width > w)
1511 int x0 = reverse ? rect.
right() - ((unit_width > 1) ? unit_width : 0)
1517 int myY = pbBits.
rect.
y();
1520 for (
int i = 0; i < nu; ++i) {
1521 pbBits.
rect.
setRect(x0 + x, myY, unit_width, myHeight);
1524 x += reverse ? -unit_width : unit_width;
1530 int pixels_left = w - (nu * unit_width);
1531 int offset = reverse ? x0 + x + unit_width-pixels_left : x0 + x;
1532 pbBits.
rect.
setRect(offset, myY, pixels_left, myHeight);
1539 #endif // QT_NO_PROGRESSBAR 1541 if (
const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
1542 QRect rect = header->rect;
1543 if (!header->icon.isNull()) {
1546 int pixw = pixmap.
width();
1550 p->
drawPixmap(inter.x(), inter.y(), pixmap, inter.x() - aligned.
x(), inter.y() - aligned.
y(), inter.width(), inter.height());
1566 #ifndef QT_NO_TOOLBUTTON 1569 = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
1570 QRect rect = toolbutton->rect;
1579 if (((!hasArrow && toolbutton->icon.isNull()) && !toolbutton->text.isEmpty())
1591 QSize pmSize = toolbutton->iconSize;
1592 if (!toolbutton->icon.isNull()) {
1601 pm = toolbutton->icon.pixmap(toolbutton->rect.size().boundedTo(toolbutton->iconSize),
1616 tr.adjust(0, pr.
height() - 1, 0, -2);
1621 drawArrow(
this, toolbutton, pr, p, widget);
1626 tr.adjust(pr.
width(), 0, 0, 0);
1631 drawArrow(
this, toolbutton, pr, p, widget);
1635 tr.translate(shiftX, shiftY);
1642 drawArrow(
this, toolbutton, rect, p, widget);
1650 #endif // QT_NO_TOOLBUTTON 1651 #ifndef QT_NO_TOOLBOX 1653 if (
const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) {
1659 if (
const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) {
1660 int d = 20 + tb->rect.height() - 3;
1663 a.
setPoint(0, -1, tb->rect.height() + 1);
1666 a.
setPoint(3, tb->rect.width() - 20, tb->rect.height() - 2);
1667 a.
setPoint(4, tb->rect.width() - 1, tb->rect.height() - 2);
1668 a.
setPoint(5, tb->rect.width() - 1, tb->rect.height() + 1);
1669 a.
setPoint(6, -1, tb->rect.height() + 1);
1671 a.
setPoint(0, tb->rect.width(), tb->rect.height() + 1);
1672 a.
setPoint(1, tb->rect.width(), 1);
1674 a.
setPoint(3, 20 - 1, tb->rect.height() - 2);
1675 a.
setPoint(4, 0, tb->rect.height() - 2);
1676 a.
setPoint(5, 0, tb->rect.height() + 1);
1677 a.
setPoint(6, tb->rect.width(), tb->rect.height() + 1);
1680 p->
setPen(tb->palette.mid().color().darker(150));
1682 p->
setPen(tb->palette.light().color());
1684 p->
drawLine(0, 2, tb->rect.width() -
d, 2);
1685 p->
drawLine(tb->rect.width() - d - 1, 2, tb->rect.width() - 21, tb->rect.height() - 1);
1686 p->
drawLine(tb->rect.width() - 20, tb->rect.height() - 1,
1687 tb->rect.width(), tb->rect.height() - 1);
1689 p->
drawLine(tb->rect.width() - 1, 2, d - 1, 2);
1690 p->
drawLine(d, 2, 20, tb->rect.height() - 1);
1691 p->
drawLine(19, tb->rect.height() - 1,
1692 -1, tb->rect.height() - 1);
1697 #endif // QT_NO_TOOLBOX 1698 #ifndef QT_NO_TABBAR 1700 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
1706 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
1709 QRect rect(tab->rect);
1715 switch (tab->shape) {
1717 rect.
adjust(0, 0, 0, -tabOverlap);
1719 rect.
adjust(1, 1, -1, 0);
1722 rect.
adjust(0, tabOverlap, 0, 0);
1724 rect.
adjust(1, 0, -1, -1);
1727 rect.
adjust(tabOverlap, 0, 0, 0);
1729 rect.
adjust(0, 1, -1, -1);
1732 rect.
adjust(0, 0, -tabOverlap, 0);
1734 rect.
adjust(1, 1, 0, -1);
1741 p->
setPen(
QPen(tab->palette.foreground(), 0));
1748 p->
setBrush(tab->palette.background());
1754 switch (tab->shape) {
1768 for (i = 0; i < 5; ++i)
1771 for (i = 0; i < 10; ++i)
1786 x = rect.
width() - 2;
1793 int bottom = rect.
height() - 1;
1794 for (i = 0; i < 5; ++i)
1797 for (i = 0; i < 10; ++i)
1813 if (
const QStyleOptionToolBox *tb = qstyleoption_cast<const QStyleOptionToolBox *>(opt)) {
1826 int iw = pm.
width() + 4;
1858 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
1872 int newX, newY, newRot;
1874 newX = tr.
width() + tr.
x();
1887 d->tabLayout(&tabV2, widget, &tr, &iconRect);
1911 fropt.QStyleOption::operator=(*tab);
1913 x2 - x1 - 2*OFFSET, tabV2.
rect.
height() - 2*OFFSET);
1918 #endif // QT_NO_TABBAR 1919 #ifndef QT_NO_SIZEGRIP 1925 int sw =
qMin(h, w);
1937 corner = sgOpt->corner;
1945 for (
int i = 0; i < 4; ++i) {
1947 p->
drawLine(x, sy - 1 , sx + 1, sw);
1951 p->
drawLine(x, sy + 1, sx - 1, sw);
1956 for (
int i = 0; i < 4; ++i) {
1958 p->
drawLine(sx - 1, sw, sw, sy - 1);
1962 p->
drawLine(sx + 1, sw, sw, sy + 1);
1968 for (
int i = 0; i < 4; ++i) {
1970 p->
drawLine(sx - 1, y, sw, sy + 1);
1974 p->
drawLine(sx + 1, y, sw, sy - 1);
1979 for (
int i = 0; i < 4; ++i) {
1992 #endif // QT_NO_SIZEGRIP 1993 #ifndef QT_NO_RUBBERBAND 1997 QPainter pixmapPainter(&tiledPixmap);
2003 pixmapPainter.
end();
2021 #endif // QT_NO_RUBBERBAND 2022 #ifndef QT_NO_DOCKWIDGET 2026 if (dwOpt->movable) {
2031 if (!dwOpt->title.isEmpty()) {
2036 if (verticalTitleBar) {
2053 if (verticalTitleBar)
2058 #endif // QT_NO_DOCKWIDGET 2060 if (
const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
2086 #ifndef QT_NO_COMBOBOX 2092 if (!cb->currentIcon.isNull()) {
2095 QPixmap pixmap = cb->currentIcon.pixmap(cb->iconSize, mode);
2096 QRect iconRect(editRect);
2097 iconRect.
setWidth(cb->iconSize.width() + 4);
2100 iconRect.
size(), editRect);
2106 editRect.
translate(-4 - cb->iconSize.width(), 0);
2108 editRect.
translate(cb->iconSize.width() + 4, 0);
2110 if (!cb->currentText.isEmpty() && !cb->editable) {
2118 #endif // QT_NO_COMBOBOX 2119 #ifndef QT_NO_TOOLBAR 2121 if (
const QStyleOptionToolBar *toolBar = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
2124 frame.QStyleOption::operator=(*toolBar);
2129 if (widget && qobject_cast<QToolBar *>(widget->
parentWidget()))
2131 qDrawShadePanel(p, toolBar->rect, toolBar->palette,
false, toolBar->lineWidth,
2135 #endif // QT_NO_TOOLBAR 2149 int line1starting = opt->
rect.
width()*8 / 20;
2150 int line2starting = opt->
rect.
width()*13 / 20;
2153 p->
drawLine(line1starting, top, line1starting, bottom);
2154 p->
drawLine(line2starting, top, line2starting, bottom);
2158 #ifndef QT_NO_ITEMVIEWS 2174 option.
rect = checkRect;
2177 switch (vopt->checkState) {
2198 vopt->icon.paint(p, iconRect, vopt->decorationAlignment, mode, state);
2201 if (!vopt->text.isEmpty()) {
2217 d->viewItemDrawText(p, vopt, textRect);
2223 o.QStyleOption::operator=(*vopt);
2238 #endif // QT_NO_ITEMVIEWS 2242 int frameShape = f->frameShape;
2250 int lw = f->lineWidth;
2251 int mlw = f->midLineWidth;
2256 switch (frameShape) {
2259 qDrawPlainRect(p, f->rect, f->palette.color(foregroundRole), lw);
2275 qDrawPlainRect(p, f->rect, f->palette.color(foregroundRole), lw);
2282 qDrawPlainRect(p, f->rect, f->palette.color(foregroundRole), lw);
2326 if (
const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
2338 if (
const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
2339 int dbw1 = 0, dbw2 = 0;
2348 r.
setRect(btn->rect.x() + dfw1 + dbw1, btn->rect.y() + dfw1 + dbw1,
2349 btn->rect.width() - dfw2 - dbw2, btn->rect.height()- dfw2 - dbw2);
2375 if (
const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
2376 if (btn->icon.isNull() && btn->text.isEmpty()) {
2385 QRect iconRect, textRect;
2386 if (!btn->text.isEmpty()) {
2391 if (!btn->icon.isNull()) {
2398 r = iconRect | textRect;
2401 r =
visualRect(btn->direction, btn->rect, r);
2426 if (
const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
2427 if (btn->icon.isNull() && btn->text.isEmpty()) {
2435 QRect iconRect, textRect;
2436 if (!btn->text.isEmpty()){
2440 if (!btn->icon.isNull()) {
2446 r = iconRect | textRect;
2449 r =
visualRect(btn->direction, btn->rect, r);
2452 #ifndef QT_NO_SLIDER 2454 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
2458 r.
setRect(0, tickOffset - 1, slider->rect.width(), thickness + 2);
2460 r.
setRect(tickOffset - 1, 0, thickness + 2, slider->rect.height());
2465 #endif // QT_NO_SLIDER 2466 #ifndef QT_NO_PROGRESSBAR 2472 bool vertical =
false;
2477 if (pb->textVisible)
2478 textw =
qMax(pb->fontMetrics.width(pb->text), pb->fontMetrics.width(
QLatin1String(
"100%"))) + 6;
2483 r.
setCoords(pb->rect.left(), pb->rect.top(),
2484 pb->rect.right() - textw, pb->rect.bottom());
2486 r.
setCoords(pb->rect.right() - textw, pb->rect.top(),
2487 pb->rect.right(), pb->rect.bottom());
2494 #endif // QT_NO_PROGRESSBAR 2498 if (!dw->docked || !dw->closeEnabled)
2499 r.
setRect(0, 0, dw->rect.width(), dw->rect.height());
2502 r.
setRect(0, 15, dw->rect.width(), dw->rect.height() - 15);
2504 r.
setRect(0, 1, dw->rect.width() - 15, dw->rect.height() - 1);
2509 #endif // QT3_SUPPORT 2510 #ifndef QT_NO_COMBOBOX 2513 int margin = cb->frame ? 3 : 0;
2519 #endif // QT_NO_COMBOBOX 2520 #ifndef QT_NO_TOOLBOX 2525 #endif // QT_NO_TOOLBOX 2531 if (
const QStyleOptionHeader *header = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
2545 int x = opt->
rect.
x();
2546 int y = opt->
rect.
y();
2550 int horiz_size = h / 2;
2551 r.
setRect(x + w - margin * 2 - horiz_size, y + 5,
2552 horiz_size, h - margin * 2 - 5);
2554 int vert_size = w / 2;
2555 r.
setRect(x + 5, y + h - margin * 2 - vert_size,
2556 w - margin * 2 - 5, vert_size);
2569 #ifndef QT_NO_TABWIDGET 2572 = qstyleoption_cast<const QStyleOptionTabWidgetFrame *>(opt)) {
2575 switch (twf->shape) {
2581 - twf->leftCornerWidgetSize.width()
2582 - twf->rightCornerWidgetSize.width()));
2590 + (twf->leftCornerWidgetSize.width() / 2)
2591 - (twf->rightCornerWidgetSize.width() / 2), 0));
2595 - twf->rightCornerWidgetSize.width(), 0));
2598 r =
visualRect(twf->direction, twf->rect, r);
2603 - twf->leftCornerWidgetSize.width()
2604 - twf->rightCornerWidgetSize.width()));
2609 twf->rect.height() - twf->tabBarSize.height()));
2613 + (twf->leftCornerWidgetSize.width() / 2)
2614 - (twf->rightCornerWidgetSize.width() / 2),
2615 twf->rect.height() - twf->tabBarSize.height()));
2619 - twf->rightCornerWidgetSize.width(),
2620 twf->rect.height() - twf->tabBarSize.height()));
2623 r =
visualRect(twf->direction, twf->rect, r);
2628 - twf->leftCornerWidgetSize.height()
2629 - twf->rightCornerWidgetSize.height()));
2634 twf->leftCornerWidgetSize.height()));
2638 twf->rect.center().y() - r.
height() / 2));
2642 twf->rect.height() - twf->tabBarSize.height()
2643 - twf->rightCornerWidgetSize.height()));
2650 - twf->leftCornerWidgetSize.height()
2651 - twf->rightCornerWidgetSize.height()));
2662 - twf->rightCornerWidgetSize.height()));
2673 tabopt.
shape = twf->shape;
2675 if (twf->lineWidth == 0)
2677 switch (twf->shape) {
2681 QSize(twf->rect.width(),
qMin(twf->rect.height() - twf->tabBarSize.height() + overlap, twf->rect.height())));
2685 r =
QRect(
QPoint(0,0),
QSize(twf->rect.width(),
qMin(twf->rect.height() - twf->tabBarSize.height() + overlap, twf->rect.height())));
2689 r =
QRect(
QPoint(0, 0),
QSize(
qMin(twf->rect.width() - twf->tabBarSize.width() + overlap, twf->rect.width()), twf->rect.height()));
2694 QSize(
qMin(twf->rect.width() - twf->tabBarSize.width() + overlap, twf->rect.width()), twf->rect.height()));
2704 switch (twf->shape) {
2707 r =
QRect(
QPoint(paneRect.
x(), paneRect.
y() - twf->leftCornerWidgetSize.height()),
2708 twf->leftCornerWidgetSize);
2717 r =
visualRect(twf->direction, twf->rect, r);
2723 switch (twf->shape) {
2727 paneRect.
y() - twf->rightCornerWidgetSize.height()),
2728 twf->rightCornerWidgetSize);
2733 paneRect.
height()), twf->rightCornerWidgetSize);
2738 r =
visualRect(twf->direction, twf->rect, r);
2742 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
2744 QRect dummyIconRect;
2745 d->tabLayout(&tabV3, widget, &r, &dummyIconRect);
2750 if (
const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(opt)) {
2755 hpadding =
qMax(hpadding, 4);
2764 verticalShift = -verticalShift;
2766 qSwap(horizontalShift, verticalShift);
2767 horizontalShift *= -1;
2768 verticalShift *= -1;
2771 horizontalShift = -horizontalShift;
2773 tr.
adjust(0, 0, horizontalShift, verticalShift);
2781 int w = size.
width();
2783 int midHeight =
static_cast<int>(
qCeil(
float(tr.
height() - h) / 2));
2784 int midWidth = ((tr.
width() - w) / 2);
2786 bool atTheTop =
true;
2787 switch (tab->shape) {
2798 r =
QRect(tab->rect.x() + hpadding, midHeight, w, h);
2800 r =
QRect(tab->rect.right() - w - hpadding, midHeight, w, h);
2801 r =
visualRect(tab->direction, tab->rect, r);
2805 r =
QRect(midWidth, tr.
y() + tab->rect.height() - hpadding - h, w, h);
2807 r =
QRect(midWidth, tr.
y() + hpadding, w, h);
2812 #endif // QT_NO_TABWIDGET 2813 #ifndef QT_NO_TABBAR 2815 if (
const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
2816 switch (tab->shape) {
2840 if (
const QStyleOptionFrame *f = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
2841 r = f->rect.
adjusted(f->lineWidth, f->lineWidth, -f->lineWidth, -f->lineWidth);
2854 int frameShape = f->frameShape;
2864 switch (frameShape) {
2872 switch (frameShadow) {
2874 frameWidth = f->lineWidth;
2878 frameWidth = (short)(f->lineWidth*2 + f->midLineWidth);
2897 switch (frameShadow) {
2901 frameWidth = f->lineWidth;
2906 r = f->rect.
adjusted(frameWidth, frameWidth, -frameWidth, -frameWidth);
2909 #ifndef QT_NO_DOCKWIDGET 2921 bool canClose = dwOpt == 0 ? true : dwOpt->
closable;
2922 bool canFloat = dwOpt == 0 ? false : dwOpt->
floatable;
2930 if (verticalTitleBar) {
2945 sz +=
QSize(buttonMargin, buttonMargin);
2946 if (verticalTitleBar)
2951 right = closeRect.
left() - 1;
2962 sz +=
QSize(buttonMargin, buttonMargin);
2963 if (verticalTitleBar)
2968 right = floatRect.
left() - 1;
2976 if (
const QDockWidget *dw = qobject_cast<const QDockWidget*>(widget)) {
2978 if (dw->isFloating())
2979 icon = dw->windowIcon();
2983 if (verticalTitleBar)
2987 left = iconRect.
right() + margin;
3004 if (verticalTitleBar) {
3014 #ifndef QT_NO_ITEMVIEWS 3016 if (!qstyleoption_cast<const QStyleOptionViewItemV4 *>(opt)) {
3024 if (!
d->isViewItemCached(*vopt)) {
3025 d->viewItemLayout(vopt, &
d->checkRect, &
d->decorationRect, &
d->displayRect,
false);
3026 if (
d->cachedOption) {
3027 delete d->cachedOption;
3028 d->cachedOption = 0;
3035 r =
d->decorationRect;
3040 #endif //QT_NO_ITEMVIEWS 3041 #ifndef QT_NO_TOOLBAR 3043 if (
const QStyleOptionToolBar *tbopt = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
3051 r =
QRect(margin, margin, handleExtent, tbopt->rect.height() - 2*margin);
3054 r =
QRect(margin, margin, tbopt->rect.width() - 2*margin, handleExtent);
3059 #endif //QT_NO_TOOLBAR 3072 int r =
qMin(width, height) / 2;
3085 int yc = height / 2;
3094 0.5 + yc - len *
qSin(a));
3096 0.5 + yc - back *
qSin(a +
Q_PI * 5 / 6));
3098 0.5 + yc - back *
qSin(a -
Q_PI * 5 / 6));
3102 #endif // QT_NO_DIAL 3111 #ifndef QT_NO_SLIDER 3113 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
3116 int ticks = slider->tickPosition;
3120 int interval = slider->tickInterval;
3121 if (interval <= 0) {
3122 interval = slider->singleStep;
3127 interval = slider->pageStep;
3131 int fudge = len / 2;
3135 p->
translate(slider->rect.x(), slider->rect.y());
3136 p->
setPen(slider->palette.foreground().color());
3137 int v = slider->minimum;
3138 while (v <= slider->maximum + 1) {
3139 if (v == slider->maximum + 1 && interval == 1)
3141 const int v_ =
qMin(v, slider->maximum);
3143 v_, available) + fudge;
3146 p->
drawLine(pos, 0, pos, tickOffset - 2);
3148 p->
drawLine(pos, tickOffset + thickness + 1, pos,
3149 slider->rect.height()-1);
3152 p->
drawLine(0, pos, tickOffset - 2, pos);
3154 p->
drawLine(tickOffset + thickness + 1, pos,
3155 slider->rect.width()-1, pos);
3158 int nextInterval = v + interval;
3159 if (nextInterval < v)
3167 #endif // QT_NO_SLIDER 3168 #ifndef QT_NO_SCROLLBAR 3170 if (
const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
3173 State saveFlags = scrollbar->state;
3176 newScrollbar.
state = saveFlags;
3185 newScrollbar.
rect = scrollbar->rect;
3186 newScrollbar.
state = saveFlags;
3195 newScrollbar.
rect = scrollbar->rect;
3196 newScrollbar.
state = saveFlags;
3205 newScrollbar.
rect = scrollbar->rect;
3206 newScrollbar.
state = saveFlags;
3215 newScrollbar.
rect = scrollbar->rect;
3216 newScrollbar.
state = saveFlags;
3225 newScrollbar.
rect = scrollbar->rect;
3226 newScrollbar.
state = saveFlags;
3235 newScrollbar.
rect = scrollbar->rect;
3236 newScrollbar.
state = saveFlags;
3245 fropt.QStyleOption::operator=(newScrollbar);
3255 #endif // QT_NO_SCROLLBAR 3260 p->
fillRect(lv->rect, lv->viewportPalette.brush(lv->viewportBGRole));
3263 #endif // QT3_SUPPORT 3264 #ifndef QT_NO_SPINBOX 3266 if (
const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
3303 copy.
state = sb->state;
3328 #endif // QT_NO_SPINBOX 3329 #ifndef QT_NO_TOOLBUTTON 3332 = qstyleoption_cast<const QStyleOptionToolButton *>(opt)) {
3333 QRect button, menuarea;
3344 State mflags = bflags;
3352 tool.
palette = toolbutton->palette;
3356 tool.
state = bflags;
3363 fr.QStyleOption::operator=(*toolbutton);
3367 toolbutton, widget), 0);
3371 label.
state = bflags;
3377 tool.
rect = menuarea;
3378 tool.
state = mflags;
3384 QRect ir = toolbutton->rect;
3391 #endif // QT_NO_TOOLBUTTON 3396 QColor left = tb->palette.highlight().color();
3400 if (left != right) {
3401 QPoint p1(tb->rect.x(), tb->rect.top() + tb->rect.height()/2);
3402 QPoint p2(tb->rect.right(), tb->rect.top() + tb->rect.height()/2);
3404 lg.setColorAt(0, left);
3405 lg.setColorAt(1, right);
3413 p->
setPen(tb->palette.highlightedText().color());
3427 #ifndef QT_NO_DOCKWIDGET 3489 if (drawNormalButton) {
3557 if (!tb->icon.isNull()) {
3558 tb->icon.paint(p, ir);
3572 if (
const QStyleOptionSlider *dial = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
3580 int width = dial->rect.width();
3581 int height = dial->rect.height();
3584 qreal dx = dial->rect.x() + d_ + (width - 2 * r) / 2 + 1;
3585 qreal dy = dial->rect.y() + d_ + (height - 2 * r) / 2 + 1;
3586 QRect br =
QRect(
int(dx),
int(dy),
int(r * 2 - 2 * d_ - 2),
int(r * 2 - 2 * d_ - 2));
3603 p->
drawArc(br, 60 * 16, 180 * 16);
3605 p->
drawArc(br, 240 * 16, 180 * 16);
3617 if (a <= 0 || a > 200) {
3623 }
else if (a > 0 && a < 45) {
3629 }
else if (a >= 45 && a < 135) {
3635 }
else if (a >= 135 && a < 200) {
3645 fropt.
rect = dial->rect;
3646 fropt.
state = dial->state;
3647 fropt.
palette = dial->palette;
3649 br.adjust(0, 0, 2, 2);
3651 int r =
qMin(width, height) / 2;
3652 br.translate(-r / 6, - r / 6);
3653 br.setWidth(br.width() + r / 3);
3654 br.setHeight(br.height() + r / 3);
3662 #endif // QT_NO_DIAL 3663 #ifndef QT_NO_GROUPBOX 3665 if (
const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {
3671 frame.QStyleOption::operator=(*groupBox);
3672 frame.
features = groupBox->features;
3677 QRegion region(groupBox->rect);
3678 if (!groupBox->text.isEmpty()) {
3682 finalRect = checkBoxRect.
united(textRect);
3683 finalRect.
adjust(ltr ? -4 : 0, 0, ltr ? 0 : 4, 0);
3685 finalRect = textRect;
3687 region -= finalRect;
3696 QColor textColor = groupBox->textColor;
3699 int alignment = int(groupBox->textAlignment);
3704 groupBox->palette, groupBox->state &
State_Enabled, groupBox->text,
3709 fropt.QStyleOption::operator=(*groupBox);
3710 fropt.
rect = textRect;
3718 box.QStyleOption::operator=(*groupBox);
3719 box.
rect = checkBoxRect;
3724 #endif // QT_NO_GROUPBOX 3725 #ifndef QT_NO_WORKSPACE 3729 btnOpt.QStyleOption::operator=(*opt);
3786 #endif // QT_NO_WORKSPACE 3789 qWarning(
"QCommonStyle::drawComplexControl: Control %d not handled", cc);
3801 #ifndef QT_NO_SLIDER 3803 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
3814 #endif // QT_NO_SLIDER 3815 #ifndef QT_NO_SCROLLBAR 3817 if (
const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
3830 #endif // QT_NO_SCROLLBAR 3831 #ifndef QT_NO_TOOLBUTTON 3846 #endif // QT_NO_TOOLBUTTON 3850 if (pt.
x() >= 0 && pt.
x() < lv->treeStepSize)
3854 #endif // QT3_SUPPORT 3855 #ifndef QT_NO_SPINBOX 3857 if (
const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
3870 #endif // QT_NO_SPINBOX 3886 #ifndef QT_NO_COMBOBOX 3901 #endif // QT_NO_COMBOBOX 3902 #ifndef QT_NO_GROUPBOX 3904 if (
const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {
3917 #endif // QT_NO_GROUPBOX 3933 qWarning(
"QCommonStyle::hitTestComplexControl: Case %d not handled", cc);
3946 #ifndef QT_NO_SLIDER 3948 if (
const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
3958 slider->sliderPosition,
3959 (horizontal ? slider->rect.width()
3960 : slider->rect.height()) - len,
3961 slider->upsideDown);
3963 ret.
setRect(slider->rect.x() + sliderPos, slider->rect.y() + tickOffset, len, thickness);
3965 ret.
setRect(slider->rect.x() + tickOffset, slider->rect.y() + sliderPos, thickness, len);
3969 ret.
setRect(slider->rect.x(), slider->rect.y() + tickOffset,
3970 slider->rect.width(), thickness);
3972 ret.
setRect(slider->rect.x() + tickOffset, slider->rect.y(),
3973 thickness, slider->rect.height());
3978 ret =
visualRect(slider->direction, slider->rect, ret);
3981 #endif // QT_NO_SLIDER 3982 #ifndef QT_NO_SCROLLBAR 3984 if (
const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
3985 const QRect scrollBarRect = scrollbar->rect;
3988 scrollBarRect.
width() : scrollBarRect.
height()) - (sbextent * 2);
3992 if (scrollbar->maximum != scrollbar->minimum) {
3993 uint range = scrollbar->maximum - scrollbar->minimum;
3994 sliderlen = (
qint64(scrollbar->pageStep) * maxlen) / (range + scrollbar->pageStep);
3997 if (sliderlen < slidermin || range >
INT_MAX / 2)
3998 sliderlen = slidermin;
3999 if (sliderlen > maxlen)
4007 scrollbar->sliderPosition,
4009 scrollbar->upsideDown);
4014 int buttonWidth =
qMin(scrollBarRect.
width() / 2, sbextent);
4017 int buttonHeight =
qMin(scrollBarRect.
height() / 2, sbextent);
4018 ret.
setRect(0, 0, scrollBarRect.
width(), buttonHeight);
4023 int buttonWidth =
qMin(scrollBarRect.
width()/2, sbextent);
4024 ret.
setRect(scrollBarRect.
width() - buttonWidth, 0, buttonWidth, scrollBarRect.
height());
4026 int buttonHeight =
qMin(scrollBarRect.
height()/2, sbextent);
4027 ret.
setRect(0, scrollBarRect.
height() - buttonHeight, scrollBarRect.
width(), buttonHeight);
4032 ret.
setRect(sbextent, 0, sliderstart - sbextent, scrollBarRect.
height());
4034 ret.
setRect(0, sbextent, scrollBarRect.
width(), sliderstart - sbextent);
4038 ret.
setRect(sliderstart + sliderlen, 0,
4039 maxlen - sliderstart - sliderlen + sbextent, scrollBarRect.
height());
4041 ret.
setRect(0, sliderstart + sliderlen, scrollBarRect.
width(),
4042 maxlen - sliderstart - sliderlen + sbextent);
4046 ret.
setRect(sbextent, 0, scrollBarRect.
width() - sbextent * 2,
4050 scrollBarRect.
height() - sbextent * 2);
4054 ret.
setRect(sliderstart, 0, sliderlen, scrollBarRect.
height());
4056 ret.
setRect(0, sliderstart, scrollBarRect.
width(), sliderlen);
4061 ret =
visualRect(scrollbar->direction, scrollBarRect, ret);
4064 #endif // QT_NO_SCROLLBAR 4065 #ifndef QT_NO_SPINBOX 4067 if (
const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
4074 int y = fw + spinbox->rect.y();
4076 x = spinbox->rect.x() + spinbox->rect.
width() - fw - bs.
width();
4093 ret =
QRect(lx, fw, spinbox->rect.width() - 2*fw, spinbox->rect.height() - 2*fw);
4095 ret =
QRect(lx, fw, rx, spinbox->rect.height() - 2*fw);
4099 ret = spinbox->rect;
4103 ret =
visualRect(spinbox->direction, spinbox->rect, ret);
4106 #endif // Qt_NO_SPINBOX 4107 #ifndef QT_NO_TOOLBUTTON 4117 ret.
adjust(0, 0, -mbi, 0);
4128 ret =
visualRect(tb->direction, tb->rect, ret);
4131 #endif // QT_NO_TOOLBUTTON 4132 #ifndef QT_NO_COMBOBOX 4135 int x = cb->rect.x(),
4137 wi = cb->rect.width(),
4138 he = cb->rect.height();
4140 int margin = cb->frame ? 3 : 0;
4141 int bmarg = cb->frame ? 2 : 0;
4142 xpos += wi - bmarg - 16;
4150 ret.
setRect(xpos, y + bmarg, 16, he - 2*bmarg);
4153 ret.
setRect(x + margin, y + margin, wi - 2 * margin - 16, he - 2 * margin);
4161 ret =
visualRect(cb->direction, cb->rect, ret);
4164 #endif // QT_NO_COMBOBOX 4167 const int controlMargin = 2;
4168 const int controlHeight = tb->rect.height() - controlMargin *2;
4169 const int delta = controlHeight + controlMargin;
4180 ret.
adjust(delta, 0, -delta, 0);
4182 ret.
adjust(0, 0, -delta, 0);
4184 ret.
adjust(0, 0, -delta, 0);
4186 ret.
adjust(0, 0, -delta, 0);
4188 ret.
adjust(0, 0, -delta, 0);
4226 ret.
setRect(tb->rect.right() - offset, tb->rect.top() + controlMargin,
4227 controlHeight, controlHeight);
4231 ret.
setRect(tb->rect.left() + controlMargin, tb->rect.top() + controlMargin,
4232 controlHeight, controlHeight);
4238 ret =
visualRect(tb->direction, tb->rect, ret);
4241 #ifndef QT_NO_GROUPBOX 4243 if (
const QStyleOptionGroupBox *groupBox = qstyleoption_cast<const QStyleOptionGroupBox *>(opt)) {
4252 topHeight = groupBox->fontMetrics.height();
4254 topMargin = topHeight / 2;
4256 topMargin = topHeight;
4259 QRect frameRect = groupBox->rect;
4260 frameRect.
setTop(topMargin);
4268 if (!(widget && widget->
inherits(
"Q3GroupBox"))
4272 ret = frameRect.
adjusted(frameWidth, frameWidth + topHeight - topMargin,
4273 -frameWidth, -frameWidth);
4280 int h = fontMetrics.
height();
4283 ret = groupBox->rect.
adjusted(marg, 0, -marg, 0);
4289 int checkBoxSize = hasCheckBox ? (indicatorWidth + indicatorSpace) : 0;
4292 QRect totalRect =
alignedRect(groupBox->direction, groupBox->textAlignment,
4293 QSize(tw + checkBoxSize, h), ret);
4302 left = ltr ? totalRect.left() : (totalRect.right() - indicatorWidth);
4303 int top = totalRect.top() + (fontMetrics.
height() - indicatorHeight) / 2;
4304 totalRect.setRect(left, top, indicatorWidth, indicatorHeight);
4307 left = ltr ? (totalRect.left() + checkBoxSize - 2) : totalRect.left();
4308 totalRect.setRect(left, totalRect.top(),
4309 totalRect.width() - checkBoxSize, totalRect.height());
4321 #endif // QT_NO_GROUPBOX 4322 #ifndef QT_NO_WORKSPACE 4325 int numSubControls = 0;
4332 if (numSubControls == 0)
4335 int buttonWidth = opt->
rect.
width()/ numSubControls - 1;
4340 if (numSubControls == 1)
4342 offset += buttonWidth + 2;
4351 offset += buttonWidth;
4360 if (numSubControls == 1)
4365 #endif // QT_NO_WORKSPACE 4367 qWarning(
"QCommonStyle::subControlRect: Case %d not handled", cc);
4403 #ifndef QT_NO_DOCKWIDGET 4404 }
else if (qobject_cast<const QDockWidget*>(widget)) {
4458 #ifndef QT_NO_SCROLLBAR 4460 if (
const QStyleOptionSlider *sb = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
4474 #ifndef QT_NO_SLIDER 4480 if (
const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
4481 int space = (sl->orientation ==
Qt::Horizontal) ? sl->rect.height()
4484 int ticks = sl->tickPosition;
4487 ret = (space - thickness) / 2;
4489 ret = space - thickness;
4498 if (
const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
4507 #endif // QT_NO_SLIDER 4508 #ifndef QT_NO_DOCKWIDGET 4522 #endif // QT_NO_DOCKWIDGET 4533 #ifndef QT_NO_TOOLBAR 4557 #endif // QT_NO_TOOLBAR 4559 #ifndef QT_NO_TABBAR 4640 bool isWindow =
false;
4643 }
else if (widget) {
4741 if (
const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
4742 int w = csz.
width(),
4758 if (
const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
4768 if (!btn->icon.isNull() || !btn->text.isEmpty())
4771 sz +=
QSize(w + margins, 4);
4778 bool checkable = mi->menuHasCheckableItems;
4779 int maxpmw = mi->maxIconWidth;
4785 h = mi->fontMetrics.height() + 8;
4786 if (!mi->icon.isNull()) {
4788 h =
qMax(h, mi->icon.actualSize(
QSize(iconExtent, iconExtent)).height() + 4);
4795 if (checkable && maxpmw < 20)
4797 if (checkable || maxpmw > 0)
4803 #endif // QT_NO_MENU 4804 #ifndef QT_NO_TOOLBUTTON 4808 #endif // QT_NO_TOOLBUTTON 4809 #ifndef QT_NO_COMBOBOX 4819 #endif // QT_NO_COMBOBOX 4821 if (
const QStyleOptionHeader *hdr = qstyleoption_cast<const QStyleOptionHeader *>(opt)) {
4822 bool nullIcon = hdr->icon.isNull();
4825 QSize txt = hdr->fontMetrics.size(0, hdr->text);
4827 sz.
setWidth((nullIcon ? 0 : margin) + iconSize
4828 + (hdr->text.isNull() ? 0 : margin) + txt.
width() + margin);
4835 if (
const QStyleOptionFrame *f = qstyleoption_cast<const QStyleOptionFrame *>(opt))
4836 sz +=
QSize(2*f->lineWidth, 2*f->lineWidth);
4838 #ifndef QT_NO_GROUPBOX 4840 if (
const QGroupBox *grb = static_cast<const QGroupBox *>(widget))
4841 sz +=
QSize(!grb->isFlat() ? 16 : 0, 0);
4843 #endif // QT_NO_GROUPBOX 4845 if (
const QStyleOptionComplex *styleOpt = qstyleoption_cast<const QStyleOptionComplex *>(opt)) {
4853 sz =
QSize(width, 16);
4858 #ifndef QT_NO_ITEMVIEWS 4861 QRect decorationRect, displayRect, checkRect;
4862 d->viewItemLayout(vopt, &checkRect, &decorationRect, &displayRect,
true);
4863 sz = (decorationRect|displayRect|checkRect).size();
4866 #endif // QT_NO_ITEMVIEWS 4906 #ifndef QT_NO_GROUPBOX 4914 #endif // QT_NO_GROUPBOX 4923 ret = Qt::WindowsStyle;
5025 mask->region = widget->
rect();
5028 mask->region -=
QRect(widget->
rect().
adjusted(hmargin, vmargin, -hmargin, -vmargin));
5032 #ifndef QT_NO_RUBBERBAND 5039 mask->region = opt->
rect;
5041 mask->region -= opt->
rect.
adjusted(margin, margin, -margin, -margin);
5046 #endif // QT_NO_RUBBERBAND 5113 #ifndef QT_NO_TABWIDGET 5127 vret->variant = fmt;
5130 #ifndef QT_NO_WIZARD 5153 #ifndef QT_NO_TABBAR 5180 #ifdef QT_NO_IMAGEFORMAT_PNG 5329 if (!fileIcon.
isNull()) {
5354 #endif //QT_NO_IMAGEFORMAT_PNG 5356 #ifndef QT_NO_IMAGEFORMAT_XPM 5371 #ifndef QT_NO_IMAGEFORMAT_PNG 5432 return QPixmap(
QLatin1String(
":/trolltech/styles/commonstyle/images/standardbutton-ok-16.png"));
5434 return QPixmap(
QLatin1String(
":/trolltech/styles/commonstyle/images/standardbutton-cancel-16.png"));
5436 return QPixmap(
QLatin1String(
":/trolltech/styles/commonstyle/images/standardbutton-help-16.png"));
5438 return QPixmap(
QLatin1String(
":/trolltech/styles/commonstyle/images/standardbutton-open-16.png"));
5440 return QPixmap(
QLatin1String(
":/trolltech/styles/commonstyle/images/standardbutton-save-16.png"));
5442 return QPixmap(
QLatin1String(
":/trolltech/styles/commonstyle/images/standardbutton-close-16.png"));
5444 return QPixmap(
QLatin1String(
":/trolltech/styles/commonstyle/images/standardbutton-apply-16.png"));
5446 return QPixmap(
QLatin1String(
":/trolltech/styles/commonstyle/images/standardbutton-clear-16.png"));
5448 return QPixmap(
QLatin1String(
":/trolltech/styles/commonstyle/images/standardbutton-delete-16.png"));
5450 return QPixmap(
QLatin1String(
":/trolltech/styles/commonstyle/images/standardbutton-yes-16.png"));
5452 return QPixmap(
QLatin1String(
":/trolltech/styles/commonstyle/images/standardbutton-no-16.png"));
5464 return QPixmap(
QLatin1String(
":/trolltech/styles/commonstyle/images/media-seek-forward-32.png"));
5466 return QPixmap(
QLatin1String(
":/trolltech/styles/commonstyle/images/media-seek-backward-32.png"));
5468 return QPixmap(
QLatin1String(
":/trolltech/styles/commonstyle/images/media-skip-forward-32.png"));
5470 return QPixmap(
QLatin1String(
":/trolltech/styles/commonstyle/images/media-skip-backward-32.png"));
5474 return QPixmap(
QLatin1String(
":/trolltech/styles/commonstyle/images/media-volume-muted-16.png"));
5475 #endif // QT_NO_IMAGEFORMAT_PNG 5491 switch (standardIcon) {
5632 if (!linkIcon.
isNull()) {
5635 for (
int i = 0 ; i < sizes.
size() ; ++i) {
5636 int size = sizes[i].width();
5640 painter.
drawPixmap(size/2, size/2, linkPixmap);
5649 if (!linkIcon.
isNull()) {
5652 for (
int i = 0 ; i < sizes.
size() ; ++i) {
5653 int size = sizes[i].width();
5657 painter.
drawPixmap(size/2, size/2, linkPixmap);
5669 #if defined(Q_WS_MAC) 5671 OSType iconType = 0;
5672 switch (standardIcon) {
5674 iconType = kQuestionMarkIcon;
5677 iconType = kAlertNoteIcon;
5680 iconType = kAlertCautionIcon;
5683 iconType = kAlertStopIcon;
5686 iconType = kDesktopIcon;
5689 iconType = kTrashIcon;
5692 iconType = kComputerIcon;
5695 iconType = kGenericFloppyIcon;
5698 iconType = kGenericHardDiskIcon;
5702 iconType = kGenericCDROMIcon;
5705 iconType = kGenericNetworkIcon;
5708 iconType = kOpenFolderIcon;
5712 iconType = kGenericFolderIcon;
5716 iconType = kGenericDocumentIcon;
5738 return titleBarIcon;
5743 if (iconType != 0) {
5747 if (iconType != kGenericApplicationIcon) {
5748 GetIconRef(kOnSystemDisk, kSystemIconsCreator, iconType, &icon);
5751 ProcessSerialNumber psn = { 0, kCurrentProcess };
5752 GetProcessBundleLocation(&psn, &fsRef);
5753 GetIconRefFromFileInfo(&fsRef, 0, 0, 0, 0, kIconServicesNormalUsageFlag, &icon, 0);
5756 GetIconRef(kOnSystemDisk, kSystemIconsCreator, kAlertCautionIcon, &icon);
5761 ReleaseIconRef(icon);
5764 ReleaseIconRef(overlayIcon);
5770 switch (standardIcon) {
5771 #ifndef QT_NO_IMAGEFORMAT_PNG 5966 #endif // QT_NO_IMAGEFORMAT_PNG 5977 return (77 * r + 150 * g + 28 * b) / 255;
5993 uchar reds[256], greens[256], blues[256];
5994 for (
int i=0; i<128; ++i) {
5995 reds[i] =
uchar((red * (i<<1)) >> 8);
5996 greens[i] =
uchar((green * (i<<1)) >> 8);
5997 blues[i] =
uchar((blue * (i<<1)) >> 8);
5999 for (
int i=0; i<128; ++i) {
6000 reds[i+128] =
uchar(
qMin(red + (i << 1), 255));
6001 greens[i+128] =
uchar(
qMin(green + (i << 1), 255));
6002 blues[i+128] =
uchar(
qMin(blue + (i << 1), 255));
6006 const int factor = 191;
6011 if ((red - factor > green && red - factor > blue)
6012 || (green - factor > red && green - factor > blue)
6013 || (blue - factor > red && blue - factor > green))
6014 intensity =
qMin(255, intensity + 91);
6015 else if (intensity <= 128)
6018 for (
int y=0; y<im.
height(); ++y) {
6020 for (
int x=0; x<im.
width(); ++x) {
6021 QRgb pixel = *scanLine;
6025 *scanLine =
qRgba(reds[ci], greens[ci], blues[ci],
qAlpha(pixel));
6087 d->tabBarcloseButtonIcon =
QIcon();
void setTransform(const QTransform &transform, bool combine=false)
Sets the world transformation matrix.
void setBackgroundMode(Qt::BGMode mode)
Sets the background mode of the painter to the given mode.
The QPainter class performs low-level painting on widgets and other paint devices.
The QColor class provides colors based on RGB, HSV or CMYK values.
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 void unpolish(QWidget *)
Uninitialize the given {widget}'s appearance.
int height
the height of the item
The QStyleHintReturnVariant class provides style hints that return a QVariant.
QImage toImage() const
Converts the pixmap to a QImage.
void setText(const QString &string)
Sets the layout's text to the given string.
const QBrush & highlight() const
Returns the highlight brush of the current color group.
The QApplication class manages the GUI application's control flow and main settings.
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.
void drawPath(const QPainterPath &path)
Draws the given painter path using the current pen for outline and the current brush for filling...
QRect adjusted(int x1, int y1, int x2, int y2) const
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
void setHeight(int h)
Sets the height of the rectangle to the given height.
const QBrush & base() const
Returns the base brush of the current color group.
SubControl
This enum describes the available sub controls.
QFont font
the font used for the item
The QTextCharFormat class provides formatting information for characters in a QTextDocument.
StyleHint
This enum describes the available style hints.
QList< QSize > availableSizes(Mode mode=Normal, State state=Off) const
Returns a list of available icon sizes for the specified mode and state.
void drawArc(const QRectF &rect, int a, int alen)
Draws the arc defined by the given rectangle, startAngle and spanAngle.
Qt::Alignment decorationAlignment
the alignment of the decoration for the item
The QStyleHintReturn class provides style hints that return more than basic data types.
void setBottom(int pos)
Sets the bottom edge of the rectangle to the given y coordinate.
static uint qt_intensity(uint r, uint g, uint b)
void addPixmap(const QPixmap &pixmap, Mode mode=Normal, State state=Off)
Adds pixmap to the icon, as a specialization for mode and state.
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
The QFontMetrics class provides font metrics information.
QString elidedText(Qt::TextElideMode mode, const QFixed &width, int flags=0) const
void setColorAt(qreal pos, const QColor &color)
Creates a stop point at the given position with the given color.
#define QT_END_NAMESPACE
This macro expands to.
qreal y() const
Returns the line's y position.
const QColor & color() const
Returns the brush color.
void setPosition(const QPointF &pos)
Moves the line to position pos.
int width() const
Returns the width of the pixmap.
QPointer< QWidget > widget
QSize size() const
Returns the size of the pixmap.
QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget=0) const
Reimplemented Function
ColorRole
The ColorRole enum defines the different symbolic color roles used in current GUIs.
void qDrawPlainRect(QPainter *p, int x, int y, int w, int h, const QColor &c, int lineWidth, const QBrush *fill)
const QBrush & dark() const
Returns the dark brush of the current color group.
The QMatrix class specifies 2D transformations of a coordinate system.
QStyle::State state
the style flags that are used when drawing the control
The QFlag class is a helper data type for QFlags.
int descent() const
Returns the descent of the font.
void qDrawShadeRect(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken, int lineWidth, int midLineWidth, const QBrush *fill)
Q_GUI_EXPORT_INLINE int qAlpha(QRgb rgb)
The QPainterPath class provides a container for painting operations, enabling graphical shapes to be ...
void setProperty(int propertyId, const QVariant &value)
Sets the property specified by the propertyId to the given value.
virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget=0) const =0
Returns the rectangle containing the specified subControl of the given complex control (with the styl...
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...
static QSize globalStrut()
static QIcon fromTheme(const QString &name, const QIcon &fallback=QIcon())
Returns the QIcon corresponding to name in the current icon theme.
int margin
the width of the outside border of the layout
void rotate(qreal a)
Rotates the coordinate system the given angle clockwise.
const QBrush & background() const
Use window() instead.
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=0, const QWidget *widget=0) const =0
Returns the value of the given pixel metric.
ComplexControl
This enum describes the available complex controls.
The QStyleOptionQ3ListView class is used to describe the parameters for drawing a Q3ListView...
QRect united(const QRect &other) const
Returns the bounding rectangle of this rectangle and the given rectangle.
static C reverse(const C &l)
void setClipRect(const QRectF &, Qt::ClipOperation op=Qt::ReplaceClip)
Enables clipping, and sets the clip region to the given rectangle using the given clip operation...
static bool verticalTabs(QTabBar::Shape shape)
Qt::Orientation orientation
the progress bar's orientation (horizontal or vertical); the default orentation is Qt::Horizontal ...
The QPointF class defines a point in the plane using floating point precision.
void closeSubpath()
Closes the current subpath by drawing a line to the beginning of the subpath, automatically starting ...
void setFont(const QFont &f)
Sets the layout's font to the given font.
The QTextLine class represents a line of text inside a QTextLayout.
The QStyleOptionTitleBar class is used to describe the parameters for drawing a title bar...
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
void restore()
Restores the current painter state (pops a saved state off the stack).
The QStyleOptionViewItemV4 class is used to describe the parameters necessary for drawing a frame in ...
Position decorationPosition
the position of the decoration for the item
int textLength() const
Returns the length of the text in the line.
State
This enum describes the state for which a pixmap is intended to be used.
PixelMetric
This enum describes the various available pixel metrics.
virtual int styleHint(StyleHint stylehint, const QStyleOption *opt=0, const QWidget *widget=0, QStyleHintReturn *returnData=0) const =0
Returns an integer representing the specified style hint for the given widget described by the provid...
QSize expandedTo(const QSize &) const
Returns a size holding the maximum width and height of this size and the given otherSize.
int left() const
Returns the x-coordinate of the rectangle's left edge.
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
int width() const
Returns the width of the rectangle.
Qt::TextElideMode textElideMode
where ellipsis should be added for text that is too long to fit into an item
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
const QBrush & foreground() const
Use windowText() instead.
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.
long ASN1_INTEGER_get ASN1_INTEGER * a
QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *opt) const
Reimplemented Function
QRect intersected(const QRect &other) const
Returns the intersection of this rectangle and the given rectangle.
void setLineWidth(qreal width)
Lays out the line with the given width.
QStyle::SubControls activeSubControls
This variable holds a bitwise OR of the sub-controls that are active for the complex control...
The QPolygon class provides a vector of points using integer precision.
void addPolygon(const QPolygonF &polygon)
Adds the given polygon to the path as an (unclosed) subpath.
void drawLine(const QLineF &line)
Draws a line defined by line.
ushort red
Returns the red color component of this color.
int height() const
Returns the height of the rectangle.
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
The QString class provides a Unicode character string.
QFontMetrics fontMetrics
the font metrics that should be used when drawing text in the control
void setHeight(int h)
Sets the height to the given height.
T * qobject_cast(QObject *object)
The QVector class is a template class that provides a dynamic array.
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
QMatrix & translate(qreal dx, qreal dy)
Moves the coordinate system dx along the x axis and dy along the y axis, and returns a reference to t...
const QColor & color(ColorGroup cg, ColorRole cr) const
Returns the color in the specified color group, used for the given color role.
The QPen class defines how a QPainter should draw lines and outlines of shapes.
void setBrushOrigin(int x, int y)
Sets the brush's origin to point (x, y).
QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *opt=0, const QWidget *widget=0) const
Reimplemented Function
The QStyleOptionSizeGrip class is used to describe the parameter for drawing a size grip...
bool isValid() const
Returns true if this text line is valid; otherwise returns false.
static const char *const tb_extension_arrow_v_xpm[]
QSize boundedTo(const QSize &) const
Returns a size holding the minimum width and height of this size and the given otherSize.
qreal ascent() const
Returns the line's ascent.
The QSizeF class defines the size of a two-dimensional object using floating point precision...
The QChar class provides a 16-bit Unicode character.
QTabBar::Shape shape
the tab shape used to draw the tab; by default QTabBar::RoundedNorth
void moveTo(const QPointF &p)
Moves the current point to the given point, implicitly starting a new subpath and closing the previou...
static int sliderPositionFromValue(int min, int max, int val, int space, bool upsideDown=false)
Converts the given logicalValue to a pixel position.
Q_CORE_EXPORT QTextStream & right(QTextStream &s)
void save()
Saves the current painter state (pushes the state onto a stack).
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
StandardPixmap
This enum describes the available standard pixmaps.
void getHsv(int *h, int *s, int *v, int *a=0) const
Sets the contents pointed to by h, s, v, and a, to the hue, saturation, value, and alpha-channel (tra...
qreal x() const
Returns the x-coordinate of this point.
bool dialWrapping
whether the dial should wrap or not
The QLineF class provides a two-dimensional vector using floating point precision.
void setWidth(int w)
Sets the width to the given width.
QColor backgroundColor
the background color on which the focus rectangle is being drawn
virtual ~QStyle()
Destroys the style object.
void lineTo(const QPointF &p)
Adds a straight line from the current position to the given endPoint.
void setCurrentColorGroup(ColorGroup cg)
Set the palette's current color group to cg.
bool upsideDown
the slider control orientation
int lineWidth
the line width for drawing the frame
The QStyleOptionProgressBarV2 class is used to describe the parameters necessary for drawing a progre...
int width() const
Returns the width.
void translate(int dx, int dy)
Translates all points in the polygon by ({dx}, {dy}).
static QIcon windowIcon()
QRegion clipRegion() const
Returns the currently set clip region.
void setAlignment(Qt::Alignment alignment)
Sets the option's text alignment to the specified alignment.
void drawText(const QPointF &p, const QString &s)
Draws the given text with the currently defined text direction, beginning at the given position...
void setRenderHint(RenderHint hint, bool on=true)
Sets the given render hint on the painter if on is true; otherwise clears the render hint...
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=0, const QWidget *widget=0) const
Returns an icon for the given standardIcon.
QString text() const
Returns the layout's text.
const QPen & pen() const
Returns the painter's current pen.
#define QT_BEGIN_NAMESPACE
This macro expands to.
void drawEllipse(const QRectF &r)
Draws the ellipse defined by the given rectangle.
QFontMetrics fontMetrics() const
Returns the font metrics for the painter if the painter is active.
Q_GUI_EXPORT_INLINE QRgb qRgba(int r, int g, int b, int a)
The QRectF class defines a rectangle in the plane using floating point precision. ...
void tabLayout(const QStyleOptionTabV3 *opt, const QWidget *widget, QRect *textRect, QRect *pixmapRect) const
Q_GUI_EXPORT EGLDisplay display()
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...
void setBold(bool)
If enable is true sets the font's weight to QFont::Bold ; otherwise sets the weight to QFont::Normal...
ViewItemFeatures features
a bitwise OR of the features that describe this view item
int calcBigLineSize(int radius)
The QStyleOptionQ3ListViewItem class is used to describe an item drawn in a Q3ListView.
static bool isEmpty(const char *str)
QMatrix & rotate(qreal a)
Rotates the coordinate system the given degrees counterclockwise.
QPoint bottomRight() const
Returns the position of the rectangle's bottom-right corner.
QPoint brushOrigin() const
Returns the currently set brush origin.
const QBrush & light() const
Returns the light brush of the current color group.
void drawLines(const QLineF *lines, int lineCount)
Draws the first lineCount lines in the array lines using the current pen.
QSize size(int flags, const QString &str, int tabstops=0, int *tabarray=0) const
Returns the size in pixels of text.
The QStyleOption class stores the parameters used by QStyle functions.
void qDrawWinPanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken, const QBrush *fill)
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
ContentsType
This enum describes the available contents types.
void viewItemDrawText(QPainter *p, const QStyleOptionViewItemV4 *option, const QRect &rect) const
The QStyleOptionSpinBox class is used to describe the parameters necessary for drawing a spin box...
void setTop(int pos)
Sets the top edge of the rectangle to the given y coordinate.
const QFont & font() const
Returns the currently set font used for drawing text.
QSize size() const
Returns the size of the rectangle.
Mode
This enum type describes the mode for which a pixmap is intended to be used.
The QStyleOptionQ3DockWindow class is used to describe the parameters for drawing various parts of a ...
bool isNull() const
Returns true if the icon is empty; otherwise returns false.
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
void setRight(int pos)
Sets the right edge of the rectangle to the given x coordinate.
The QPolygonF class provides a vector of points using floating point precision.
virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given primitive element with the provided painter using the style options specified by opti...
The QStyleOptionFocusRect class is used to describe the parameters for drawing a focus rectangle with...
QCommonStyle()
Constructs a QCommonStyle.
Q_CORE_EXPORT void qWarning(const char *,...)
Q3ListViewItemFeatures features
the features for this item
void setSize(const QSize &s)
Sets the size of the rectangle to the given size.
bool showDecorationSelected
whether the decoration should be highlighted on selected items
The QImage class provides a hardware-independent image representation that allows direct access to th...
static QString themeName()
Returns the name of the current icon theme.
void transpose()
Swaps the width and height values.
The QStyleOptionFrame class is used to describe the parameters for drawing a frame.
qreal x() const
Returns the line's x position.
bool inFont(QChar) const
Returns true if character ch is a valid character in the font; otherwise returns false.
The QGroupBox widget provides a group box frame with a title.
QPaintEngine * paintEngine() const
Returns the paint engine that the painter is currently operating on if the painter is active; otherwi...
QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *widget=0) const
Reimplemented Function
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...
int sliderPosition
the position of the slider handle
void qDrawShadePanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken, int lineWidth, const QBrush *fill)
The QRegion class specifies a clip region for a painter.
void setTextDirection(Qt::LayoutDirection aDirection)
Sets the direction of the text layout defined by the option to the given direction.
The QStyleOptionTabBarBase class is used to describe the base of a tab bar, i.e.
int pixelMetric(PixelMetric m, const QStyleOption *opt=0, const QWidget *widget=0) const
Reimplemented Function
void polish(QPalette &)
Reimplemented Function
The State element defines configurations of objects and properties.
void setCoords(int x1, int y1, int x2, int y2)
Sets the coordinates of the rectangle's top-left corner to (x1, y1), and the coordinates of its botto...
void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
QImage mirrored(bool horizontally=false, bool vertically=true) const
Returns a mirror of the image, mirrored in the horizontal and/or the vertical direction depending on ...
static const char *const tree_branch_open_xpm[]
The QStyleOptionRubberBand class is used to describe the parameters needed for drawing a rubber band...
bool inherits(const char *classname) const
Returns true if this object is an instance of a class that inherits className or a QObject subclass t...
QTextLine lineAt(int i) const
Returns the {i}-th line of text in this text layout.
FrameFeatures features
a bitwise OR of the features that describe this frame.
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth)
void qSwap(T &value1, T &value2)
void moveTopLeft(const QPoint &p)
Moves the rectangle, leaving the top-left corner at the given position.
void unpolish(QWidget *widget)
Reimplemented Function
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
QSize rightButtonSize
the size for the right widget on the tab.
void viewItemLayout(const QStyleOptionViewItemV4 *opt, QRect *checkRect, QRect *pixmapRect, QRect *textRect, bool sizehint) const
Set sizehint to false to layout the elements inside opt->rect.
static const char *const filedialog_start_xpm[]
qreal dpiScaled(qreal value)
QPoint topRight() const
Returns the position of the rectangle's top-right corner.
const QBrush & brush() const
Returns the painter's current brush.
void drawTiledPixmap(const QRectF &rect, const QPixmap &pm, const QPointF &offset=QPointF())
Draws a tiled pixmap, inside the given rectangle with its origin at the given position.
bool isEmpty() const
Returns true if the rectangle is empty, otherwise returns false.
QPalette palette
the palette that should be used when painting the control
The QBrush class defines the fill pattern of shapes drawn by QPainter.
QPoint center() const
Returns the center point of the rectangle.
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
virtual void drawItemPixmap(QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const
Draws the given pixmap in the specified rectangle, according to the specified alignment, using the provided painter.
Q_GUI_EXPORT_INLINE int qGray(int r, int g, int b)
The QStyleHintReturnMask class provides style hints that return a QRegion.
int top() const
Returns the y-coordinate of the rectangle's top edge.
qreal angle(const QPointF &p1, const QPointF &p2)
int width() const
Returns the width of the image.
int maximum
the maximum value for the slider
The QTextLayout class is used to lay out and render text.
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...
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...
virtual QRect subElementRect(SubElement subElement, const QStyleOption *option, const QWidget *widget=0) const =0
Returns the sub-area for the given element as described in the provided style option.
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const Q_REQUIRED_RESULT
Returns a copy of the image in the given format.
ushort blue
Returns the blue color component of this color.
void setClipRegion(const QRegion &, Qt::ClipOperation op=Qt::ReplaceClip)
Sets the clip region to the given region using the specified clip operation.
int right() const
Returns the x-coordinate of the rectangle's right edge.
QPolygonF calcLines(const QStyleOptionSlider *dial)
void setCompositionMode(CompositionMode mode)
Sets the composition mode to the given mode.
static const char *const filedialog_end_xpm[]
PrimitiveElement
This enum describes the various primitive elements.
void setAlphaF(qreal alpha)
Sets the alpha of this color to alpha.
void setLeft(int pos)
Sets the left edge of the rectangle to the given x coordinate.
The QLinearGradient class is used in combination with QBrush to specify a linear gradient brush...
qint64 cacheKey() const
Returns a number that identifies the contents of this QIcon object.
The QFont class specifies a font used for drawing text.
int y() const
Returns the y-coordinate of the rectangle's top edge.
const QBrush & highlightedText() const
Returns the highlighted text brush of the current color group.
static const char *const tree_branch_closed_xpm[]
int midLineWidth
the mid-line width for drawing the frame
T qstyleoption_cast(const QStyleOption *opt)
QTextLine createLine()
Returns a new text line to be laid out if there is text to be inserted into the layout; otherwise ret...
qreal naturalTextWidth() const
Returns the width of the line that is occupied by text.
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.
int minimum
the minimum value for the slider
void setTextOption(const QTextOption &option)
Sets the text option structure that controls the layout process to the given option.
void eraseRect(const QRectF &)
Erases the area inside the given rectangle.
int x() const
Returns the x-coordinate of the rectangle's left edge.
The QStyleOptionFrameV3 class is used to describe the parameters necessary for drawing a frame in Qt ...
QSize viewItemSize(const QStyleOptionViewItemV4 *option, int role) const
void setRect(int x, int y, int w, int h)
Sets the coordinates of the rectangle's top-left corner to ({x}, {y}), and its size to the given widt...
Qt::Alignment displayAlignment
the alignment of the display value for the item
The QCommonStyle class encapsulates the common Look and Feel of a GUI.
The QPoint class defines a point in the plane using integer precision.
void setColor(ColorGroup cg, ColorRole cr, const QColor &color)
Sets the color in the specified color group, used for the given color role, to the specified solid co...
void setBrush(const QBrush &brush)
Sets the painter's brush to the given brush.
virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const =0
Draws the given element with the provided painter with the style options specified by option...
QSize decorationSize
the size of the decoration for the item
int size() const
Returns the number of items in the list.
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI...
static bool desktopSettingsAware()
Returns true if Qt is set to use the system's standard colors, fonts, etc.
The QStyleOptionGroupBox class describes the parameters for drawing a group box.
const QBrush & toolTipBase() const
Returns the tool tip base brush of the current color group.
The QStyleOptionComboBox class is used to describe the parameter for drawing a combobox.
void setWidth(int w)
Sets the width of the rectangle to the given width.
void setPen(const QColor &color)
Sets the painter's pen to have style Qt::SolidLine, width 0 and the specified color.
QSize iconSize
the size for the icons
qreal width() const
Returns the line's width as specified by the layout() function.
The QStyleOptionTabV3 class is used to describe the parameters necessary for drawing a tabs in Qt 4...
int height() const
Returns the height.
Qt::LayoutDirection direction
the text layout direction that should be used when drawing text in the control
static QPolygonF calcArrow(const QStyleOptionSlider *dial, qreal &a)
The QRect class defines a rectangle in the plane using integer precision.
void setPoint(int index, int x, int y)
Sets the point at the given index to the point specified by ({x}, {y}).
bool isValid() const
Returns true if both the width and height is equal to or greater than 0; otherwise returns false...
void qt_mac_constructQIconFromIconRef(const IconRef icon, const IconRef overlayIcon, QIcon *retIcon, QStyle::StandardPixmap standardIcon)
SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *w=0) const
Reimplemented Function
static const char *const check_list_controller_xpm[]
The QTextOption class provides a description of general rich text properties.
void getRect(int *x, int *y, int *w, int *h) const
Extracts the position of the rectangle's top-left corner to *x and *y, and its dimensions to *width a...
int height() const
Returns the height of the image.
The QStyleOptionFrameV2 class is used to describe the parameters necessary for drawing a frame in Qt ...
void drawRect(const QRectF &rect)
Draws the current rectangle with the current pen and brush.
int y() const
Returns the y coordinate of this point.
qreal y() const
Returns the y-coordinate of this point.
const QStyle * proxy() const
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=0) const
Reimplemented Function
The QPixmap class is an off-screen image representation that can be used as a paint device...
The QStyleOptionTab class is used to describe the parameters for drawing a tab bar.
QIcon icon
the icon for the tab
virtual void polish(QWidget *)
Initializes the appearance of the given widget.
const QBrush & toolTipText() const
Returns the tool tip text brush of the current color group.
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 drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device...
int height() const
Returns the height of the pixmap.
ControlElement
This enum represents a control element.
The QStyleOptionSlider class is used to describe the parameters needed for drawing a slider...
void setWrapMode(WrapMode wrap)
Sets the option's text wrap mode to the given mode.
The QSize class defines the size of a two-dimensional object using integer point precision.
void setFont(const QFont &f)
Sets the painter's font to the given font.
void setPoints(int nPoints, const int *points)
Resizes the polygon to nPoints and populates it with the given points.
const QBrush & buttonText() const
Returns the button text foreground brush of the current color group.
QIcon standardIconImplementation(StandardPixmap standardIcon, const QStyleOption *opt=0, const QWidget *widget=0) const
void reserve(int size)
Attempts to allocate memory for at least size elements.
int x() const
Returns the x coordinate of this point.
The QStyleOptionComplex class is used to hold parameters that are common to all complex controls...
~QCommonStyle()
Destroys the style.
void endLayout()
Ends the layout process.
bool isValid() const
Returns true if the color is valid; otherwise returns false.
The QStyleOptionViewItem class is used to describe the parameters used to draw an item in a view widg...
QRgb rgba() const
Returns the RGB value of the color, including its alpha.
QRegion region
the region for style hints that return a QRegion
bool isEmpty() const
Returns true if either of the width and height is less than or equal to 0; otherwise returns false...
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
The QStyleOptionProgressBar class is used to describe the parameters necessary for drawing a progress...
QSize leftButtonSize
the size for the left widget on the tab.
int height() const
Returns the height of the font.
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
void translate(int dx, int dy)
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position...
const QBrush & button() const
Returns the button brush of the current color group.
void qDrawShadeLine(QPainter *p, int x1, int y1, int x2, int y2, const QPalette &pal, bool sunken, int lineWidth, int midLineWidth)
bool invertedAppearance
whether the progress bar's appearance is inverted
void drawPolyline(const QPointF *points, int pointCount)
Draws the polyline defined by the first pointCount points in points using the current pen...
QRect mapRect(const QRect &) const
Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate ...
Q_CORE_EXPORT QTextStream & left(QTextStream &s)
static bool isRightToLeft()
Returns true if the application's layout direction is Qt::RightToLeft; otherwise returns false...
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
ushort green
Returns the green color component of this color.
static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbutton, const QRect &rect, QPainter *painter, const QWidget *widget=0)
virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt=0, const QWidget *widget=0) const =0
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
void draw(QPainter *p, const QPointF &point, const QTextLayout::FormatRange *selection=0) const
Draws a line on the given painter at the specified position.
QRect rect
the area that should be used for various calculations and painting
qreal height() const
Returns the line's height.
void point(int i, int *x, int *y) const
Extracts the coordinates of the point at the given index to {x} and *{y} (if they are valid pointers)...
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...
static const char *const tb_extension_arrow_h_xpm[]
QStyle::SubControls subControls
This variable holds a bitwise OR of the sub-controls to be drawn for the complex control.
QRgb rgb() const
Returns the RGB value of the color.
Q_DECL_CONSTEXPR int qRound(qreal d)
void setBackground(const QBrush &bg)
Sets the background brush of the painter to the given brush.
void beginLayout()
Begins the layout process.
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.
int textStart() const
Returns the start of the line from the beginning of the string passed to the QTextLayout.
int open(const char *, int,...)
int & rwidth()
Returns a reference to the width.
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *w=0) const
Reimplemented Function
const QBrush & text() const
Returns the text foreground brush of the current color group.
int lineCount() const
Returns the number of lines in this text layout.
SubElement
This enum represents a sub-area of a widget.
QString text
The text (if any) to be drawn in the view item.
bool hasFeature(PaintEngineFeatures feature) const
Returns true if the paint engine supports the specified feature; otherwise returns false...
struct OpaqueIconRef * IconRef
int styleHint(StyleHint sh, const QStyleOption *opt=0, const QWidget *w=0, QStyleHintReturn *shret=0) const
Reimplemented Function
void setWidth(int width)
Sets the pen width to the given width in pixels with integer precision.
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.
The QPalette class contains color groups for each widget state.
The QIcon class provides scalable icons in different modes and states.