1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtWidgets module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#ifndef QSTYLE_H
41#define QSTYLE_H
42
43#include <QtWidgets/qtwidgetsglobal.h>
44#include <QtCore/qobject.h>
45#include <QtCore/qrect.h>
46#include <QtCore/qsize.h>
47#include <QtGui/qicon.h>
48#include <QtGui/qpixmap.h>
49#include <QtGui/qpalette.h>
50#include <QtWidgets/qsizepolicy.h>
51
52QT_BEGIN_NAMESPACE
53
54
55class QAction;
56class QDebug;
57class QTab;
58class QFontMetrics;
59class QStyleHintReturn;
60class QStyleOption;
61class QStyleOptionComplex;
62class QStylePrivate;
63
64class Q_WIDGETS_EXPORT QStyle : public QObject
65{
66 Q_OBJECT
67 Q_DECLARE_PRIVATE(QStyle)
68
69protected:
70 QStyle(QStylePrivate &dd);
71
72public:
73 QStyle();
74 virtual ~QStyle();
75
76 virtual void polish(QWidget *widget);
77 virtual void unpolish(QWidget *widget);
78
79 virtual void polish(QApplication *application);
80 virtual void unpolish(QApplication *application);
81
82 virtual void polish(QPalette &palette);
83
84 virtual QRect itemTextRect(const QFontMetrics &fm, const QRect &r,
85 int flags, bool enabled,
86 const QString &text) const;
87
88 virtual QRect itemPixmapRect(const QRect &r, int flags, const QPixmap &pixmap) const;
89
90 virtual void drawItemText(QPainter *painter, const QRect &rect,
91 int flags, const QPalette &pal, bool enabled,
92 const QString &text, QPalette::ColorRole textRole = QPalette::NoRole) const;
93
94 virtual void drawItemPixmap(QPainter *painter, const QRect &rect,
95 int alignment, const QPixmap &pixmap) const;
96
97 virtual QPalette standardPalette() const;
98
99 enum StateFlag {
100 State_None = 0x00000000,
101 State_Enabled = 0x00000001,
102 State_Raised = 0x00000002,
103 State_Sunken = 0x00000004,
104 State_Off = 0x00000008,
105 State_NoChange = 0x00000010,
106 State_On = 0x00000020,
107 State_DownArrow = 0x00000040,
108 State_Horizontal = 0x00000080,
109 State_HasFocus = 0x00000100,
110 State_Top = 0x00000200,
111 State_Bottom = 0x00000400,
112 State_FocusAtBorder = 0x00000800,
113 State_AutoRaise = 0x00001000,
114 State_MouseOver = 0x00002000,
115 State_UpArrow = 0x00004000,
116 State_Selected = 0x00008000,
117 State_Active = 0x00010000,
118 State_Window = 0x00020000,
119 State_Open = 0x00040000,
120 State_Children = 0x00080000,
121 State_Item = 0x00100000,
122 State_Sibling = 0x00200000,
123 State_Editing = 0x00400000,
124 State_KeyboardFocusChange = 0x00800000,
125#ifdef QT_KEYPAD_NAVIGATION
126 State_HasEditFocus = 0x01000000,
127#endif
128 State_ReadOnly = 0x02000000,
129 State_Small = 0x04000000,
130 State_Mini = 0x08000000
131 };
132 Q_ENUM(StateFlag)
133 Q_DECLARE_FLAGS(State, StateFlag)
134
135
136 enum PrimitiveElement {
137 PE_Frame,
138 PE_FrameDefaultButton,
139 PE_FrameDockWidget,
140 PE_FrameFocusRect,
141 PE_FrameGroupBox,
142 PE_FrameLineEdit,
143 PE_FrameMenu,
144 PE_FrameStatusBarItem,
145#if QT_DEPRECATED_SINCE(5, 13) // ### Qt 6: remove
146 PE_FrameStatusBar Q_DECL_ENUMERATOR_DEPRECATED = PE_FrameStatusBarItem,
147#endif
148 PE_FrameTabWidget,
149 PE_FrameWindow,
150 PE_FrameButtonBevel,
151 PE_FrameButtonTool,
152 PE_FrameTabBarBase,
153
154 PE_PanelButtonCommand,
155 PE_PanelButtonBevel,
156 PE_PanelButtonTool,
157 PE_PanelMenuBar,
158 PE_PanelToolBar,
159 PE_PanelLineEdit,
160
161 PE_IndicatorArrowDown,
162 PE_IndicatorArrowLeft,
163 PE_IndicatorArrowRight,
164 PE_IndicatorArrowUp,
165 PE_IndicatorBranch,
166 PE_IndicatorButtonDropDown,
167 PE_IndicatorItemViewItemCheck,
168#if QT_DEPRECATED_SINCE(5, 13) // ### Qt 6: remove
169 PE_IndicatorViewItemCheck Q_DECL_ENUMERATOR_DEPRECATED = PE_IndicatorItemViewItemCheck,
170#endif
171 PE_IndicatorCheckBox,
172 PE_IndicatorDockWidgetResizeHandle,
173 PE_IndicatorHeaderArrow,
174 PE_IndicatorMenuCheckMark,
175 PE_IndicatorProgressChunk,
176 PE_IndicatorRadioButton,
177 PE_IndicatorSpinDown,
178 PE_IndicatorSpinMinus,
179 PE_IndicatorSpinPlus,
180 PE_IndicatorSpinUp,
181 PE_IndicatorToolBarHandle,
182 PE_IndicatorToolBarSeparator,
183 PE_PanelTipLabel,
184 PE_IndicatorTabTear,
185 PE_IndicatorTabTearLeft = PE_IndicatorTabTear,
186 PE_PanelScrollAreaCorner,
187
188 PE_Widget,
189
190 PE_IndicatorColumnViewArrow,
191 PE_IndicatorItemViewItemDrop,
192
193 PE_PanelItemViewItem,
194 PE_PanelItemViewRow,
195
196 PE_PanelStatusBar,
197
198 PE_IndicatorTabClose,
199 PE_PanelMenu,
200
201 PE_IndicatorTabTearRight,
202
203 // do not add any values below/greater this
204 PE_CustomBase = 0xf000000
205 };
206 Q_ENUM(PrimitiveElement)
207
208 virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p,
209 const QWidget *w = nullptr) const = 0;
210 enum ControlElement {
211 CE_PushButton,
212 CE_PushButtonBevel,
213 CE_PushButtonLabel,
214
215 CE_CheckBox,
216 CE_CheckBoxLabel,
217
218 CE_RadioButton,
219 CE_RadioButtonLabel,
220
221 CE_TabBarTab,
222 CE_TabBarTabShape,
223 CE_TabBarTabLabel,
224
225 CE_ProgressBar,
226 CE_ProgressBarGroove,
227 CE_ProgressBarContents,
228 CE_ProgressBarLabel,
229
230 CE_MenuItem,
231 CE_MenuScroller,
232 CE_MenuVMargin,
233 CE_MenuHMargin,
234 CE_MenuTearoff,
235 CE_MenuEmptyArea,
236
237 CE_MenuBarItem,
238 CE_MenuBarEmptyArea,
239
240 CE_ToolButtonLabel,
241
242 CE_Header,
243 CE_HeaderSection,
244 CE_HeaderLabel,
245
246 CE_ToolBoxTab,
247 CE_SizeGrip,
248 CE_Splitter,
249 CE_RubberBand,
250 CE_DockWidgetTitle,
251
252 CE_ScrollBarAddLine,
253 CE_ScrollBarSubLine,
254 CE_ScrollBarAddPage,
255 CE_ScrollBarSubPage,
256 CE_ScrollBarSlider,
257 CE_ScrollBarFirst,
258 CE_ScrollBarLast,
259
260 CE_FocusFrame,
261 CE_ComboBoxLabel,
262
263 CE_ToolBar,
264 CE_ToolBoxTabShape,
265 CE_ToolBoxTabLabel,
266 CE_HeaderEmptyArea,
267
268 CE_ColumnViewGrip,
269
270 CE_ItemViewItem,
271
272 CE_ShapedFrame,
273
274 // do not add any values below/greater than this
275 CE_CustomBase = 0xf0000000
276 };
277 Q_ENUM(ControlElement)
278
279 virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p,
280 const QWidget *w = nullptr) const = 0;
281
282 enum SubElement {
283 SE_PushButtonContents,
284 SE_PushButtonFocusRect,
285
286 SE_CheckBoxIndicator,
287 SE_CheckBoxContents,
288 SE_CheckBoxFocusRect,
289 SE_CheckBoxClickRect,
290
291 SE_RadioButtonIndicator,
292 SE_RadioButtonContents,
293 SE_RadioButtonFocusRect,
294 SE_RadioButtonClickRect,
295
296 SE_ComboBoxFocusRect,
297
298 SE_SliderFocusRect,
299
300 SE_ProgressBarGroove,
301 SE_ProgressBarContents,
302 SE_ProgressBarLabel,
303
304 SE_ToolBoxTabContents,
305
306 SE_HeaderLabel,
307 SE_HeaderArrow,
308
309 SE_TabWidgetTabBar,
310 SE_TabWidgetTabPane,
311 SE_TabWidgetTabContents,
312 SE_TabWidgetLeftCorner,
313 SE_TabWidgetRightCorner,
314
315 SE_ItemViewItemCheckIndicator,
316#if QT_DEPRECATED_SINCE(5, 13) // ### Qt 6: remove
317 SE_ViewItemCheckIndicator Q_DECL_ENUMERATOR_DEPRECATED = SE_ItemViewItemCheckIndicator,
318#endif
319 SE_TabBarTearIndicator,
320 SE_TabBarTearIndicatorLeft = SE_TabBarTearIndicator,
321
322 SE_TreeViewDisclosureItem,
323
324 SE_LineEditContents,
325 SE_FrameContents,
326
327 SE_DockWidgetCloseButton,
328 SE_DockWidgetFloatButton,
329 SE_DockWidgetTitleBarText,
330 SE_DockWidgetIcon,
331
332 SE_CheckBoxLayoutItem,
333 SE_ComboBoxLayoutItem,
334 SE_DateTimeEditLayoutItem,
335#if QT_DEPRECATED_SINCE(5, 15) // ### Qt 6: remove
336 SE_DialogButtonBoxLayoutItem Q_DECL_ENUMERATOR_DEPRECATED,
337#endif
338 SE_LabelLayoutItem = SE_DateTimeEditLayoutItem + 2,
339 SE_ProgressBarLayoutItem,
340 SE_PushButtonLayoutItem,
341 SE_RadioButtonLayoutItem,
342 SE_SliderLayoutItem,
343 SE_SpinBoxLayoutItem,
344 SE_ToolButtonLayoutItem,
345
346 SE_FrameLayoutItem,
347 SE_GroupBoxLayoutItem,
348 SE_TabWidgetLayoutItem,
349
350 SE_ItemViewItemDecoration,
351 SE_ItemViewItemText,
352 SE_ItemViewItemFocusRect,
353
354 SE_TabBarTabLeftButton,
355 SE_TabBarTabRightButton,
356 SE_TabBarTabText,
357
358 SE_ShapedFrameContents,
359
360 SE_ToolBarHandle,
361
362 SE_TabBarScrollLeftButton,
363 SE_TabBarScrollRightButton,
364 SE_TabBarTearIndicatorRight,
365
366 SE_PushButtonBevel,
367
368 // do not add any values below/greater than this
369 SE_CustomBase = 0xf0000000
370 };
371 Q_ENUM(SubElement)
372
373 virtual QRect subElementRect(SubElement subElement, const QStyleOption *option,
374 const QWidget *widget = nullptr) const = 0;
375
376
377 enum ComplexControl {
378 CC_SpinBox,
379 CC_ComboBox,
380 CC_ScrollBar,
381 CC_Slider,
382 CC_ToolButton,
383 CC_TitleBar,
384 CC_Dial,
385 CC_GroupBox,
386 CC_MdiControls,
387
388 // do not add any values below/greater than this
389 CC_CustomBase = 0xf0000000
390 };
391 Q_ENUM(ComplexControl)
392
393 enum SubControl {
394 SC_None = 0x00000000,
395
396 SC_ScrollBarAddLine = 0x00000001,
397 SC_ScrollBarSubLine = 0x00000002,
398 SC_ScrollBarAddPage = 0x00000004,
399 SC_ScrollBarSubPage = 0x00000008,
400 SC_ScrollBarFirst = 0x00000010,
401 SC_ScrollBarLast = 0x00000020,
402 SC_ScrollBarSlider = 0x00000040,
403 SC_ScrollBarGroove = 0x00000080,
404
405 SC_SpinBoxUp = 0x00000001,
406 SC_SpinBoxDown = 0x00000002,
407 SC_SpinBoxFrame = 0x00000004,
408 SC_SpinBoxEditField = 0x00000008,
409
410 SC_ComboBoxFrame = 0x00000001,
411 SC_ComboBoxEditField = 0x00000002,
412 SC_ComboBoxArrow = 0x00000004,
413 SC_ComboBoxListBoxPopup = 0x00000008,
414
415 SC_SliderGroove = 0x00000001,
416 SC_SliderHandle = 0x00000002,
417 SC_SliderTickmarks = 0x00000004,
418
419 SC_ToolButton = 0x00000001,
420 SC_ToolButtonMenu = 0x00000002,
421
422 SC_TitleBarSysMenu = 0x00000001,
423 SC_TitleBarMinButton = 0x00000002,
424 SC_TitleBarMaxButton = 0x00000004,
425 SC_TitleBarCloseButton = 0x00000008,
426 SC_TitleBarNormalButton = 0x00000010,
427 SC_TitleBarShadeButton = 0x00000020,
428 SC_TitleBarUnshadeButton = 0x00000040,
429 SC_TitleBarContextHelpButton = 0x00000080,
430 SC_TitleBarLabel = 0x00000100,
431
432 SC_DialGroove = 0x00000001,
433 SC_DialHandle = 0x00000002,
434 SC_DialTickmarks = 0x00000004,
435
436 SC_GroupBoxCheckBox = 0x00000001,
437 SC_GroupBoxLabel = 0x00000002,
438 SC_GroupBoxContents = 0x00000004,
439 SC_GroupBoxFrame = 0x00000008,
440
441 SC_MdiMinButton = 0x00000001,
442 SC_MdiNormalButton = 0x00000002,
443 SC_MdiCloseButton = 0x00000004,
444
445 SC_CustomBase = 0xf0000000,
446 SC_All = 0xffffffff
447 };
448 Q_ENUM(SubControl)
449 Q_DECLARE_FLAGS(SubControls, SubControl)
450
451
452 virtual void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,
453 const QWidget *widget = nullptr) const = 0;
454 virtual SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt,
455 const QPoint &pt, const QWidget *widget = nullptr) const = 0;
456 virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
457 SubControl sc, const QWidget *widget = nullptr) const = 0;
458
459 enum PixelMetric {
460 PM_ButtonMargin,
461 PM_ButtonDefaultIndicator,
462 PM_MenuButtonIndicator,
463 PM_ButtonShiftHorizontal,
464 PM_ButtonShiftVertical,
465
466 PM_DefaultFrameWidth,
467 PM_SpinBoxFrameWidth,
468 PM_ComboBoxFrameWidth,
469
470 PM_MaximumDragDistance,
471
472 PM_ScrollBarExtent,
473 PM_ScrollBarSliderMin,
474
475 PM_SliderThickness, // total slider thickness
476 PM_SliderControlThickness, // thickness of the business part
477 PM_SliderLength, // total length of slider
478 PM_SliderTickmarkOffset, //
479 PM_SliderSpaceAvailable, // available space for slider to move
480
481 PM_DockWidgetSeparatorExtent,
482 PM_DockWidgetHandleExtent,
483 PM_DockWidgetFrameWidth,
484
485 PM_TabBarTabOverlap,
486 PM_TabBarTabHSpace,
487 PM_TabBarTabVSpace,
488 PM_TabBarBaseHeight,
489 PM_TabBarBaseOverlap,
490
491 PM_ProgressBarChunkWidth,
492
493 PM_SplitterWidth,
494 PM_TitleBarHeight,
495
496 PM_MenuScrollerHeight,
497 PM_MenuHMargin,
498 PM_MenuVMargin,
499 PM_MenuPanelWidth,
500 PM_MenuTearoffHeight,
501 PM_MenuDesktopFrameWidth,
502
503 PM_MenuBarPanelWidth,
504 PM_MenuBarItemSpacing,
505 PM_MenuBarVMargin,
506 PM_MenuBarHMargin,
507
508 PM_IndicatorWidth,
509 PM_IndicatorHeight,
510 PM_ExclusiveIndicatorWidth,
511 PM_ExclusiveIndicatorHeight,
512
513 PM_DialogButtonsSeparator,
514 PM_DialogButtonsButtonWidth,
515 PM_DialogButtonsButtonHeight,
516
517 PM_MdiSubWindowFrameWidth,
518 PM_MdiSubWindowMinimizedWidth,
519#if QT_DEPRECATED_SINCE(5, 13) // ### Qt 6: remove
520 PM_MDIFrameWidth Q_DECL_ENUMERATOR_DEPRECATED = PM_MdiSubWindowFrameWidth,
521 PM_MDIMinimizedWidth Q_DECL_ENUMERATOR_DEPRECATED = PM_MdiSubWindowMinimizedWidth,
522#endif
523
524 PM_HeaderMargin,
525 PM_HeaderMarkSize,
526 PM_HeaderGripMargin,
527 PM_TabBarTabShiftHorizontal,
528 PM_TabBarTabShiftVertical,
529 PM_TabBarScrollButtonWidth,
530
531 PM_ToolBarFrameWidth,
532 PM_ToolBarHandleExtent,
533 PM_ToolBarItemSpacing,
534 PM_ToolBarItemMargin,
535 PM_ToolBarSeparatorExtent,
536 PM_ToolBarExtensionExtent,
537
538 PM_SpinBoxSliderHeight,
539
540#if QT_DEPRECATED_SINCE(5, 15) // ### Qt 6: remove
541 PM_DefaultTopLevelMargin Q_DECL_ENUMERATOR_DEPRECATED,
542 PM_DefaultChildMargin Q_DECL_ENUMERATOR_DEPRECATED,
543 PM_DefaultLayoutSpacing Q_DECL_ENUMERATOR_DEPRECATED,
544#endif
545
546 PM_ToolBarIconSize = PM_SpinBoxSliderHeight + 4,
547 PM_ListViewIconSize,
548 PM_IconViewIconSize,
549 PM_SmallIconSize,
550 PM_LargeIconSize,
551
552 PM_FocusFrameVMargin,
553 PM_FocusFrameHMargin,
554
555 PM_ToolTipLabelFrameWidth,
556 PM_CheckBoxLabelSpacing,
557 PM_TabBarIconSize,
558 PM_SizeGripSize,
559 PM_DockWidgetTitleMargin,
560 PM_MessageBoxIconSize,
561 PM_ButtonIconSize,
562
563 PM_DockWidgetTitleBarButtonMargin,
564
565 PM_RadioButtonLabelSpacing,
566 PM_LayoutLeftMargin,
567 PM_LayoutTopMargin,
568 PM_LayoutRightMargin,
569 PM_LayoutBottomMargin,
570 PM_LayoutHorizontalSpacing,
571 PM_LayoutVerticalSpacing,
572 PM_TabBar_ScrollButtonOverlap,
573
574 PM_TextCursorWidth,
575
576 PM_TabCloseIndicatorWidth,
577 PM_TabCloseIndicatorHeight,
578
579 PM_ScrollView_ScrollBarSpacing,
580 PM_ScrollView_ScrollBarOverlap,
581 PM_SubMenuOverlap,
582 PM_TreeViewIndentation,
583
584 PM_HeaderDefaultSectionSizeHorizontal,
585 PM_HeaderDefaultSectionSizeVertical,
586
587 PM_TitleBarButtonIconSize,
588 PM_TitleBarButtonSize,
589
590 PM_LineEditIconSize,
591
592 // do not add any values below/greater than this
593 PM_CustomBase = 0xf0000000
594 };
595 Q_ENUM(PixelMetric)
596
597 virtual int pixelMetric(PixelMetric metric, const QStyleOption *option = nullptr,
598 const QWidget *widget = nullptr) const = 0;
599
600 enum ContentsType {
601 CT_PushButton,
602 CT_CheckBox,
603 CT_RadioButton,
604 CT_ToolButton,
605 CT_ComboBox,
606 CT_Splitter,
607 CT_ProgressBar,
608 CT_MenuItem,
609 CT_MenuBarItem,
610 CT_MenuBar,
611 CT_Menu,
612 CT_TabBarTab,
613 CT_Slider,
614 CT_ScrollBar,
615 CT_LineEdit,
616 CT_SpinBox,
617 CT_SizeGrip,
618 CT_TabWidget,
619 CT_DialogButtons,
620 CT_HeaderSection,
621 CT_GroupBox,
622 CT_MdiControls,
623 CT_ItemViewItem,
624 // do not add any values below/greater than this
625 CT_CustomBase = 0xf0000000
626 };
627 Q_ENUM(ContentsType)
628
629 virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt,
630 const QSize &contentsSize, const QWidget *w = nullptr) const = 0;
631
632 enum RequestSoftwareInputPanel {
633 RSIP_OnMouseClickAndAlreadyFocused,
634 RSIP_OnMouseClick
635 };
636 Q_ENUM(RequestSoftwareInputPanel)
637
638 enum StyleHint {
639 SH_EtchDisabledText,
640 SH_DitherDisabledText,
641 SH_ScrollBar_MiddleClickAbsolutePosition,
642 SH_ScrollBar_ScrollWhenPointerLeavesControl,
643 SH_TabBar_SelectMouseType,
644 SH_TabBar_Alignment,
645 SH_Header_ArrowAlignment,
646 SH_Slider_SnapToValue,
647 SH_Slider_SloppyKeyEvents,
648 SH_ProgressDialog_CenterCancelButton,
649 SH_ProgressDialog_TextLabelAlignment,
650 SH_PrintDialog_RightAlignButtons,
651 SH_MainWindow_SpaceBelowMenuBar,
652 SH_FontDialog_SelectAssociatedText,
653 SH_Menu_AllowActiveAndDisabled,
654 SH_Menu_SpaceActivatesItem,
655 SH_Menu_SubMenuPopupDelay,
656 SH_ScrollView_FrameOnlyAroundContents,
657 SH_MenuBar_AltKeyNavigation,
658 SH_ComboBox_ListMouseTracking,
659 SH_Menu_MouseTracking,
660 SH_MenuBar_MouseTracking,
661 SH_ItemView_ChangeHighlightOnFocus,
662 SH_Widget_ShareActivation,
663 SH_Workspace_FillSpaceOnMaximize,
664 SH_ComboBox_Popup,
665 SH_TitleBar_NoBorder,
666 SH_Slider_StopMouseOverSlider,
667#if QT_DEPRECATED_SINCE(5, 13) // ### Qt 6: remove
668 SH_ScrollBar_StopMouseOverSlider Q_DECL_ENUMERATOR_DEPRECATED = SH_Slider_StopMouseOverSlider,
669#endif
670 SH_BlinkCursorWhenTextSelected,
671 SH_RichText_FullWidthSelection,
672 SH_Menu_Scrollable,
673 SH_GroupBox_TextLabelVerticalAlignment,
674 SH_GroupBox_TextLabelColor,
675 SH_Menu_SloppySubMenus,
676 SH_Table_GridLineColor,
677 SH_LineEdit_PasswordCharacter,
678 SH_DialogButtons_DefaultButton,
679 SH_ToolBox_SelectedPageTitleBold,
680 SH_TabBar_PreferNoArrows,
681 SH_ScrollBar_LeftClickAbsolutePosition,
682 SH_ListViewExpand_SelectMouseType,
683 SH_UnderlineShortcut,
684 SH_SpinBox_AnimateButton,
685 SH_SpinBox_KeyPressAutoRepeatRate,
686 SH_SpinBox_ClickAutoRepeatRate,
687 SH_Menu_FillScreenWithScroll,
688 SH_ToolTipLabel_Opacity,
689 SH_DrawMenuBarSeparator,
690 SH_TitleBar_ModifyNotification,
691 SH_Button_FocusPolicy,
692 SH_MessageBox_UseBorderForButtonSpacing,
693 SH_TitleBar_AutoRaise,
694 SH_ToolButton_PopupDelay,
695 SH_FocusFrame_Mask,
696 SH_RubberBand_Mask,
697 SH_WindowFrame_Mask,
698 SH_SpinControls_DisableOnBounds,
699 SH_Dial_BackgroundRole,
700 SH_ComboBox_LayoutDirection,
701 SH_ItemView_EllipsisLocation,
702 SH_ItemView_ShowDecorationSelected,
703 SH_ItemView_ActivateItemOnSingleClick,
704 SH_ScrollBar_ContextMenu,
705 SH_ScrollBar_RollBetweenButtons,
706 SH_Slider_AbsoluteSetButtons,
707 SH_Slider_PageSetButtons,
708 SH_Menu_KeyboardSearch,
709 SH_TabBar_ElideMode,
710 SH_DialogButtonLayout,
711 SH_ComboBox_PopupFrameStyle,
712 SH_MessageBox_TextInteractionFlags,
713 SH_DialogButtonBox_ButtonsHaveIcons,
714 SH_SpellCheckUnderlineStyle,
715 SH_MessageBox_CenterButtons,
716 SH_Menu_SelectionWrap,
717 SH_ItemView_MovementWithoutUpdatingSelection,
718 SH_ToolTip_Mask,
719 SH_FocusFrame_AboveWidget,
720 SH_TextControl_FocusIndicatorTextCharFormat,
721 SH_WizardStyle,
722 SH_ItemView_ArrowKeysNavigateIntoChildren,
723 SH_Menu_Mask,
724 SH_Menu_FlashTriggeredItem,
725 SH_Menu_FadeOutOnHide,
726 SH_SpinBox_ClickAutoRepeatThreshold,
727 SH_ItemView_PaintAlternatingRowColorsForEmptyArea,
728 SH_FormLayoutWrapPolicy,
729 SH_TabWidget_DefaultTabPosition,
730 SH_ToolBar_Movable,
731 SH_FormLayoutFieldGrowthPolicy,
732 SH_FormLayoutFormAlignment,
733 SH_FormLayoutLabelAlignment,
734 SH_ItemView_DrawDelegateFrame,
735 SH_TabBar_CloseButtonPosition,
736 SH_DockWidget_ButtonsHaveFrame,
737 SH_ToolButtonStyle,
738 SH_RequestSoftwareInputPanel,
739 SH_ScrollBar_Transient,
740 SH_Menu_SupportsSections,
741 SH_ToolTip_WakeUpDelay,
742 SH_ToolTip_FallAsleepDelay,
743 SH_Widget_Animate,
744 SH_Splitter_OpaqueResize,
745 // Whether we should use a native popup.
746 // Only supported for non-editable combo boxes on Mac OS X so far.
747 SH_ComboBox_UseNativePopup,
748 SH_LineEdit_PasswordMaskDelay,
749 SH_TabBar_ChangeCurrentDelay,
750 SH_Menu_SubMenuUniDirection,
751 SH_Menu_SubMenuUniDirectionFailCount,
752 SH_Menu_SubMenuSloppySelectOtherActions,
753 SH_Menu_SubMenuSloppyCloseTimeout,
754 SH_Menu_SubMenuResetWhenReenteringParent,
755 SH_Menu_SubMenuDontStartSloppyOnLeave,
756 SH_ItemView_ScrollMode,
757 SH_TitleBar_ShowToolTipsOnButtons,
758 SH_Widget_Animation_Duration,
759 SH_ComboBox_AllowWheelScrolling,
760 SH_SpinBox_ButtonsInsideFrame,
761 SH_SpinBox_StepModifier,
762 // Add new style hint values here
763
764 SH_CustomBase = 0xf0000000
765 };
766 Q_ENUM(StyleHint)
767
768 virtual int styleHint(StyleHint stylehint, const QStyleOption *opt = nullptr,
769 const QWidget *widget = nullptr, QStyleHintReturn* returnData = nullptr) const = 0;
770
771 enum StandardPixmap {
772 SP_TitleBarMenuButton,
773 SP_TitleBarMinButton,
774 SP_TitleBarMaxButton,
775 SP_TitleBarCloseButton,
776 SP_TitleBarNormalButton,
777 SP_TitleBarShadeButton,
778 SP_TitleBarUnshadeButton,
779 SP_TitleBarContextHelpButton,
780 SP_DockWidgetCloseButton,
781 SP_MessageBoxInformation,
782 SP_MessageBoxWarning,
783 SP_MessageBoxCritical,
784 SP_MessageBoxQuestion,
785 SP_DesktopIcon,
786 SP_TrashIcon,
787 SP_ComputerIcon,
788 SP_DriveFDIcon,
789 SP_DriveHDIcon,
790 SP_DriveCDIcon,
791 SP_DriveDVDIcon,
792 SP_DriveNetIcon,
793 SP_DirOpenIcon,
794 SP_DirClosedIcon,
795 SP_DirLinkIcon,
796 SP_DirLinkOpenIcon,
797 SP_FileIcon,
798 SP_FileLinkIcon,
799 SP_ToolBarHorizontalExtensionButton,
800 SP_ToolBarVerticalExtensionButton,
801 SP_FileDialogStart,
802 SP_FileDialogEnd,
803 SP_FileDialogToParent,
804 SP_FileDialogNewFolder,
805 SP_FileDialogDetailedView,
806 SP_FileDialogInfoView,
807 SP_FileDialogContentsView,
808 SP_FileDialogListView,
809 SP_FileDialogBack,
810 SP_DirIcon,
811 SP_DialogOkButton,
812 SP_DialogCancelButton,
813 SP_DialogHelpButton,
814 SP_DialogOpenButton,
815 SP_DialogSaveButton,
816 SP_DialogCloseButton,
817 SP_DialogApplyButton,
818 SP_DialogResetButton,
819 SP_DialogDiscardButton,
820 SP_DialogYesButton,
821 SP_DialogNoButton,
822 SP_ArrowUp,
823 SP_ArrowDown,
824 SP_ArrowLeft,
825 SP_ArrowRight,
826 SP_ArrowBack,
827 SP_ArrowForward,
828 SP_DirHomeIcon,
829 SP_CommandLink,
830 SP_VistaShield,
831 SP_BrowserReload,
832 SP_BrowserStop,
833 SP_MediaPlay,
834 SP_MediaStop,
835 SP_MediaPause,
836 SP_MediaSkipForward,
837 SP_MediaSkipBackward,
838 SP_MediaSeekForward,
839 SP_MediaSeekBackward,
840 SP_MediaVolume,
841 SP_MediaVolumeMuted,
842 SP_LineEditClearButton,
843 SP_DialogYesToAllButton,
844 SP_DialogNoToAllButton,
845 SP_DialogSaveAllButton,
846 SP_DialogAbortButton,
847 SP_DialogRetryButton,
848 SP_DialogIgnoreButton,
849 SP_RestoreDefaultsButton,
850 // do not add any values below/greater than this
851 SP_CustomBase = 0xf0000000
852 };
853 Q_ENUM(StandardPixmap)
854
855 virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt = nullptr,
856 const QWidget *widget = nullptr) const = 0;
857
858 virtual QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr,
859 const QWidget *widget = nullptr) const = 0;
860
861 virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
862 const QStyleOption *opt) const = 0;
863
864 static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect,
865 const QRect &logicalRect);
866 static QPoint visualPos(Qt::LayoutDirection direction, const QRect &boundingRect,
867 const QPoint &logicalPos);
868 static int sliderPositionFromValue(int min, int max, int val, int space,
869 bool upsideDown = false);
870 static int sliderValueFromPosition(int min, int max, int pos, int space,
871 bool upsideDown = false);
872 static Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment);
873 static QRect alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment,
874 const QSize &size, const QRect &rectangle);
875
876 virtual int layoutSpacing(QSizePolicy::ControlType control1,
877 QSizePolicy::ControlType control2, Qt::Orientation orientation,
878 const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const = 0;
879 int combinedLayoutSpacing(QSizePolicy::ControlTypes controls1,
880 QSizePolicy::ControlTypes controls2, Qt::Orientation orientation,
881 QStyleOption *option = nullptr, QWidget *widget = nullptr) const;
882
883 const QStyle * proxy() const;
884
885private:
886 Q_DISABLE_COPY(QStyle)
887 friend class QWidget;
888 friend class QWidgetPrivate;
889 friend class QApplication;
890 friend class QProxyStyle;
891 friend class QProxyStylePrivate;
892 void setProxy(QStyle *style);
893};
894
895Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::State)
896Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::SubControls)
897
898#if !defined(QT_NO_DEBUG_STREAM)
899// ### Qt 6: Remove in favor of template<class T> QDebug operator<<(QDebug, const QFlags<T> &).
900# if QT_VERSION < QT_VERSION_CHECK(6,0,0)
901Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, QStyle::State state);
902# endif
903#endif
904
905QT_END_NAMESPACE
906
907#endif // QSTYLE_H
908