Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquickwindowsstyle.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
6#include "qquickstyleoption.h"
8#include "qquickdrawutil.h"
9
10#include <QtGui/qbitmap.h>
11#include <QtGui/qevent.h>
12#include <QtGui/qpaintengine.h>
13#include <QtGui/qpainter.h>
14#include <QtCore/qdebug.h>
15#include <QtCore/qfile.h>
16#include <QtCore/qtextstream.h>
17#include <QtGui/qpixmapcache.h>
18#include <QtGui/qpa/qplatformintegration.h>
19#include <QtGui/private/qguiapplication_p.h>
20#include <QtGui/qstylehints.h>
21#include <private/qmath_p.h>
22#include <qmath.h>
23#include <QtGui/qpainterpath.h>
24#include <QtGui/qscreen.h>
25#include <QtGui/qwindow.h>
26#include <qpa/qplatformtheme.h>
27#include <qpa/qplatformscreen.h>
28#include <private/qguiapplication_p.h>
29#include <private/qhighdpiscaling_p.h>
30#include <qpa/qplatformnativeinterface.h>
31#include <QtQuickTemplates2/private/qquicktheme_p.h>
32
33#if 0 && QT_CONFIG(animation)
34//#include <private/qstyleanimation_p.h>
35#endif
36
37#include <algorithm>
38
40
41#if defined(Q_OS_WIN)
42
44#include "qt_windows.h"
46# ifndef COLOR_GRADIENTACTIVECAPTION
47# define COLOR_GRADIENTACTIVECAPTION 27
48# endif
49# ifndef COLOR_GRADIENTINACTIVECAPTION
50# define COLOR_GRADIENTINACTIVECAPTION 28
51# endif
52
53Q_GUI_EXPORT HICON qt_pixmapToWinHICON(const QPixmap &);
54#endif //Q_OS_WIN
55
57#include <limits.h>
59
60namespace QQC2 {
61
63
64/*
65 \internal
66*/
67
69
70qreal QWindowsStylePrivate::appDevicePixelRatio()
71{
72 return qApp->devicePixelRatio();
73}
74
76{
77 bool result = false;
78#ifdef Q_OS_WIN
79 // Windows only: Return whether dark mode style support is desired and
80 // dark mode is in effect.
82 const QVariant darkModeStyleP = ni->property("darkModeStyle");
83 result = darkModeStyleP.metaType().id() == QMetaType::Bool
84 && darkModeStyleP.value<bool>()
85 && ni->property("darkMode").value<bool>();
86 }
87#endif
88 return result;
89}
90
91// ###TODO SH_UnderlineShortcut
92#if 0
93// Returns \c true if the toplevel parent of \a widget has seen the Alt-key
94bool QWindowsStylePrivate::hasSeenAlt(const QWidget *widget) const
95{
96 widget = widget->window();
97 return seenAlt.contains(widget);
98}
99
104{
105 // Records Alt- and Focus events
106// if (!o->isWidgetType())
107 return QObject::eventFilter(o, e);
109 Q_D(QWindowsStyle);
110 switch (e->type()) {
111 case QEvent::KeyPress:
112 if (static_cast<QKeyEvent *>(e)->key() == Qt::Key_Alt) {
113 widget = widget->window();
114
115 // Alt has been pressed - find all widgets that care
116 QList<QWidget *> l = widget->findChildren<QWidget *>();
117 auto ignorable = [](QWidget *w) {
118 return w->isWindow() || !w->isVisible()
119 || w->style()->styleHint(SH_UnderlineShortcut, nullptr, w);
120 };
121 l.erase(std::remove_if (l.begin(), l.end(), ignorable), l.end());
122 // Update states before repainting
123 d->seenAlt.append(widget);
124 d->alt_down = true;
125
126 // Repaint all relevant widgets
127 for (int pos = 0; pos < l.size(); ++pos)
128 l.at(pos)->update();
129 }
130 break;
132 if (static_cast<QKeyEvent*>(e)->key() == Qt::Key_Alt) {
133 widget = widget->window();
134
135 // Update state and repaint the menu bars.
136 d->alt_down = false;
137#if 0 && QT_CONFIG(menubar)
138 QList<QMenuBar *> l = widget->findChildren<QMenuBar *>();
139 for (int i = 0; i < l.size(); ++i)
140 l.at(i)->update();
141#endif
142 }
143 break;
144 case QEvent::Close:
145 // Reset widget when closing
146 d->seenAlt.removeAll(widget);
147 d->seenAlt.removeAll(widget->window());
148 break;
149 default:
150 break;
151 }
152 return QCommonStyle::eventFilter(o, e);
153}
154#endif
155
176
185
187{
188 // Update palette in style object through palette timer timeout and this timer
189 // will be triggered during ApplicationPaletteChange event
190 if (event->timerId() == paletteTimer.timerId()) {
191 paletteTimer.stop();
193 }
194}
195
200
202{
203#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
204 switch (pm) {
206 return GetSystemMetrics(SM_CXFRAME);
207
209 Q_ASSERT(opt);
210 if (const QStyleOptionTitleBar *tb = qstyleoption_cast<const QStyleOptionTitleBar *>(opt)) {
211 if ((tb->titleBarFlags & Qt::WindowType_Mask) == Qt::Tool) {
212 // MS always use one less than they say
213 return GetSystemMetrics(SM_CYSMCAPTION) - 1;
214 }
215 }
216 return GetSystemMetrics(SM_CYCAPTION) - 1;
217
219 {
220 NONCLIENTMETRICS ncm;
221 ncm.cbSize = FIELD_OFFSET(NONCLIENTMETRICS, lfMessageFont) + sizeof(LOGFONT);
222 if (SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &ncm, 0))
223 return qMax(ncm.iScrollHeight, ncm.iScrollWidth);
224 }
225 break;
226
228 return GetSystemMetrics(SM_CYFRAME);
229
230 default:
231 break;
232 }
233#else // Q_OS_WIN && !Q_OS_WINRT
234 Q_UNUSED(pm);
236#endif
238}
239
241{
242 switch (pm) {
244 return 0;
251 return 1;
253 return 4;
254#if 0 && QT_CONFIG(tabbar)
256 return 0;
258 return 2;
259#endif
260
262 return 11;
263
264#if 0 && QT_CONFIG(menu)
268 return 0;
270 return 16;
272 return 32;
274 return 2;
277 return 4;
278
279#endif // QT_CONFIG(menu)
281 return 10;
282 default:
283 break;
284 }
286}
287
288static QScreen *screenOf(const QWindow *w)
289{
290 if (w) {
291 if (auto screen = w->screen())
292 return screen;
293 }
295}
296
297// Calculate the overall scale factor to obtain Qt Device Independent
298// Pixels from a native Windows size. Divide by devicePixelRatio
299// and account for secondary screens with differing logical DPI.
306
308{
311 const QScreen *primaryScreen = QGuiApplication::primaryScreen();
312 const QScreen *screen = screenOf(win);
313 if (screen != primaryScreen) {
314 const qreal primaryLogicalDpi = primaryScreen->handle()->logicalDpi().first;
315 const qreal logicalDpi = screen->handle()->logicalDpi().first;
316 if (!qFuzzyCompare(primaryLogicalDpi, logicalDpi))
317 result *= logicalDpi / primaryLogicalDpi;
318 }
319 }
320 return result;
321}
322
327{
331
334 return int(QStyleHelper::dpiScaled(ret, opt));
335
336 ret = 0;
337
338 switch (pm) {
341 if (ret == -1)
342 ret = 60;
343 break;
344
345 // Returns the number of pixels to use for the business part of the
346 // slider (i.e., the non-tickmark portion). The remaining space is shared
347 // equally between the tickmark regions.
349 if (const QStyleOptionSlider *sl = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
350 int space = (sl->orientation == Qt::Horizontal) ? sl->rect.height() : sl->rect.width();
351 int ticks = sl->tickPosition;
352 int n = 0;
354 ++n;
356 ++n;
357 if (!n) {
358 ret = space;
359 break;
360 }
361
362 int thick = 6; // Magic constant to get 5 + 16 + 5
364 thick += proxy()->pixelMetric(PM_SliderLength, sl) / 4;
365
366 space -= thick;
367 if (space > 0)
368 thick += (space * 2) / (n + 2);
369 ret = thick;
370 }
371 break;
372
375 break;
376
377 case PM_SplitterWidth:
379 break;
380
381 default:
383 break;
384 }
385
386 return ret;
387}
388
393{
394#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
395 QPixmap desktopIcon;
396 switch (standardPixmap) {
397 case SP_DriveCDIcon:
398 case SP_DriveDVDIcon:
399 case SP_DriveNetIcon:
400 case SP_DriveHDIcon:
401 case SP_DriveFDIcon:
402 case SP_FileIcon:
403 case SP_FileLinkIcon:
404 case SP_DirLinkIcon:
405 case SP_DirClosedIcon:
406 case SP_DesktopIcon:
407 case SP_ComputerIcon:
408 case SP_DirOpenIcon:
410 case SP_DirHomeIcon:
411 case SP_TrashIcon:
412 case SP_VistaShield:
415 desktopIcon = theme->standardPixmap(sp, QSizeF(16, 16));
416 }
417 break;
424 desktopIcon = theme->standardPixmap(sp, QSizeF());
425 }
426 break;
427 default:
428 break;
429 }
430 if (!desktopIcon.isNull()) {
431 return desktopIcon;
432 }
433#endif // Q_OS_WIN && !Q_OS_WINRT
435}
436
439 QStyleHintReturn *returnData) const
440{
441 int ret = 0;
442
443 switch (hint) {
445 ret = d_func()->isDarkMode() ? 0 : 1;
446 break;
457 ret = 1;
458
459 break;
461#if 0 && QT_CONFIG(listview)
462 if (qobject_cast<const QListView*>(widget))
463 ret = 1;
464#endif
465 break;
467 ret = 1;
468 break;
470 ret = 0;
471 break;
472
473#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT) // Option not used on WinRT -> common style
475 {
476 ret = 1;
477 BOOL cues = false;
478 SystemParametersInfo(SPI_GETKEYBOARDCUES, 0, &cues, 0);
479 ret = int(cues);
480 // Do nothing if we always paint underlines
481 Q_D(const QWindowsStyle);
482 if (!ret && d) {
483#if 0 && QT_CONFIG(menubar)
484 const QMenuBar *menuBar = qobject_cast<const QMenuBar *>(widget);
485 if (!menuBar && qobject_cast<const QMenu *>(widget)) {
487 if (w && w != widget)
488 menuBar = w->findChild<QMenuBar *>();
489 }
490 // If we paint a menu bar draw underlines if is in the keyboardState
491 if (menuBar) {
492 if (menuBar->d_func()->keyboardState || d->altDown())
493 ret = 1;
494 // Otherwise draw underlines if the toplevel widget has seen an alt-press
495 } else
496#endif // QT_CONFIG(menubar)
497// if (d->hasSeenAlt(widget)) {
498// ret = 1;
499// }
500 }
501#ifndef QT_NO_ACCESSIBILITY
503 && QStyleHelper::isInstanceOf(opt->styleObject, QAccessible::MenuItem)
504 && opt->styleObject->property("_q_showUnderlined").toBool())
505 ret = 1;
506#endif // QT_NO_ACCESSIBILITY
507 break;
508 }
509#endif // Q_OS_WIN && !Q_OS_WINRT
512#if defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
513 DWORD delay;
514 if (SystemParametersInfo(SPI_GETMENUSHOWDELAY, 0, &delay, 0))
515 ret = delay;
516 else
517#endif // Q_OS_WIN && !Q_OS_WINRT
518 ret = 400;
519 break;
520 }
521#if 0 && QT_CONFIG(rubberband)
523 if (const QStyleOptionRubberBand *rbOpt = qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) {
524 ret = 0;
525 if (rbOpt->shape == QRubberBand::Rectangle) {
526 ret = true;
527 if (QStyleHintReturnMask *mask = qstyleoption_cast<QStyleHintReturnMask*>(returnData)) {
528 mask->region = opt->rect;
529 int size = 1;
530 if (widget && widget->isWindow())
531 size = 4;
532 mask->region -= opt->rect.adjusted(size, size, -size, -size);
533 }
534 }
535 }
536 break;
537#endif // QT_CONFIG(rubberband)
538#if 0 && QT_CONFIG(wizard)
539 case SH_WizardStyle:
541 break;
542#endif
544 ret = true;
545 break;
547 ret = 0;
548 break;
549 default:
550 ret = QCommonStyle::styleHint(hint, opt, returnData);
551 break;
552 }
553 return ret;
554}
555
558{
559 // Used to restore across fallthrough cases. Currently only used in PE_IndicatorCheckBox
560 bool doRestore = false;
561
562 switch (pe) {
563#if 0 && QT_CONFIG(toolbar)
565 {
566 QRect rect = opt->rect;
567 const int margin = 2;
568 QPen oldPen = p->pen();
569 if (opt->state & State_Horizontal){
570 const int offset = rect.width()/2;
571 p->setPen(QPen(opt->palette.dark().color()));
572 p->drawLine(rect.bottomLeft().x() + offset,
573 rect.bottomLeft().y() - margin,
574 rect.topLeft().x() + offset,
575 rect.topLeft().y() + margin);
576 p->setPen(QPen(opt->palette.light().color()));
577 p->drawLine(rect.bottomLeft().x() + offset + 1,
578 rect.bottomLeft().y() - margin,
579 rect.topLeft().x() + offset + 1,
580 rect.topLeft().y() + margin);
581 }
582 else{ //Draw vertical separator
583 const int offset = rect.height()/2;
584 p->setPen(QPen(opt->palette.dark().color()));
585 p->drawLine(rect.topLeft().x() + margin ,
586 rect.topLeft().y() + offset,
587 rect.topRight().x() - margin,
588 rect.topRight().y() + offset);
589 p->setPen(QPen(opt->palette.light().color()));
590 p->drawLine(rect.topLeft().x() + margin ,
591 rect.topLeft().y() + offset + 1,
592 rect.topRight().x() - margin,
593 rect.topRight().y() + offset + 1);
594 }
595 p->setPen(oldPen);
596 }
597 break;
599 p->save();
600 p->translate(opt->rect.x(), opt->rect.y());
601 if (opt->state & State_Horizontal) {
602 int x = opt->rect.width() / 2 - 4;
604 x -= 2;
605 if (opt->rect.height() > 4) {
606 qDrawShadePanel(p, x, 2, 3, opt->rect.height() - 4,
607 opt->palette, false, 1, nullptr);
608 qDrawShadePanel(p, x + 3, 2, 3, opt->rect.height() - 4,
609 opt->palette, false, 1, nullptr);
610 }
611 } else {
612 if (opt->rect.width() > 4) {
613 int y = opt->rect.height() / 2 - 4;
614 qDrawShadePanel(p, 2, y, opt->rect.width() - 4, 3,
615 opt->palette, false, 1, nullptr);
616 qDrawShadePanel(p, 2, y + 3, opt->rect.width() - 4, 3,
617 opt->palette, false, 1, nullptr);
618 }
619 }
620 p->restore();
621 break;
622
623#endif // QT_CONFIG(toolbar)
625 case PE_PanelButtonTool: {
626 QPen oldPen = p->pen();
627#if 0 && QT_CONFIG(dockwidget)
628 if (w && w->inherits("QDockWidgetTitleButton")) {
629 if (const QWidget *dw = w->parentWidget())
630 if (dw->isWindow()){
632 &opt->palette.button());
633
634 return;
635 }
636 }
637#endif // QT_CONFIG(dockwidget)
638 QBrush fill;
639 bool stippled;
640 bool panel = (pe == PE_PanelButtonTool);
641 if ((!(opt->state & State_Sunken ))
642 && (!(opt->state & State_Enabled)
644 && (opt->state & State_On)) {
646 stippled = true;
647 } else {
649 stippled = false;
650 }
651
653 if (opt->state & State_AutoRaise) {
655 if (panel)
657 opt->state & (State_Sunken | State_On), 1, &fill);
658 else
660 opt->state & (State_Sunken | State_On), 1);
661 }
662 if (stippled) {
663 p->setPen(opt->palette.button().color());
664 p->drawRect(opt->rect.adjusted(1,1,-2,-2));
665 }
666 } else {
668 opt->state & (State_Sunken | State_On), panel ? &fill : nullptr);
669 }
670 } else {
671 p->fillRect(opt->rect, fill);
672 }
673 p->setPen(oldPen);
674 break; }
676 if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
677 QBrush fill;
678 State flags = opt->state;
679 QPalette pal = opt->palette;
680 QRect r = opt->rect;
681 if (! (flags & State_Sunken) && (flags & State_On))
683 else
685
687 p->setPen(pal.dark().color());
688 p->setBrush(fill);
689 p->drawRect(r.adjusted(0, 0, -1, -1));
690 } else if (flags & (State_Raised | State_On | State_Sunken)) {
692 &fill);
693 } else {
694 p->fillRect(r, fill);
695 }
696 }
697 break;
699 QPen oldPen = p->pen();
700 p->setPen(QPen(opt->palette.shadow().color(), 0));
701 QRectF rect = opt->rect;
702 const qreal dpi = QStyleHelper::dpi(opt);
703 const qreal topLevelAdjustment = QStyleHelper::dpiScaled(0.5, dpi);
704 const qreal bottomRightAdjustment = QStyleHelper::dpiScaled(-1.5, dpi);
705 rect.adjust(topLevelAdjustment, topLevelAdjustment,
706 bottomRightAdjustment, bottomRightAdjustment);
707 p->drawRect(rect);
708 p->setPen(oldPen);
709 break;
710 }
712 QBrush fill;
713 if (opt->state & State_NoChange)
715 else if (opt->state & State_Sunken)
716 fill = opt->palette.button();
717 else if (opt->state & State_Enabled)
718 fill = opt->palette.base();
719 else
720 fill = opt->palette.window();
721 p->save();
722 doRestore = true;
723 qDrawWinPanel(p, opt->rect, opt->palette, true, &fill);
724 if (opt->state & State_NoChange)
725 p->setPen(opt->palette.dark().color());
726 else
727 p->setPen(opt->palette.text().color());
728 }
731 if (!doRestore) {
732 p->save();
733 doRestore = true;
734 }
735#if 0 && QT_CONFIG(itemviews)
737 const QStyleOptionViewItem *itemViewOpt = qstyleoption_cast<const QStyleOptionViewItem *>(opt);
738 p->setPen(itemViewOpt
739 && itemViewOpt->showDecorationSelected
742 : opt->palette.text().color());
743 if (opt->state & State_NoChange)
744 p->setBrush(opt->palette.brush(QPalette::Button));
745 p->drawRect(opt->rect.x() + 1, opt->rect.y() + 1, opt->rect.width() - 2, opt->rect.height() - 2);
746 }
747#endif // QT_CONFIG(itemviews)
748 if (!(opt->state & State_Off)) {
749 QPointF points[6];
750 qreal scaleh = opt->rect.width() / 12.0;
751 qreal scalev = opt->rect.height() / 12.0;
752 points[0] = { opt->rect.x() + 3.5 * scaleh, opt->rect.y() + 5.5 * scalev };
753 points[1] = { points[0].x(), points[0].y() + 2 * scalev };
754 points[2] = { points[1].x() + 2 * scaleh, points[1].y() + 2 * scalev };
755 points[3] = { points[2].x() + 4 * scaleh, points[2].y() - 4 * scalev };
756 points[4] = { points[3].x(), points[3].y() - 2 * scalev };
757 points[5] = { points[4].x() - 4 * scaleh, points[4].y() + 4 * scalev };
758 p->setPen(QPen(opt->palette.text().color(), 0));
759 p->setBrush(opt->palette.text().color());
760 p->drawPolygon(points, 6);
761 }
762 if (doRestore)
763 p->restore();
764 break;
766 if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(opt)) {
767 //### check for d->alt_down
769 return;
770 QRect r = opt->rect;
771 p->save();
772 p->setBackgroundMode(Qt::TransparentMode);
773 QColor bg_col = fropt->backgroundColor;
774 if (!bg_col.isValid())
775 bg_col = p->background().color();
776 bg_col = bg_col.toRgb();
777 // Create an "XOR" color.
778 QColor patternCol((bg_col.red() ^ 0xff) & 0xff,
779 (bg_col.green() ^ 0xff) & 0xff,
780 (bg_col.blue() ^ 0xff) & 0xff);
781 p->setBrush(QBrush(patternCol, Qt::Dense4Pattern));
782 p->setBrushOrigin(r.topLeft());
783 p->setPen(Qt::NoPen);
784 p->drawRect(r.left(), r.top(), r.width(), 1); // Top
785 p->drawRect(r.left(), r.bottom(), r.width(), 1); // Bottom
786 p->drawRect(r.left(), r.top(), 1, r.height()); // Left
787 p->drawRect(r.right(), r.top(), 1, r.height()); // Right
788 p->restore();
789 }
790 break;
792 {
793 QRect r = opt->rect;
794 p->save();
795 p->setRenderHint(QPainter::Antialiasing, true);
796
797 QPointF circleCenter = r.center() + QPoint(1, 1);
798 qreal radius = (r.width() + (r.width() + 1) % 2) / 2.0 - 1;
799
800 QPainterPath path1;
801 path1.addEllipse(circleCenter, radius, radius);
802 radius *= 0.85;
803 QPainterPath path2;
804 path2.addEllipse(circleCenter, radius, radius);
805 radius *= 0.85;
806 QPainterPath path3;
807 path3.addEllipse(circleCenter, radius, radius);
808 radius *= 0.5;
809 QPainterPath path4;
810 path4.addEllipse(circleCenter, radius, radius);
811
812 QPolygon topLeftPol, bottomRightPol;
813 topLeftPol.setPoints(3, r.x(), r.y(), r.x(), r.y() + r.height(), r.x() + r.width(), r.y());
814 bottomRightPol.setPoints(3, r.x(), r.y() + r.height(), r.x() + r.width(), r.y() + r.height(), r.x() + r.width(), r.y());
815
816 p->setClipRegion(QRegion(topLeftPol));
817 p->setPen(opt->palette.dark().color());
818 p->setBrush(opt->palette.dark().color());
819 p->drawPath(path1);
820 p->setPen(opt->palette.shadow().color());
821 p->setBrush(opt->palette.shadow().color());
822 p->drawPath(path2);
823
824 p->setClipRegion(QRegion(bottomRightPol));
825 p->setPen(opt->palette.light().color());
826 p->setBrush(opt->palette.light().color());
827 p->drawPath(path1);
828 p->setPen(opt->palette.midlight().color());
829 p->setBrush(opt->palette.midlight().color());
830 p->drawPath(path2);
831
832 QColor fillColor = ((opt->state & State_Sunken) || !(opt->state & State_Enabled)) ?
834
835 p->setClipping(false);
836 p->setPen(fillColor);
837 p->setBrush(fillColor);
838 p->drawPath(path3);
839
840 if (opt->state & State_On) {
841 p->setPen(opt->palette.text().color());
842 p->setBrush(opt->palette.text());
843 p->drawPath(path4);
844 }
845 p->restore();
846 break;
847 }
848#ifndef QT_NO_FRAME
849 case PE_Frame:
850 case PE_FrameMenu:
851 if (const QStyleOptionFrame *frame = qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
852 if (frame->lineWidth == 2 || pe == PE_Frame) {
853 QPalette popupPal = frame->palette;
854 if (pe == PE_FrameMenu) {
856 popupPal.setColor(QPalette::Midlight, frame->palette.light().color());
857 }
858 if (pe == PE_Frame && (frame->state & State_Raised))
859 qDrawWinButton(p, frame->rect, popupPal, frame->state & State_Sunken);
860 else if (pe == PE_Frame && (frame->state & State_Sunken))
861 {
862 popupPal.setColor(QPalette::Midlight, frame->palette.window().color());
863 qDrawWinPanel(p, frame->rect, popupPal, frame->state & State_Sunken);
864 }
865 else
866 qDrawWinPanel(p, frame->rect, popupPal, frame->state & State_Sunken);
867 } else {
869 }
870 } else {
871 QPalette popupPal = opt->palette;
873 popupPal.setColor(QPalette::Midlight, opt->palette.light().color());
874 qDrawWinPanel(p, opt->rect, popupPal, opt->state & State_Sunken);
875 }
876 break;
877#endif // QT_NO_FRAME
879 case PE_PanelButtonBevel: {
880 QBrush fill;
881 bool panel = pe != PE_FrameButtonBevel;
882 p->setBrushOrigin(opt->rect.topLeft());
883 if (!(opt->state & State_Sunken) && (opt->state & State_On))
885 else
887
890 panel ? &fill : nullptr);
891 } else {
892 if (panel)
893 p->fillRect(opt->rect, fill);
894 else
895 p->drawRect(opt->rect);
896 }
897 break; }
898 case PE_FrameWindow: {
899 QPalette popupPal = opt->palette;
901 popupPal.setColor(QPalette::Midlight, opt->palette.light().color());
902 qDrawWinPanel(p, opt->rect, popupPal, opt->state & State_Sunken);
903 break; }
904#if 0 && QT_CONFIG(dockwidget)
906 break;
908 if (qstyleoption_cast<const QStyleOptionFrame *>(opt)) {
910 }
911 break;
912#endif // QT_CONFIG(dockwidget)
913
915 qDrawShadePanel(p, opt->rect, opt->palette, true, 1, nullptr);
916 break;
917
919 {
920 bool vertical = false, inverted = false;
921 if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
922 vertical = !(pb->state & QStyle::State_Horizontal);
923 inverted = pb->invertedAppearance;
924 }
925
926 int space = 2;
927 int chunksize = proxy()->pixelMetric(PM_ProgressBarChunkWidth, opt) - space;
928 if (!vertical) {
929 if (opt->rect.width() <= chunksize)
930 space = 0;
931
932 if (inverted)
933 p->fillRect(opt->rect.x() + space, opt->rect.y(), opt->rect.width() - space, opt->rect.height(),
935 else
936 p->fillRect(opt->rect.x(), opt->rect.y(), opt->rect.width() - space, opt->rect.height(),
938 } else {
939 if (opt->rect.height() <= chunksize)
940 space = 0;
941
942 if (inverted)
943 p->fillRect(opt->rect.x(), opt->rect.y(), opt->rect.width(), opt->rect.height() - space,
945 else
946 p->fillRect(opt->rect.x(), opt->rect.y() + space, opt->rect.width(), opt->rect.height() - space,
948 }
949 }
950 break;
951
952 case PE_FrameTabWidget: {
953 qDrawWinButton(p, opt->rect, opt->palette, false, nullptr);
954 break;
955 }
956 default:
958 }
959}
960
963{
964 switch (ce) {
965#if 0 && QT_CONFIG(rubberband)
966 case CE_RubberBand:
967 if (qstyleoption_cast<const QStyleOptionRubberBand *>(opt)) {
968 // ### workaround for slow general painter path
969 QPixmap tiledPixmap(16, 16);
970 QPainter pixmapPainter(&tiledPixmap);
971 pixmapPainter.setPen(Qt::NoPen);
972 pixmapPainter.setBrush(Qt::Dense4Pattern);
973 pixmapPainter.setBackground(Qt::white);
974 pixmapPainter.setBackgroundMode(Qt::OpaqueMode);
975 pixmapPainter.drawRect(0, 0, tiledPixmap.width(), tiledPixmap.height());
976 pixmapPainter.end();
977 tiledPixmap = QPixmap::fromImage(tiledPixmap.toImage());
978 p->save();
979 QRect r = opt->rect;
982 p->setClipRegion(mask.region);
983 p->drawTiledPixmap(r.x(), r.y(), r.width(), r.height(), tiledPixmap);
984 p->restore();
985 return;
986 }
987 break;
988#endif // QT_CONFIG(rubberband)
989
990#if 0 && QT_CONFIG(menu) && QT_CONFIG(mainwindow)
992 if (widget && qobject_cast<const QMainWindow *>(widget->parentWidget())) {
993 p->fillRect(opt->rect, opt->palette.button());
994 QPen oldPen = p->pen();
995 p->setPen(QPen(opt->palette.dark().color()));
996 p->drawLine(opt->rect.bottomLeft(), opt->rect.bottomRight());
997 p->setPen(oldPen);
998 }
999 break;
1000#endif
1001#if 0 && QT_CONFIG(menu)
1002 case CE_MenuItem:
1003 if (const QStyleOptionMenuItem *menuitem = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
1004 int x, y, w, h;
1005 menuitem->rect.getRect(&x, &y, &w, &h);
1006 int tab = menuitem->tabWidth;
1007 bool dis = !(menuitem->state & State_Enabled);
1008 bool checked = menuitem->checkType != QStyleOptionMenuItem::NotCheckable
1009 ? menuitem->checked : false;
1010 bool act = menuitem->state & State_Selected;
1011
1012 // windows always has a check column, regardless whether we have an icon or not
1013 int checkcol = qMax<int>(menuitem->maxIconWidth, QWindowsStylePrivate::windowsCheckMarkWidth);
1014
1015 QBrush fill = menuitem->palette.brush(act ? QPalette::Highlight : QPalette::Button);
1016 p->fillRect(menuitem->rect.adjusted(0, 0, -1, 0), fill);
1017
1018 if (menuitem->menuItemType == QStyleOptionMenuItem::Separator){
1019 int yoff = y-1 + h / 2;
1020 p->setPen(menuitem->palette.dark().color());
1021 p->drawLine(x + 2, yoff, x + w - 4, yoff);
1022 p->setPen(menuitem->palette.light().color());
1023 p->drawLine(x + 2, yoff + 1, x + w - 4, yoff + 1);
1024 return;
1025 }
1026
1027 QRect vCheckRect = visualRect(opt->direction, menuitem->rect, QRect(menuitem->rect.x(), menuitem->rect.y(), checkcol, menuitem->rect.height()));
1028 if (!menuitem->icon.isNull() && checked) {
1029 if (act) {
1030 qDrawShadePanel(p, vCheckRect,
1031 menuitem->palette, true, 1,
1032 &menuitem->palette.brush(QPalette::Button));
1033 } else {
1034 QBrush fill(menuitem->palette.light().color(), Qt::Dense4Pattern);
1035 qDrawShadePanel(p, vCheckRect, menuitem->palette, true, 1, &fill);
1036 }
1037 } else if (!act) {
1038 p->fillRect(vCheckRect, menuitem->palette.brush(QPalette::Button));
1039 }
1040
1041 // On Windows Style, if we have a checkable item and an icon we
1042 // draw the icon recessed to indicate an item is checked. If we
1043 // have no icon, we draw a checkmark instead.
1044 if (!menuitem->icon.isNull()) {
1046 if (act && !dis)
1049 if (checked)
1050 pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, opt, widget), mode, QIcon::On);
1051 else
1052 pixmap = menuitem->icon.pixmap(proxy()->pixelMetric(PM_SmallIconSize, opt, widget), mode);
1053 const int pixw = pixmap.width() / pixmap.devicePixelRatio();
1054 const int pixh = pixmap.height() / pixmap.devicePixelRatio();
1055 QRect pmr(0, 0, pixw, pixh);
1056 pmr.moveCenter(vCheckRect.center());
1057 p->setPen(menuitem->palette.text().color());
1058 p->drawPixmap(pmr.topLeft(), pixmap);
1059 } else if (checked) {
1060 QStyleOptionMenuItem newMi = *menuitem;
1061 newMi.state = State_None;
1062 if (!dis)
1063 newMi.state |= State_Enabled;
1064 if (act)
1065 newMi.state |= State_On;
1066 newMi.rect = visualRect(opt->direction, menuitem->rect, QRect(menuitem->rect.x() + QWindowsStylePrivate::windowsItemFrame,
1067 menuitem->rect.y() + QWindowsStylePrivate::windowsItemFrame,
1069 menuitem->rect.height() - 2 * QWindowsStylePrivate::windowsItemFrame));
1071 }
1072 p->setPen(act ? menuitem->palette.highlightedText().color() : menuitem->palette.buttonText().color());
1073
1074 QColor discol;
1075 if (dis) {
1076 discol = menuitem->palette.text().color();
1077 p->setPen(discol);
1078 }
1079
1081 int xpos = menuitem->rect.x() + xm;
1084 QRect vTextRect = visualRect(opt->direction, menuitem->rect, textRect);
1085 QStringRef s(&menuitem->text);
1086 if (!s.isEmpty()) { // draw text
1087 p->save();
1088 int t = s.indexOf(QLatin1Char('\t'));
1090 if (!proxy()->styleHint(SH_UnderlineShortcut, menuitem, widget))
1091 text_flags |= Qt::TextHideMnemonic;
1092 text_flags |= Qt::AlignLeft;
1093 if (t >= 0) {
1094 QRect vShortcutRect = visualRect(opt->direction, menuitem->rect,
1095 QRect(textRect.topRight(), QPoint(menuitem->rect.right(), textRect.bottom())));
1096 const QString textToDraw = s.mid(t + 1).toString();
1097 if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, opt, widget)) {
1098 p->setPen(menuitem->palette.light().color());
1099 p->drawText(vShortcutRect.adjusted(1, 1, 1, 1), text_flags, textToDraw);
1100 p->setPen(discol);
1101 }
1102 p->drawText(vShortcutRect, text_flags, textToDraw);
1103 s = s.left(t);
1104 }
1105 QFont font = menuitem->font;
1106 if (menuitem->menuItemType == QStyleOptionMenuItem::DefaultItem)
1107 font.setBold(true);
1108 p->setFont(font);
1109 const QString textToDraw = s.left(t).toString();
1110 if (dis && !act && proxy()->styleHint(SH_EtchDisabledText, opt, widget)) {
1111 p->setPen(menuitem->palette.light().color());
1112 p->drawText(vTextRect.adjusted(1, 1, 1, 1), text_flags, textToDraw);
1113 p->setPen(discol);
1114 }
1115 p->drawText(vTextRect, text_flags, textToDraw);
1116 p->restore();
1117 }
1118 if (menuitem->menuItemType == QStyleOptionMenuItem::SubMenu) {// draw sub menu arrow
1119 int dim = (h - 2 * QWindowsStylePrivate::windowsItemFrame) / 2;
1120 PrimitiveElement arrow;
1123 QRect vSubMenuRect = visualRect(opt->direction, menuitem->rect, QRect(xpos, y + h / 2 - dim / 2, dim, dim));
1124 QStyleOptionMenuItem newMI = *menuitem;
1125 newMI.rect = vSubMenuRect;
1126 newMI.state = dis ? State_None : State_Enabled;
1127 if (act)
1128 newMI.palette.setColor(QPalette::ButtonText,
1129 newMI.palette.highlightedText().color());
1130 proxy()->drawPrimitive(arrow, &newMI, p, widget);
1131 }
1132
1133 }
1134 break;
1135#endif // QT_CONFIG(menu)
1136#if 0 && QT_CONFIG(menubar)
1137 case CE_MenuBarItem:
1138 if (const QStyleOptionMenuItem *mbi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
1139 bool active = mbi->state & State_Selected;
1140 bool hasFocus = mbi->state & State_HasFocus;
1141 bool down = mbi->state & State_Sunken;
1142 QStyleOptionMenuItem newMbi = *mbi;
1143 p->fillRect(mbi->rect, mbi->palette.brush(QPalette::Button));
1144 if (active || hasFocus) {
1145 QBrush b = mbi->palette.brush(QPalette::Button);
1146 if (active && down)
1147 p->setBrushOrigin(p->brushOrigin() + QPoint(1, 1));
1148 if (active && hasFocus)
1149 qDrawShadeRect(p, mbi->rect.x(), mbi->rect.y(), mbi->rect.width(),
1150 mbi->rect.height(), mbi->palette, active && down, 1, 0, &b);
1151 if (active && down) {
1152 newMbi.rect.translate(proxy()->pixelMetric(PM_ButtonShiftHorizontal, mbi, widget),
1154 p->setBrushOrigin(p->brushOrigin() - QPoint(1, 1));
1155 }
1156 }
1157 QCommonStyle::drawControl(ce, &newMbi, p, widget);
1158 }
1159 break;
1160#endif // QT_CONFIG(menubar)
1161#if 0 && QT_CONFIG(tabbar)
1162 case CE_TabBarTabShape:
1163 if (const QStyleOptionTab *tab = qstyleoption_cast<const QStyleOptionTab *>(opt)) {
1164 bool rtlHorTabs = (tab->direction == Qt::RightToLeft
1165 && (tab->shape == QTabBar::RoundedNorth
1166 || tab->shape == QTabBar::RoundedSouth));
1167 bool selected = tab->state & State_Selected;
1168 bool lastTab = ((!rtlHorTabs && tab->position == QStyleOptionTab::End)
1169 || (rtlHorTabs
1170 && tab->position == QStyleOptionTab::Beginning));
1171 bool firstTab = ((!rtlHorTabs
1172 && tab->position == QStyleOptionTab::Beginning)
1173 || (rtlHorTabs
1174 && tab->position == QStyleOptionTab::End));
1175 bool onlyOne = tab->position == QStyleOptionTab::OnlyOneTab;
1176 bool previousSelected =
1177 ((!rtlHorTabs
1178 && tab->selectedPosition == QStyleOptionTab::PreviousIsSelected)
1179 || (rtlHorTabs
1180 && tab->selectedPosition == QStyleOptionTab::NextIsSelected));
1181 bool nextSelected =
1182 ((!rtlHorTabs
1183 && tab->selectedPosition == QStyleOptionTab::NextIsSelected)
1184 || (rtlHorTabs
1185 && tab->selectedPosition
1187 int tabBarAlignment = proxy()->styleHint(SH_TabBar_Alignment, tab, widget);
1188 bool leftAligned = (!rtlHorTabs && tabBarAlignment == Qt::AlignLeft)
1189 || (rtlHorTabs
1190 && tabBarAlignment == Qt::AlignRight);
1191
1192 bool rightAligned = (!rtlHorTabs && tabBarAlignment == Qt::AlignRight)
1193 || (rtlHorTabs
1194 && tabBarAlignment == Qt::AlignLeft);
1195
1196 QColor light = tab->palette.light().color();
1197 QColor dark = tab->palette.dark().color();
1198 QColor shadow = tab->palette.shadow().color();
1199 int borderThinkness = proxy()->pixelMetric(PM_TabBarBaseOverlap, tab, widget);
1200 if (selected)
1201 borderThinkness /= 2;
1202 QRect r2(opt->rect);
1203 int x1 = r2.left();
1204 int x2 = r2.right();
1205 int y1 = r2.top();
1206 int y2 = r2.bottom();
1207 switch (tab->shape) {
1208 default:
1210 break;
1211 case QTabBar::RoundedNorth: {
1212 if (!selected) {
1213 y1 += 2;
1214 x1 += onlyOne || firstTab ? borderThinkness : 0;
1215 x2 -= onlyOne || lastTab ? borderThinkness : 0;
1216 }
1217
1218 p->fillRect(QRect(x1 + 1, y1 + 1, (x2 - x1) - 1, (y2 - y1) - 2), tab->palette.window());
1219
1220 // Delete border
1221 if (selected) {
1222 p->fillRect(QRect(x1,y2-1,x2-x1,1), tab->palette.window());
1223 p->fillRect(QRect(x1,y2,x2-x1,1), tab->palette.window());
1224 }
1225 // Left
1226 if (firstTab || selected || onlyOne || !previousSelected) {
1227 p->setPen(light);
1228 p->drawLine(x1, y1 + 2, x1, y2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
1229 p->drawPoint(x1 + 1, y1 + 1);
1230 }
1231 // Top
1232 {
1233 int beg = x1 + (previousSelected ? 0 : 2);
1234 int end = x2 - (nextSelected ? 0 : 2);
1235 p->setPen(light);
1236 p->drawLine(beg, y1, end, y1);
1237 }
1238 // Right
1239 if (lastTab || selected || onlyOne || !nextSelected) {
1240 p->setPen(shadow);
1241 p->drawLine(x2, y1 + 2, x2, y2 - ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness));
1242 p->drawPoint(x2 - 1, y1 + 1);
1243 p->setPen(dark);
1244 p->drawLine(x2 - 1, y1 + 2, x2 - 1, y2 - ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness));
1245 }
1246 break; }
1247 case QTabBar::RoundedSouth: {
1248 if (!selected) {
1249 y2 -= 2;
1250 x1 += firstTab ? borderThinkness : 0;
1251 x2 -= lastTab ? borderThinkness : 0;
1252 }
1253
1254 p->fillRect(QRect(x1 + 1, y1 + 2, (x2 - x1) - 1, (y2 - y1) - 1), tab->palette.window());
1255
1256 // Delete border
1257 if (selected) {
1258 p->fillRect(QRect(x1, y1 + 1, (x2 - 1)-x1, 1), tab->palette.window());
1259 p->fillRect(QRect(x1, y1, (x2 - 1)-x1, 1), tab->palette.window());
1260 }
1261 // Left
1262 if (firstTab || selected || onlyOne || !previousSelected) {
1263 p->setPen(light);
1264 p->drawLine(x1, y2 - 2, x1, y1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness));
1265 p->drawPoint(x1 + 1, y2 - 1);
1266 }
1267 // Bottom
1268 {
1269 int beg = x1 + (previousSelected ? 0 : 2);
1270 int end = x2 - (nextSelected ? 0 : 2);
1271 p->setPen(shadow);
1272 p->drawLine(beg, y2, end, y2);
1273 p->setPen(dark);
1274 p->drawLine(beg, y2 - 1, end, y2 - 1);
1275 }
1276 // Right
1277 if (lastTab || selected || onlyOne || !nextSelected) {
1278 p->setPen(shadow);
1279 p->drawLine(x2, y2 - 2, x2, y1 + ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness));
1280 p->drawPoint(x2 - 1, y2 - 1);
1281 p->setPen(dark);
1282 p->drawLine(x2 - 1, y2 - 2, x2 - 1, y1 + ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness));
1283 }
1284 break; }
1285 case QTabBar::RoundedWest: {
1286 if (!selected) {
1287 x1 += 2;
1288 y1 += firstTab ? borderThinkness : 0;
1289 y2 -= lastTab ? borderThinkness : 0;
1290 }
1291
1292 p->fillRect(QRect(x1 + 1, y1 + 1, (x2 - x1) - 2, (y2 - y1) - 1), tab->palette.window());
1293
1294 // Delete border
1295 if (selected) {
1296 p->fillRect(QRect(x2 - 1, y1, 1, y2-y1), tab->palette.window());
1297 p->fillRect(QRect(x2, y1, 1, y2-y1), tab->palette.window());
1298 }
1299 // Top
1300 if (firstTab || selected || onlyOne || !previousSelected) {
1301 p->setPen(light);
1302 p->drawLine(x1 + 2, y1, x2 - ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness), y1);
1303 p->drawPoint(x1 + 1, y1 + 1);
1304 }
1305 // Left
1306 {
1307 int beg = y1 + (previousSelected ? 0 : 2);
1308 int end = y2 - (nextSelected ? 0 : 2);
1309 p->setPen(light);
1310 p->drawLine(x1, beg, x1, end);
1311 }
1312 // Bottom
1313 if (lastTab || selected || onlyOne || !nextSelected) {
1314 p->setPen(shadow);
1315 p->drawLine(x1 + 3, y2, x2 - ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness), y2);
1316 p->drawPoint(x1 + 2, y2 - 1);
1317 p->setPen(dark);
1318 p->drawLine(x1 + 3, y2 - 1, x2 - ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness), y2 - 1);
1319 p->drawPoint(x1 + 1, y2 - 1);
1320 p->drawPoint(x1 + 2, y2);
1321 }
1322 break; }
1323 case QTabBar::RoundedEast: {
1324 if (!selected) {
1325 x2 -= 2;
1326 y1 += firstTab ? borderThinkness : 0;
1327 y2 -= lastTab ? borderThinkness : 0;
1328 }
1329
1330 p->fillRect(QRect(x1 + 2, y1 + 1, (x2 - x1) - 1, (y2 - y1) - 1), tab->palette.window());
1331
1332 // Delete border
1333 if (selected) {
1334 p->fillRect(QRect(x1 + 1, y1, 1, (y2 - 1)-y1),tab->palette.window());
1335 p->fillRect(QRect(x1, y1, 1, (y2-1)-y1), tab->palette.window());
1336 }
1337 // Top
1338 if (firstTab || selected || onlyOne || !previousSelected) {
1339 p->setPen(light);
1340 p->drawLine(x2 - 2, y1, x1 + ((onlyOne || firstTab) && selected && leftAligned ? 0 : borderThinkness), y1);
1341 p->drawPoint(x2 - 1, y1 + 1);
1342 }
1343 // Right
1344 {
1345 int beg = y1 + (previousSelected ? 0 : 2);
1346 int end = y2 - (nextSelected ? 0 : 2);
1347 p->setPen(shadow);
1348 p->drawLine(x2, beg, x2, end);
1349 p->setPen(dark);
1350 p->drawLine(x2 - 1, beg, x2 - 1, end);
1351 }
1352 // Bottom
1353 if (lastTab || selected || onlyOne || !nextSelected) {
1354 p->setPen(shadow);
1355 p->drawLine(x2 - 2, y2, x1 + ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness), y2);
1356 p->drawPoint(x2 - 1, y2 - 1);
1357 p->setPen(dark);
1358 p->drawLine(x2 - 2, y2 - 1, x1 + ((onlyOne || lastTab) && selected && rightAligned ? 0 : borderThinkness), y2 - 1);
1359 }
1360 break; }
1361 }
1362 }
1363 break;
1364#endif // QT_CONFIG(tabbar)
1365 case CE_ToolBoxTabShape:
1367 opt->state & (State_Sunken | State_On), 1,
1369 break;
1370#if 0 && QT_CONFIG(splitter)
1371 case CE_Splitter:
1372 p->eraseRect(opt->rect);
1373 break;
1374#endif // QT_CONFIG(splitter)
1375#if 0 && QT_CONFIG(scrollbar)
1377 case CE_ScrollBarAddLine: {
1378 if ((opt->state & State_Sunken)) {
1379 p->setPen(opt->palette.dark().color());
1380 p->setBrush(opt->palette.brush(QPalette::Button));
1381 p->drawRect(opt->rect.adjusted(0, 0, -1, -1));
1382 } else {
1383 QStyleOption buttonOpt = *opt;
1384 if (!(buttonOpt.state & State_Sunken))
1385 buttonOpt.state |= State_Raised;
1386 QPalette pal(opt->palette);
1391 }
1392 PrimitiveElement arrow;
1393 if (opt->state & State_Horizontal) {
1394 if (ce == CE_ScrollBarAddLine)
1396 else
1398 } else {
1399 if (ce == CE_ScrollBarAddLine)
1400 arrow = PE_IndicatorArrowDown;
1401 else
1402 arrow = PE_IndicatorArrowUp;
1403 }
1404 QStyleOption arrowOpt = *opt;
1405 arrowOpt.rect = opt->rect.adjusted(4, 4, -4, -4);
1406 proxy()->drawPrimitive(arrow, &arrowOpt, p, widget);
1407 break; }
1409 case CE_ScrollBarSubPage: {
1410 QBrush br;
1411 QBrush bg = p->background();
1412 Qt::BGMode bg_mode = p->backgroundMode();
1413 p->setPen(Qt::NoPen);
1414 p->setBackgroundMode(Qt::OpaqueMode);
1415
1416 if (opt->state & State_Sunken) {
1418 p->setBackground(opt->palette.dark().color());
1419 p->setBrush(br);
1420 } else {
1421 const QBrush paletteBrush = opt->palette.brush(QPalette::Light);
1422 if (paletteBrush.style() == Qt::TexturePattern) {
1423 if (qHasPixmapTexture(paletteBrush))
1424 br = QBrush(paletteBrush.texture());
1425 else
1426 br = QBrush(paletteBrush.textureImage());
1427 } else
1429 p->setBackground(opt->palette.window().color());
1430 p->setBrush(br);
1431 }
1432 p->drawRect(opt->rect);
1433 p->setBackground(bg);
1434 p->setBackgroundMode(bg_mode);
1435 break; }
1436 case CE_ScrollBarSlider:
1437 if (!(opt->state & State_Enabled)) {
1438 QBrush br;
1439 const QBrush paletteBrush = opt->palette.brush(QPalette::Light);
1440 if (paletteBrush.style() == Qt::TexturePattern) {
1441 if (qHasPixmapTexture(paletteBrush))
1442 br = QBrush(paletteBrush.texture());
1443 else
1444 br = QBrush(paletteBrush.textureImage());
1445 } else
1447 p->setPen(Qt::NoPen);
1448 p->setBrush(br);
1449 p->setBackgroundMode(Qt::OpaqueMode);
1450 p->drawRect(opt->rect);
1451 } else {
1452 QStyleOptionButton buttonOpt;
1453 buttonOpt.QStyleOption::operator=(*opt);
1454 buttonOpt.state = State_Enabled | State_Raised;
1455
1456 QPalette pal(opt->palette);
1460 }
1461 break;
1462#endif // QT_CONFIG(scrollbar)
1463 case CE_HeaderSection: {
1464 QBrush fill;
1465 if (opt->state & State_On)
1467 else
1469
1470 if (opt->state & (State_Raised | State_Sunken)) {
1472 } else {
1473 p->fillRect(opt->rect, fill);
1474 }
1475 break; }
1476#if 0 && QT_CONFIG(toolbar)
1477 case CE_ToolBar:
1478 if (const QStyleOptionToolBar *toolbar = qstyleoption_cast<const QStyleOptionToolBar *>(opt)) {
1479 // Reserve the beveled appearance only for mainwindow toolbars
1480 if (!(widget && qobject_cast<const QMainWindow*> (widget->parentWidget())))
1481 break;
1482
1483 QRect rect = opt->rect;
1484 bool paintLeftBorder = true;
1485 bool paintRightBorder = true;
1486 bool paintBottomBorder = true;
1487
1488 switch (toolbar->toolBarArea){
1490 switch (toolbar->positionOfLine){
1493 paintBottomBorder = false;
1494 break;
1495 default:
1496 break;
1497 }
1498 Q_FALLTHROUGH(); // It continues in the end of the next case
1499 case Qt::TopToolBarArea :
1500 switch (toolbar->positionWithinLine){
1502 paintLeftBorder = false;
1503 break;
1505 paintRightBorder = false;
1506 break;
1508 paintRightBorder = false;
1509 paintLeftBorder = false;
1510 break;
1511 default:
1512 break;
1513 }
1514 if (opt->direction == Qt::RightToLeft){ //reverse layout changes the order of Beginning/end
1515 bool tmp = paintLeftBorder;
1516 paintRightBorder=paintLeftBorder;
1517 paintLeftBorder=tmp;
1518 }
1519 break;
1521 switch (toolbar->positionOfLine){
1524 paintRightBorder = false;
1525 break;
1526 default:
1527 break;
1528 }
1529 break;
1530 case Qt::LeftToolBarArea :
1531 switch (toolbar->positionOfLine){
1534 paintLeftBorder = false;
1535 break;
1536 default:
1537 break;
1538 }
1539 break;
1540 default:
1541 break;
1542 }
1543
1544
1545 //draw top border
1546 p->setPen(QPen(opt->palette.light().color()));
1547 p->drawLine(rect.topLeft().x(),
1548 rect.topLeft().y(),
1549 rect.topRight().x(),
1550 rect.topRight().y());
1551
1552 if (paintLeftBorder){
1553 p->setPen(QPen(opt->palette.light().color()));
1554 p->drawLine(rect.topLeft().x(),
1555 rect.topLeft().y(),
1556 rect.bottomLeft().x(),
1557 rect.bottomLeft().y());
1558 }
1559
1560 if (paintRightBorder){
1561 p->setPen(QPen(opt->palette.dark().color()));
1562 p->drawLine(rect.topRight().x(),
1563 rect.topRight().y(),
1564 rect.bottomRight().x(),
1565 rect.bottomRight().y());
1566 }
1567
1568 if (paintBottomBorder){
1569 p->setPen(QPen(opt->palette.dark().color()));
1570 p->drawLine(rect.bottomLeft().x(),
1571 rect.bottomLeft().y(),
1572 rect.bottomRight().x(),
1573 rect.bottomRight().y());
1574 }
1575 }
1576 break;
1577
1578
1579#endif // QT_CONFIG(toolbar)
1580
1582 if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(opt)) {
1583 QRect rect = pb->rect;
1584 if (!rect.isValid())
1585 return;
1586
1587 const bool vertical = !(pb->state & QStyle::State_Horizontal);
1588 const bool inverted = pb->invertedAppearance;
1589
1590 QTransform m;
1591 if (vertical) {
1592 rect = QRect(rect.y(), rect.x(), rect.height(), rect.width()); // flip width and height
1593 m.rotate(90);
1594 m.translate(0, -(rect.height() + rect.y()*2));
1595 }
1596 QPalette pal2 = pb->palette;
1597 // Correct the highlight color if it is the same as the background
1598 if (pal2.highlight() == pal2.window())
1599 pal2.setColor(QPalette::Highlight, pb->palette.color(QPalette::Active,
1601 bool reverse = ((!vertical && (pb->direction == Qt::RightToLeft)) || vertical);
1602 if (inverted)
1603 reverse = !reverse;
1604 int w = rect.width();
1605 Q_D(const QWindowsStyle);
1606 if (pb->minimum == 0 && pb->maximum == 0) {
1607 const int unit_width = proxy()->pixelMetric(PM_ProgressBarChunkWidth, pb);
1608 QStyleOptionProgressBar pbBits = *pb;
1609 Q_ASSERT(unit_width >0);
1610
1611 pbBits.rect = rect;
1612 pbBits.palette = pal2;
1613
1614 int step = 0;
1615 int chunkCount = w / unit_width + 1;
1616#if 0 && QT_CONFIG(animation)
1617 if (QProgressStyleAnimation *animation = qobject_cast<QProgressStyleAnimation*>(d->animation(opt->styleObject)))
1618 step = (animation->animationStep() / 3) % chunkCount;
1619 else
1620 d->startAnimation(new QProgressStyleAnimation(d->animationFps, opt->styleObject));
1621#else
1622 Q_UNUSED(d);
1623#endif
1624 int chunksInRow = 5;
1625 int myY = pbBits.rect.y();
1626 int myHeight = pbBits.rect.height();
1627 int chunksToDraw = chunksInRow;
1628
1629 if (step > chunkCount - 5)chunksToDraw = (chunkCount - step);
1630 p->save();
1631 p->setClipRect(m.mapRect(QRectF(rect)).toRect());
1632
1633 int x0 = reverse ? rect.left() + rect.width() - unit_width*(step) - unit_width : rect.left() + unit_width * step;
1634 int x = 0;
1635
1636 for (int i = 0; i < chunksToDraw ; ++i) {
1637 pbBits.rect.setRect(x0 + x, myY, unit_width, myHeight);
1638 pbBits.rect = m.mapRect(QRectF(pbBits.rect)).toRect();
1640 x += reverse ? -unit_width : unit_width;
1641 }
1642 //Draw wrap-around chunks
1643 if ( step > chunkCount-5){
1644 x0 = reverse ? rect.left() + rect.width() - unit_width : rect.left() ;
1645 x = 0;
1646 int chunksToDraw = step - (chunkCount - chunksInRow);
1647 for (int i = 0; i < chunksToDraw ; ++i) {
1648 pbBits.rect.setRect(x0 + x, myY, unit_width, myHeight);
1649 pbBits.rect = m.mapRect(QRectF(pbBits.rect)).toRect();
1651 x += reverse ? -unit_width : unit_width;
1652 }
1653 }
1654 p->restore(); //restore state
1655 }
1656 else {
1657#if 0 && QT_CONFIG(animation)
1658 d->stopAnimation(opt->styleObject);
1659#endif
1661 }
1662 }
1663 break;
1664
1665#if 0 && QT_CONFIG(dockwidget)
1666 case CE_DockWidgetTitle:
1667
1668 if (const QStyleOptionDockWidget *dwOpt = qstyleoption_cast<const QStyleOptionDockWidget *>(opt)) {
1669 Q_D(const QWindowsStyle);
1670
1671 const bool verticalTitleBar = dwOpt->verticalTitleBar;
1672
1673 QRect rect = dwOpt->rect;
1674 QRect r = rect;
1675
1676 if (verticalTitleBar) {
1677 r = r.transposed();
1678
1679 p->save();
1680 p->translate(r.left(), r.top() + r.width());
1681 p->rotate(-90);
1682 p->translate(-r.left(), -r.top());
1683 }
1684
1685 bool floating = false;
1686 bool active = dwOpt->state & State_Active;
1687 QColor inactiveCaptionTextColor = d->inactiveCaptionText;
1688 if (dwOpt->movable) {
1689 QColor left, right;
1690
1691 //Titlebar gradient
1693 floating = true;
1694 if (active) {
1695 left = d->activeCaptionColor;
1696 right = d->activeGradientCaptionColor;
1697 } else {
1698 left = d->inactiveCaptionColor;
1699 right = d->inactiveGradientCaptionColor;
1700 }
1701 QBrush fillBrush(left);
1702 if (left != right) {
1703 QPoint p1(r.x(), r.top() + r.height()/2);
1704 QPoint p2(rect.right(), r.top() + r.height()/2);
1705 QLinearGradient lg(p1, p2);
1706 lg.setColorAt(0, left);
1707 lg.setColorAt(1, right);
1708 fillBrush = lg;
1709 }
1710 p->fillRect(r.adjusted(0, 0, 0, -3), fillBrush);
1711 }
1712 }
1713 if (!dwOpt->title.isEmpty()) {
1714 QFont oldFont = p->font();
1715 if (floating) {
1716 QFont font = oldFont;
1717 font.setBold(true);
1718 p->setFont(font);
1719 }
1720 QPalette palette = dwOpt->palette;
1721 palette.setColor(QPalette::Window, inactiveCaptionTextColor);
1723 if (verticalTitleBar) {
1724 titleRect = QRect(r.left() + rect.bottom()
1725 - titleRect.bottom(),
1726 r.top() + titleRect.left() - rect.left(),
1727 titleRect.height(), titleRect.width());
1728 }
1729 proxy()->drawItemText(p, titleRect,
1731 dwOpt->state & State_Enabled, dwOpt->title,
1733 p->setFont(oldFont);
1734 }
1735 if (verticalTitleBar)
1736 p->restore();
1737 }
1738 return;
1739#endif // QT_CONFIG(dockwidget)
1740#if 0 && QT_CONFIG(combobox)
1741 case CE_ComboBoxLabel:
1742 if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
1743 if (cb->state & State_HasFocus) {
1744 p->setPen(cb->palette.highlightedText().color());
1745 p->setBackground(cb->palette.highlight());
1746 } else {
1747 p->setPen(cb->palette.text().color());
1748 p->setBackground(cb->palette.window());
1749 }
1750 }
1752 break;
1753#endif // QT_CONFIG(combobox)
1754 default:
1756 }
1757}
1758
1761{
1762 QRect r;
1763 switch (sr) {
1764 case SE_SliderFocusRect:
1767 break;
1770 const QStyleOptionDockWidget *dwOpt
1771 = qstyleoption_cast<const QStyleOptionDockWidget*>(opt);
1772 const bool verticalTitleBar = dwOpt && dwOpt->verticalTitleBar;
1774 if (verticalTitleBar) {
1775 r.adjust(0, 0, 0, -m);
1776 } else {
1778 r.adjust(m, 0, 0, 0);
1779 else
1780 r.adjust(0, 0, -m, 0);
1781 }
1782 break;
1783 }
1786 r.adjust(3, 3, -3, -3);
1787 break;
1788 default:
1790 }
1791 return r;
1792}
1793
1794
1797 QPainter *p) const
1798{
1799#if 0
1800 switch (cc) {
1801#if QT_CONFIG(slider)
1802 case CC_Slider:
1803 if (const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
1804 int thickness = proxy()->pixelMetric(PM_SliderControlThickness, slider);
1805 int len = proxy()->pixelMetric(PM_SliderLength, slider);
1806 int ticks = slider->tickPosition;
1807 QRect groove = proxy()->subControlRect(CC_Slider, slider, SC_SliderGroove);
1809
1810 if ((slider->subControls & SC_SliderGroove) && groove.isValid()) {
1811 int mid = thickness / 2;
1812
1814 mid += len / 8;
1816 mid -= len / 8;
1817
1818 p->setPen(slider->palette.shadow().color());
1819 if (slider->orientation == Qt::Horizontal) {
1820 qDrawWinPanel(p, groove.x(), groove.y() + mid - 2,
1821 groove.width(), 4, slider->palette, true);
1822 p->drawLine(groove.x() + 1, groove.y() + mid - 1,
1823 groove.x() + groove.width() - 3, groove.y() + mid - 1);
1824 } else {
1825 qDrawWinPanel(p, groove.x() + mid - 2, groove.y(),
1826 4, groove.height(), slider->palette, true);
1827 p->drawLine(groove.x() + mid - 1, groove.y() + 1,
1828 groove.x() + mid - 1, groove.y() + groove.height() - 3);
1829 }
1830 }
1831
1832 if (slider->subControls & SC_SliderTickmarks) {
1833 QStyleOptionSlider tmpSlider = *slider;
1834 tmpSlider.subControls = SC_SliderTickmarks;
1835 QCommonStyle::drawComplexControl(cc, &tmpSlider, p);
1836 }
1837
1838 if (slider->subControls & SC_SliderHandle) {
1839 // 4444440
1840 // 4333310
1841 // 4322210
1842 // 4322210
1843 // 4322210
1844 // 4322210
1845 // *43210*
1846 // **410**
1847 // ***0***
1848 const QColor c0 = slider->palette.shadow().color();
1849 const QColor c1 = slider->palette.dark().color();
1850 // const QColor c2 = g.button();
1851 const QColor c3 = slider->palette.midlight().color();
1852 const QColor c4 = slider->palette.light().color();
1853 QBrush handleBrush;
1854
1855 if (slider->state & State_Enabled) {
1856 handleBrush = slider->palette.color(QPalette::Button);
1857 } else {
1858 handleBrush = QBrush(slider->palette.color(QPalette::Button),
1860 }
1861
1862
1863 int x = handle.x(), y = handle.y(),
1864 wi = handle.width(), he = handle.height();
1865
1866 int x1 = x;
1867 int x2 = x+wi-1;
1868 int y1 = y;
1869 int y2 = y+he-1;
1870
1871 Qt::Orientation orient = slider->orientation;
1872 bool tickAbove = slider->tickPosition == QStyleOptionSlider::TicksAbove;
1873 bool tickBelow = slider->tickPosition == QStyleOptionSlider::TicksBelow;
1874
1875 if (slider->state & State_HasFocus) {
1877 fropt.QStyleOption::operator=(*slider);
1878 fropt.rect = subElementRect(SE_SliderFocusRect, slider);
1880 }
1881
1882 if ((tickAbove && tickBelow) || (!tickAbove && !tickBelow)) {
1883 Qt::BGMode oldMode = p->backgroundMode();
1884 p->setBackgroundMode(Qt::OpaqueMode);
1885 qDrawWinButton(p, QRect(x, y, wi, he), slider->palette, false,
1886 &handleBrush);
1887 p->setBackgroundMode(oldMode);
1888 return;
1889 }
1890
1892
1893 if (orient == Qt::Horizontal)
1894 if (tickAbove)
1895 dir = SlUp;
1896 else
1897 dir = SlDown;
1898 else
1899 if (tickAbove)
1900 dir = SlLeft;
1901 else
1902 dir = SlRight;
1903
1904 QPolygon a;
1905
1906 int d = 0;
1907 switch (dir) {
1908 case SlUp:
1909 y1 = y1 + wi/2;
1910 d = (wi + 1) / 2 - 1;
1911 a.setPoints(5, x1,y1, x1,y2, x2,y2, x2,y1, x1+d,y1-d);
1912 break;
1913 case SlDown:
1914 y2 = y2 - wi/2;
1915 d = (wi + 1) / 2 - 1;
1916 a.setPoints(5, x1,y1, x1,y2, x1+d,y2+d, x2,y2, x2,y1);
1917 break;
1918 case SlLeft:
1919 d = (he + 1) / 2 - 1;
1920 x1 = x1 + he/2;
1921 a.setPoints(5, x1,y1, x1-d,y1+d, x1,y2, x2,y2, x2,y1);
1922 break;
1923 case SlRight:
1924 d = (he + 1) / 2 - 1;
1925 x2 = x2 - he/2;
1926 a.setPoints(5, x1,y1, x1,y2, x2,y2, x2+d,y1+d, x2,y1);
1927 break;
1928 }
1929
1930 QBrush oldBrush = p->brush();
1931 p->setPen(Qt::NoPen);
1932 p->setBrush(handleBrush);
1933 Qt::BGMode oldMode = p->backgroundMode();
1934 p->setBackgroundMode(Qt::OpaqueMode);
1935 p->drawRect(x1, y1, x2-x1+1, y2-y1+1);
1936 p->drawPolygon(a);
1937 p->setBrush(oldBrush);
1938 p->setBackgroundMode(oldMode);
1939
1940 if (dir != SlUp) {
1941 p->setPen(c4);
1942 p->drawLine(x1, y1, x2, y1);
1943 p->setPen(c3);
1944 p->drawLine(x1, y1+1, x2, y1+1);
1945 }
1946 if (dir != SlLeft) {
1947 p->setPen(c3);
1948 p->drawLine(x1+1, y1+1, x1+1, y2);
1949 p->setPen(c4);
1950 p->drawLine(x1, y1, x1, y2);
1951 }
1952 if (dir != SlRight) {
1953 p->setPen(c0);
1954 p->drawLine(x2, y1, x2, y2);
1955 p->setPen(c1);
1956 p->drawLine(x2-1, y1+1, x2-1, y2-1);
1957 }
1958 if (dir != SlDown) {
1959 p->setPen(c0);
1960 p->drawLine(x1, y2, x2, y2);
1961 p->setPen(c1);
1962 p->drawLine(x1+1, y2-1, x2-1, y2-1);
1963 }
1964
1965 switch (dir) {
1966 case SlUp:
1967 p->setPen(c4);
1968 p->drawLine(x1, y1, x1+d, y1-d);
1969 p->setPen(c0);
1970 d = wi - d - 1;
1971 p->drawLine(x2, y1, x2-d, y1-d);
1972 d--;
1973 p->setPen(c3);
1974 p->drawLine(x1+1, y1, x1+1+d, y1-d);
1975 p->setPen(c1);
1976 p->drawLine(x2-1, y1, x2-1-d, y1-d);
1977 break;
1978 case SlDown:
1979 p->setPen(c4);
1980 p->drawLine(x1, y2, x1+d, y2+d);
1981 p->setPen(c0);
1982 d = wi - d - 1;
1983 p->drawLine(x2, y2, x2-d, y2+d);
1984 d--;
1985 p->setPen(c3);
1986 p->drawLine(x1+1, y2, x1+1+d, y2+d);
1987 p->setPen(c1);
1988 p->drawLine(x2-1, y2, x2-1-d, y2+d);
1989 break;
1990 case SlLeft:
1991 p->setPen(c4);
1992 p->drawLine(x1, y1, x1-d, y1+d);
1993 p->setPen(c0);
1994 d = he - d - 1;
1995 p->drawLine(x1, y2, x1-d, y2-d);
1996 d--;
1997 p->setPen(c3);
1998 p->drawLine(x1, y1+1, x1-d, y1+1+d);
1999 p->setPen(c1);
2000 p->drawLine(x1, y2-1, x1-d, y2-1-d);
2001 break;
2002 case SlRight:
2003 p->setPen(c4);
2004 p->drawLine(x2, y1, x2+d, y1+d);
2005 p->setPen(c0);
2006 d = he - d - 1;
2007 p->drawLine(x2, y2, x2+d, y2-d);
2008 d--;
2009 p->setPen(c3);
2010 p->drawLine(x2, y1+1, x2+d, y1+1+d);
2011 p->setPen(c1);
2012 p->drawLine(x2, y2-1, x2+d, y2-1-d);
2013 break;
2014 }
2015 }
2016 }
2017 break;
2018#endif // QT_CONFIG(slider)
2019#if QT_CONFIG(scrollbar)
2020 case CC_ScrollBar:
2021 if (const QStyleOptionSlider *scrollbar = qstyleoption_cast<const QStyleOptionSlider *>(opt)) {
2022 QStyleOptionSlider newScrollbar = *scrollbar;
2023 if (scrollbar->minimum == scrollbar->maximum)
2024 newScrollbar.state &= ~State_Enabled; //do not draw the slider.
2025 QCommonStyle::drawComplexControl(cc, &newScrollbar, p, widget);
2026 }
2027 break;
2028#endif // QT_CONFIG(scrollbar)
2029#if QT_CONFIG(combobox)
2030 case CC_ComboBox:
2031 if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
2032 QBrush editBrush = cmb->palette.brush(QPalette::Button);
2033 if ((cmb->subControls & SC_ComboBoxFrame)) {
2034 if (cmb->frame) {
2035 QPalette shadePal = opt->palette;
2036 shadePal.setColor(QPalette::Midlight, shadePal.button().color());
2037 qDrawWinPanel(p, opt->rect, shadePal, true, &editBrush);
2038 }
2039 else {
2040 p->fillRect(opt->rect, editBrush);
2041 }
2042 }
2043 if (cmb->subControls & SC_ComboBoxArrow) {
2045
2047 bool sunkenArrow = cmb->activeSubControls == SC_ComboBoxArrow
2048 && cmb->state & State_Sunken;
2049 if (sunkenArrow) {
2050 p->setPen(cmb->palette.dark().color());
2051 p->setBrush(cmb->palette.brush(QPalette::Button));
2052 p->drawRect(ar.adjusted(0,0,-1,-1));
2053 } else {
2054 // Make qDrawWinButton use the right colors for drawing the shade of the button
2055 QPalette pal(cmb->palette);
2056 pal.setColor(QPalette::Button, cmb->palette.light().color());
2057 pal.setColor(QPalette::Light, cmb->palette.button().color());
2058 qDrawWinButton(p, ar, pal, false,
2059 &cmb->palette.brush(QPalette::Button));
2060 }
2061
2062 ar.adjust(2, 2, -2, -2);
2063 if (opt->state & State_Enabled)
2065 if (opt->state & State_HasFocus)
2067
2068 if (sunkenArrow)
2070 QStyleOption arrowOpt = *cmb;
2071 arrowOpt.rect = ar.adjusted(1, 1, -1, -1);
2072 arrowOpt.state = flags;
2074 }
2075
2076 if (cmb->subControls & SC_ComboBoxEditField) {
2078 if (cmb->state & State_HasFocus && !cmb->editable)
2079 p->fillRect(re.x(), re.y(), re.width(), re.height(),
2080 cmb->palette.brush(QPalette::Highlight));
2081
2082 if (cmb->state & State_HasFocus) {
2083 p->setPen(cmb->palette.highlightedText().color());
2084 p->setBackground(cmb->palette.highlight());
2085
2086 } else {
2087 p->setPen(cmb->palette.text().color());
2088 p->setBackground(cmb->palette.window());
2089 }
2090
2091 if (cmb->state & State_HasFocus && !cmb->editable) {
2093 focus.QStyleOption::operator=(*cmb);
2095 focus.state |= State_FocusAtBorder;
2096 focus.backgroundColor = cmb->palette.highlight().color();
2098 }
2099 }
2100 }
2101 break;
2102#endif // QT_CONFIG(combobox)
2103#if QT_CONFIG(spinbox)
2104 case CC_SpinBox:
2105 if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
2108 bool enabled = opt->state & State_Enabled;
2109 if (sb->frame && (sb->subControls & SC_SpinBoxFrame)) {
2110 QBrush editBrush = sb->palette.brush(QPalette::Base);
2112 QPalette shadePal = sb->palette;
2113 shadePal.setColor(QPalette::Midlight, shadePal.button().color());
2114 qDrawWinPanel(p, r, shadePal, true, &editBrush);
2115 }
2116
2117 QPalette shadePal(opt->palette);
2118 shadePal.setColor(QPalette::Button, opt->palette.light().color());
2119 shadePal.setColor(QPalette::Light, opt->palette.button().color());
2120
2121 if (sb->subControls & SC_SpinBoxUp) {
2122 copy.subControls = SC_SpinBoxUp;
2123 QPalette pal2 = sb->palette;
2124 if (!(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled)) {
2126 copy.state &= ~State_Enabled;
2127 }
2128
2129 copy.palette = pal2;
2130
2131 if (sb->activeSubControls == SC_SpinBoxUp && (sb->state & State_Sunken)) {
2132 copy.state |= State_On;
2133 copy.state |= State_Sunken;
2134 } else {
2135 copy.state |= State_Raised;
2136 copy.state &= ~State_Sunken;
2137 }
2138 pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinPlus
2140
2142 qDrawWinButton(p, copy.rect, shadePal, copy.state & (State_Sunken | State_On),
2143 &copy.palette.brush(QPalette::Button));
2144 copy.rect.adjust(4, 1, -5, -1);
2145 if ((!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled))
2147 {
2148 QStyleOptionSpinBox lightCopy = copy;
2149 lightCopy.rect.adjust(1, 1, 1, 1);
2150 lightCopy.palette.setBrush(QPalette::ButtonText, copy.palette.light());
2151 proxy()->drawPrimitive(pe, &lightCopy, p, widget);
2152 }
2153 proxy()->drawPrimitive(pe, &copy, p, widget);
2154 }
2155
2156 if (sb->subControls & SC_SpinBoxDown) {
2157 copy.subControls = SC_SpinBoxDown;
2158 copy.state = sb->state;
2159 QPalette pal2 = sb->palette;
2160 if (!(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled)) {
2162 copy.state &= ~State_Enabled;
2163 }
2164 copy.palette = pal2;
2165
2166 if (sb->activeSubControls == SC_SpinBoxDown && (sb->state & State_Sunken)) {
2167 copy.state |= State_On;
2168 copy.state |= State_Sunken;
2169 } else {
2170 copy.state |= State_Raised;
2171 copy.state &= ~State_Sunken;
2172 }
2173 pe = (sb->buttonSymbols == QAbstractSpinBox::PlusMinus ? PE_IndicatorSpinMinus
2175
2177 qDrawWinButton(p, copy.rect, shadePal, copy.state & (State_Sunken | State_On),
2178 &copy.palette.brush(QPalette::Button));
2179 copy.rect.adjust(4, 0, -5, -1);
2180 if ((!enabled || !(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled))
2182 {
2183 QStyleOptionSpinBox lightCopy = copy;
2184 lightCopy.rect.adjust(1, 1, 1, 1);
2185 lightCopy.palette.setBrush(QPalette::ButtonText, copy.palette.light());
2186 proxy()->drawPrimitive(pe, &lightCopy, p, widget);
2187 }
2188 proxy()->drawPrimitive(pe, &copy, p, widget);
2189 }
2190 }
2191 break;
2192#endif // QT_CONFIG(spinbox)
2193 default:
2195 }
2196#else // 0
2198#endif
2199}
2200
2203{
2204 QSize sz(csz);
2205 switch (ct) {
2206 case CT_PushButton:
2207 if (const QStyleOptionButton *btn = qstyleoption_cast<const QStyleOptionButton *>(opt)) {
2208 sz = QCommonStyle::sizeFromContents(ct, opt, csz);
2209 int w = sz.width(),
2210 h = sz.height();
2211 int defwidth = 0;
2213 defwidth = 2 * proxy()->pixelMetric(PM_ButtonDefaultIndicator, btn);
2214 const qreal dpi = QStyleHelper::dpi(opt);
2215 int minwidth = int(QStyleHelper::dpiScaled(75, dpi));
2216 int minheight = int(QStyleHelper::dpiScaled(23, dpi));
2217
2218#ifndef QT_QWS_SMALL_PUSHBUTTON
2219 if (w < minwidth + defwidth && !btn->text.isEmpty())
2220 w = minwidth + defwidth;
2221 if (h < minheight + defwidth)
2222 h = minheight + defwidth;
2223#endif
2224 sz = QSize(w, h);
2225 }
2226 break;
2227#if 0 && QT_CONFIG(menu)
2228 case CT_MenuItem:
2229 if (const QStyleOptionMenuItem *mi = qstyleoption_cast<const QStyleOptionMenuItem *>(opt)) {
2230 int w = sz.width();
2232
2233 if (mi->menuItemType == QStyleOptionMenuItem::Separator) {
2235 }
2236 else if (mi->icon.isNull()) {
2237 sz.setHeight(sz.height() - 2);
2238 w -= 6;
2239 }
2240
2241 if (mi->menuItemType != QStyleOptionMenuItem::Separator && !mi->icon.isNull()) {
2242 int iconExtent = proxy()->pixelMetric(PM_SmallIconSize, opt, widget);
2243 sz.setHeight(qMax(sz.height(),
2244 mi->icon.actualSize(QSize(iconExtent, iconExtent)).height()
2246 }
2247 int maxpmw = mi->maxIconWidth;
2248 int tabSpacing = 20;
2249 if (mi->text.contains(QLatin1Char('\t')))
2250 w += tabSpacing;
2251 else if (mi->menuItemType == QStyleOptionMenuItem::SubMenu)
2253 else if (mi->menuItemType == QStyleOptionMenuItem::DefaultItem) {
2254 // adjust the font and add the difference in size.
2255 // it would be better if the font could be adjusted in the initStyleOption qmenu func!!
2256 QFontMetrics fm(mi->font);
2257 QFont fontBold = mi->font;
2258 fontBold.setBold(true);
2259 QFontMetrics fmBold(fontBold);
2260 w += fmBold.horizontalAdvance(mi->text) - fm.horizontalAdvance(mi->text);
2261 }
2262
2263 int checkcol = qMax<int>(maxpmw, QWindowsStylePrivate::windowsCheckMarkWidth); // Windows always shows a check column
2264 w += checkcol;
2266 sz.setWidth(w);
2267 }
2268 break;
2269#endif // QT_CONFIG(menu)
2270#if 0 && QT_CONFIG(menubar)
2271 case CT_MenuBarItem:
2272 if (!sz.isEmpty())
2274 break;
2275#endif
2276 case CT_ToolButton:
2277 if (qstyleoption_cast<const QStyleOptionToolButton *>(opt))
2278 return sz += QSize(7, 6);
2279 Q_FALLTHROUGH();
2280
2281 default:
2282 sz = QCommonStyle::sizeFromContents(ct, opt, csz);
2283 }
2284 return sz;
2285}
2286
2288{
2289 // Update system palette in the theme (quick)
2290 // Since windows style doesn't support dark appearance,
2291 // light palette will always be set in the quick theme
2292 QPalette pal;
2294 if (auto nativeWindowsApp = dynamic_cast<QWindowsApplication *>(QGuiApplicationPrivate::platformIntegration()))
2295 nativeWindowsApp->populateLightSystemPalette(pal);
2296 QQuickTheme::instance()->setPalette(QQuickTheme::System, pal);
2297}
2298
2300{
2301 // The timer used here compresses ApplicationPaletteChange event and get triggered once
2302 // this event has been propagated for all items.
2303 if (!paletteTimer.isActive())
2304 paletteTimer.start(0, this);
2305}
2306
2314
2315} // namespace QQC2
2316
2318
2319#include "moc_qquickwindowsstyle_p.cpp"
static QWidget * activeWindow()
Returns the application top-level window that has the keyboard input focus, or \nullptr if no applica...
void start(int msec, QObject *obj)
\obsolete Use chrono overload instead.
int timerId() const noexcept
Returns the timer's ID.
Definition qbasictimer.h:35
void stop()
Stops the timer.
bool isActive() const noexcept
Returns true if the timer is running and has not been stopped; otherwise returns false.
Definition qbasictimer.h:34
\inmodule QtGui
Definition qbrush.h:30
const QColor & color() const
Returns the brush color.
Definition qbrush.h:121
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
QColor toRgb() const noexcept
Create and returns an RGB QColor based on this color.
Definition qcolor.cpp:2035
\inmodule QtCore
Definition qcoreevent.h:45
@ KeyRelease
Definition qcoreevent.h:65
@ KeyPress
Definition qcoreevent.h:64
Type type() const
Returns the event type.
Definition qcoreevent.h:304
\reentrant \inmodule QtGui
\reentrant
Definition qfont.h:22
void setBold(bool)
If enable is true sets the font's weight to \l{Weight}{QFont::Bold}; otherwise sets the weight to \l{...
Definition qfont.h:373
int lineWidth
the line width
Definition qframe.h:22
static QPlatformIntegration * platformIntegration()
static QList< QScreen * > screen_list
static QPlatformTheme * platformTheme()
static QPlatformNativeInterface * platformNativeInterface()
QScreen * primaryScreen
the primary (or default) screen of the application.
The QIcon class provides scalable icons in different modes and states.
Definition qicon.h:20
Mode
This enum type describes the mode for which a pixmap is intended to be used.
Definition qicon.h:22
@ Disabled
Definition qicon.h:22
@ Normal
Definition qicon.h:22
@ Active
Definition qicon.h:22
@ On
Definition qicon.h:23
The QKeyEvent class describes a key event.
Definition qevent.h:424
int key() const
Returns the code of the key that was pressed or released.
Definition qevent.h:434
\inmodule QtGui
Definition qbrush.h:394
The QMenuBar class provides a horizontal menu bar.
Definition qmenubar.h:20
int id(int=0) const
Definition qmetatype.h:475
Native interface to QGuiApplication, to be retrieved from QPlatformIntegration. \inmodule QtGui.
\inmodule QtCore
Definition qobject.h:103
T findChild(QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
Returns the child of this object that can be cast into type T and that is called name,...
Definition qobject.h:155
virtual bool eventFilter(QObject *watched, QEvent *event)
Filters events if this object has been installed as an event filter for the watched object.
Definition qobject.cpp:1555
QList< T > findChildren(QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
Returns all children of this object with the given name that can be cast to type T,...
Definition qobject.h:164
QVariant property(const char *name) const
Returns the value of the object's name property.
Definition qobject.cpp:4323
\inmodule QtGui
void addEllipse(const QRectF &rect)
Creates an ellipse within the specified boundingRectangle and adds it to the painter path as a closed...
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
@ Antialiasing
Definition qpainter.h:52
The QPalette class contains color groups for each widget state.
Definition qpalette.h:19
const QBrush & button() const
Returns the button brush of the current color group.
Definition qpalette.h:84
const QBrush & text() const
Returns the text foreground brush of the current color group.
Definition qpalette.h:88
const QBrush & dark() const
Returns the dark brush of the current color group.
Definition qpalette.h:86
const QBrush & brush(ColorGroup cg, ColorRole cr) const
Returns the brush in the specified color group, used for the given color role.
Definition qpalette.cpp:748
const QBrush & shadow() const
Returns the shadow brush of the current color group.
Definition qpalette.h:97
const QBrush & light() const
Returns the light brush of the current color group.
Definition qpalette.h:85
void setCurrentColorGroup(ColorGroup cg)
Set the palette's current color group to cg.
Definition qpalette.h:65
const QBrush & midlight() const
Returns the midlight brush of the current color group.
Definition qpalette.h:94
@ Disabled
Definition qpalette.h:49
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...
Definition qpalette.h:146
const QBrush & window() const
Returns the window (general background) brush of the current color group.
Definition qpalette.h:93
const QBrush & base() const
Returns the base brush of the current color group.
Definition qpalette.h:89
@ BrightText
Definition qpalette.h:52
@ ButtonText
Definition qpalette.h:52
@ WindowText
Definition qpalette.h:51
@ Highlight
Definition qpalette.h:53
@ Midlight
Definition qpalette.h:51
const QBrush & highlightedText() const
Returns the highlighted text brush of the current color group.
Definition qpalette.h:99
\inmodule QtGui
Definition qpen.h:28
int width() const
Returns the pen width with integer precision.
Definition qpen.cpp:560
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
int width() const
Returns the width of the pixmap.
Definition qpixmap.cpp:468
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.
Definition qpixmap.cpp:1437
virtual QDpi logicalDpi() const
Reimplement this function in subclass to return the logical horizontal and vertical dots per inch met...
The QPlatformTheme class allows customizing the UI based on themes.
\inmodule QtCore\reentrant
Definition qpoint.h:217
\inmodule QtCore\reentrant
Definition qpoint.h:25
The QPolygon class provides a list of points using integer precision.
Definition qpolygon.h:23
Q_GUI_EXPORT void setPoints(int nPoints, const int *points)
Resizes the polygon to nPoints and populates it with the given points.
Definition qpolygon.cpp:253
void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p) const override
QRect subElementRect(SubElement r, const QStyleOption *opt) const override
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p) const override
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *opt=nullptr) const override
int styleHint(StyleHint sh, const QStyleOption *opt=nullptr, QStyleHintReturn *shret=nullptr) const override
QPixmap standardPixmap(StandardPixmap sp, const QStyleOption *opt=nullptr) const override
int pixelMetric(PixelMetric m, const QStyleOption *opt=nullptr) const override
QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize) const override
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p) const override
\reimp
QStyle::SubControls subControls
const QStyle * proxy() const
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr) const =0
@ SE_DockWidgetTitleBarText
virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p) const =0
virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc) const =0
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.
@ SH_MenuBar_AltKeyNavigation
@ SH_Slider_StopMouseOverSlider
@ SH_DialogButtonBox_ButtonsHaveIcons
@ SH_FontDialog_SelectAssociatedText
@ SH_Menu_SubMenuSloppyCloseTimeout
@ SH_MenuBar_MouseTracking
@ SH_ToolBox_SelectedPageTitleBold
@ SH_ItemView_ArrowKeysNavigateIntoChildren
@ SH_ItemView_ChangeHighlightOnFocus
@ SH_Menu_AllowActiveAndDisabled
@ SH_ItemView_ShowDecorationSelected
@ SH_PrintDialog_RightAlignButtons
@ SH_ComboBox_ListMouseTracking
@ SH_MainWindow_SpaceBelowMenuBar
@ SH_Menu_SubMenuPopupDelay
virtual int styleHint(StyleHint stylehint, const QStyleOption *opt=nullptr, QStyleHintReturn *returnData=nullptr) const =0
@ State_KeyboardFocusChange
Definition qquickstyle.h:65
@ PE_IndicatorItemViewItemCheck
@ PE_IndicatorRadioButton
@ PE_PanelButtonCommand
Definition qquickstyle.h:91
@ PE_IndicatorArrowLeft
Definition qquickstyle.h:99
@ PE_IndicatorToolBarHandle
@ PE_FrameStatusBarItem
Definition qquickstyle.h:84
@ PE_IndicatorMenuCheckMark
@ PE_IndicatorToolBarSeparator
@ PE_FrameDefaultButton
Definition qquickstyle.h:78
@ PE_IndicatorProgressChunk
@ PE_IndicatorArrowDown
Definition qquickstyle.h:98
@ PE_IndicatorDockWidgetResizeHandle
@ PM_TabBarTabShiftHorizontal
@ PM_ButtonDefaultIndicator
@ PM_MdiSubWindowFrameWidth
@ PM_ProgressBarChunkWidth
@ PM_DockWidgetTitleBarButtonMargin
@ PM_ButtonShiftHorizontal
@ PM_SliderControlThickness
@ PM_DockWidgetFrameWidth
@ PM_DockWidgetSeparatorExtent
@ PM_TabBarTabShiftVertical
@ PM_DockWidgetTitleMargin
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.
@ SP_MessageBoxInformation
static int fixedPixelMetric(QStyle::PixelMetric pm)
static qreal devicePixelRatio(const QStyleOption *option=nullptr)
static qreal nativeMetricScaleFactor(const QStyleOption *option=nullptr)
QList< const QWidget * > seenAlt
static int pixelMetricFromSystemDp(QStyle::PixelMetric pm, const QStyleOption *option=nullptr)
The QWindowsStyle class provides a Microsoft Windows-like look and feel.
QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option=nullptr) const override
\reimp
void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p) const override
\reimp
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p) const override
\reimp
int pixelMetric(PixelMetric pm, const QStyleOption *option=nullptr) const override
\reimp
int styleHint(StyleHint hint, const QStyleOption *opt=nullptr, QStyleHintReturn *returnData=nullptr) const override
\reimp
void timerEvent(QTimerEvent *event) override
This event handler can be reimplemented in a subclass to receive timer events for the object.
QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt) const override
\reimp
~QWindowsStyle() override
Destroys the QWindowsStyle object.
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p) const override
\reimp
QWindowsStyle()
Constructs a QWindowsStyle object.
QRect subElementRect(SubElement r, const QStyleOption *opt) const override
\reimp
QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize) const override
\reimp
static QQuickTheme * instance()
\inmodule QtCore\reentrant
Definition qrect.h:484
\inmodule QtCore\reentrant
Definition qrect.h:30
constexpr QPoint bottomLeft() const noexcept
Returns the position of the rectangle's bottom-left corner.
Definition qrect.h:230
constexpr int height() const noexcept
Returns the height of the rectangle.
Definition qrect.h:239
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
Definition qrect.h:182
constexpr QPoint topLeft() const noexcept
Returns the position of the rectangle's top-left corner.
Definition qrect.h:221
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 ...
Definition qrect.h:370
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
Definition qrect.h:176
constexpr QPoint topRight() const noexcept
Returns the position of the rectangle's top-right corner.
Definition qrect.h:227
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:173
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
Definition qrect.h:185
constexpr QRect transposed() const noexcept
Definition qrect.h:267
constexpr QPoint bottomRight() const noexcept
Returns the position of the rectangle's bottom-right corner.
Definition qrect.h:224
constexpr int width() const noexcept
Returns the width of the rectangle.
Definition qrect.h:236
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
Definition qrect.h:188
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
Definition qrect.h:179
The QRegion class specifies a clip region for a painter.
Definition qregion.h:27
The QScreen class is used to query screen properties. \inmodule QtGui.
Definition qscreen.h:32
QPlatformScreen * handle() const
Get the platform screen handle.
Definition qscreen.cpp:83
\inmodule QtCore
Definition qsize.h:208
\inmodule QtCore
Definition qsize.h:25
constexpr int height() const noexcept
Returns the height.
Definition qsize.h:133
constexpr int width() const noexcept
Returns the width.
Definition qsize.h:130
constexpr void setWidth(int w) noexcept
Sets the width to the given width.
Definition qsize.h:136
constexpr bool isEmpty() const noexcept
Returns true if either of the width and height is less than or equal to 0; otherwise returns false.
Definition qsize.h:124
constexpr void setHeight(int h) noexcept
Sets the height to the given height.
Definition qsize.h:139
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
QString left(qsizetype n) const &
Definition qstring.h:363
QString mid(qsizetype position, qsizetype n=-1) const &
Definition qstring.cpp:5300
bool isEmpty() const noexcept
Returns true if the string has no characters; otherwise returns false.
Definition qstring.h:192
ButtonFeatures features
QStyle::State state
QPalette palette
QObject * styleObject
Qt::LayoutDirection direction
@ RoundedSouth
Definition qtabbar.h:42
@ RoundedNorth
Definition qtabbar.h:42
@ RoundedWest
Definition qtabbar.h:42
@ RoundedEast
Definition qtabbar.h:42
\inmodule QtCore
Definition qcoreevent.h:366
The QTransform class specifies 2D transformations of a coordinate system.
Definition qtransform.h:20
\inmodule QtCore
Definition qvariant.h:65
bool toBool() const
Returns the variant as a bool if the variant has userType() Bool.
QMetaType metaType() const
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
QWidget * window() const
Returns the window for this widget, i.e.
Definition qwidget.cpp:4313
QPalette palette
the widget's palette
Definition qwidget.h:132
QRect rect
the internal geometry of the widget excluding any window frame
Definition qwidget.h:116
QWidget * parentWidget() const
Returns the parent of this widget, or \nullptr if it does not have any parent widget.
Definition qwidget.h:904
bool isWindow() const
Returns true if the widget is an independent window, otherwise returns false.
Definition qwidget.h:811
\inmodule QtGui
Definition qwindow.h:63
@ ModernStyle
Definition qwizard.h:56
QOpenGLWidget * widget
[1]
QPixmap p2
QPixmap p1
[0]
QString text
bool focus
[0]
rect
[4]
QStyleOptionButton opt
QRect textRect
const QStyleOptionButton * btn
[3]
qreal dpi(const QStyleOption *option)
qreal dpiScaled(qreal value, qreal dpi)
static QScreen * screenOf(const QWindow *w)
void qDrawShadeRect(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken, int lineWidth, int midLineWidth, const QBrush *fill)
void qDrawWinPanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken, const QBrush *fill)
void qDrawWinButton(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken, const QBrush *fill)
void qDrawShadePanel(QPainter *p, int x, int y, int w, int h, const QPalette &pal, bool sunken, int lineWidth, const QBrush *fill)
Combined button and popup list for selecting options.
@ AlignRight
Definition qnamespace.h:146
@ AlignVCenter
Definition qnamespace.h:155
@ AlignLeft
Definition qnamespace.h:144
@ LeftToolBarArea
@ BottomToolBarArea
@ TopToolBarArea
@ RightToolBarArea
@ LeftToRight
@ RightToLeft
Orientation
Definition qnamespace.h:98
@ Horizontal
Definition qnamespace.h:99
@ TextSingleLine
Definition qnamespace.h:170
@ TextDontClip
Definition qnamespace.h:171
@ TextHideMnemonic
Definition qnamespace.h:178
@ TextShowMnemonic
Definition qnamespace.h:173
@ OpaqueMode
Definition qnamespace.h:508
@ TransparentMode
Definition qnamespace.h:507
@ white
Definition qnamespace.h:31
@ NoPen
@ Key_Alt
Definition qnamespace.h:686
@ TexturePattern
@ Dense4Pattern
@ WindowType_Mask
Definition qnamespace.h:220
@ Tool
Definition qnamespace.h:212
static jboolean copy(JNIEnv *, jobject)
bool Q_GUI_EXPORT qHasPixmapTexture(const QBrush &brush)
Definition qbrush.cpp:202
#define Q_FALLTHROUGH()
#define qApp
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
Definition qfloat16.h:333
int qRound(qfloat16 d) noexcept
Definition qfloat16.h:327
return ret
constexpr const T & qMax(const T &a, const T &b)
Definition qminmax.h:42
GLboolean GLboolean GLboolean b
GLuint64 GLenum void * handle
GLint GLint GLint GLint GLint x
[0]
GLenum mode
const GLfloat * m
GLuint64 key
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLboolean r
[2]
GLuint GLuint end
GLuint GLfloat GLfloat GLfloat x1
GLdouble GLdouble right
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLint left
GLuint GLfloat x0
GLbitfield flags
GLenum GLuint GLintptr offset
GLint GLint GLint GLint GLint GLint GLint GLbitfield mask
GLfloat n
GLint y
GLfloat GLfloat GLfloat GLfloat h
struct _cl_event * event
GLfixed GLfixed GLint GLint GLfixed points
GLdouble s
[6]
Definition qopenglext.h:235
GLfixed GLfixed GLfixed y2
GLfixed GLfixed x2
GLdouble GLdouble t
Definition qopenglext.h:243
GLuint64EXT * result
[6]
GLfloat GLfloat p
[1]
GLuint GLenum option
GLenum GLsizei len
HICON qt_pixmapToWinHICON(const QPixmap &p)
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
#define sp
#define SPI_GETKEYBOARDCUES
Definition qt_windows.h:68
QScreen * screen
[1]
Definition main.cpp:29
#define QT_BEGIN_INCLUDE_NAMESPACE
#define QT_END_INCLUDE_NAMESPACE
#define Q_UNUSED(x)
double qreal
Definition qtypes.h:187
QWidget * qobject_cast< QWidget * >(QObject *o)
Definition qwidget.h:786
QWidget * win
Definition settings.cpp:6
QWidget * panel
Definition settings.cpp:7
ba fill(true)
QPropertyAnimation animation
[0]
QRect r2(QPoint(100, 200), QSize(11, 16))
QString dir
[11]
widget render & pixmap
QFrame frame
[0]
QMenuBar * menuBar
[0]
\inmodule QtCore \reentrant
Definition qchar.h:18
bool contains(const AT &t) const noexcept
Definition qlist.h:45