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 // do not add any values below/greater than this
591 PM_CustomBase = 0xf0000000
592 };
593 Q_ENUM(PixelMetric)
594
595 virtual int pixelMetric(PixelMetric metric, const QStyleOption *option = nullptr,
596 const QWidget *widget = nullptr) const = 0;
597
598 enum ContentsType {
599 CT_PushButton,
600 CT_CheckBox,
601 CT_RadioButton,
602 CT_ToolButton,
603 CT_ComboBox,
604 CT_Splitter,
605 CT_ProgressBar,
606 CT_MenuItem,
607 CT_MenuBarItem,
608 CT_MenuBar,
609 CT_Menu,
610 CT_TabBarTab,
611 CT_Slider,
612 CT_ScrollBar,
613 CT_LineEdit,
614 CT_SpinBox,
615 CT_SizeGrip,
616 CT_TabWidget,
617 CT_DialogButtons,
618 CT_HeaderSection,
619 CT_GroupBox,
620 CT_MdiControls,
621 CT_ItemViewItem,
622 // do not add any values below/greater than this
623 CT_CustomBase = 0xf0000000
624 };
625 Q_ENUM(ContentsType)
626
627 virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt,
628 const QSize &contentsSize, const QWidget *w = nullptr) const = 0;
629
630 enum RequestSoftwareInputPanel {
631 RSIP_OnMouseClickAndAlreadyFocused,
632 RSIP_OnMouseClick
633 };
634 Q_ENUM(RequestSoftwareInputPanel)
635
636 enum StyleHint {
637 SH_EtchDisabledText,
638 SH_DitherDisabledText,
639 SH_ScrollBar_MiddleClickAbsolutePosition,
640 SH_ScrollBar_ScrollWhenPointerLeavesControl,
641 SH_TabBar_SelectMouseType,
642 SH_TabBar_Alignment,
643 SH_Header_ArrowAlignment,
644 SH_Slider_SnapToValue,
645 SH_Slider_SloppyKeyEvents,
646 SH_ProgressDialog_CenterCancelButton,
647 SH_ProgressDialog_TextLabelAlignment,
648 SH_PrintDialog_RightAlignButtons,
649 SH_MainWindow_SpaceBelowMenuBar,
650 SH_FontDialog_SelectAssociatedText,
651 SH_Menu_AllowActiveAndDisabled,
652 SH_Menu_SpaceActivatesItem,
653 SH_Menu_SubMenuPopupDelay,
654 SH_ScrollView_FrameOnlyAroundContents,
655 SH_MenuBar_AltKeyNavigation,
656 SH_ComboBox_ListMouseTracking,
657 SH_Menu_MouseTracking,
658 SH_MenuBar_MouseTracking,
659 SH_ItemView_ChangeHighlightOnFocus,
660 SH_Widget_ShareActivation,
661 SH_Workspace_FillSpaceOnMaximize,
662 SH_ComboBox_Popup,
663 SH_TitleBar_NoBorder,
664 SH_Slider_StopMouseOverSlider,
665#if QT_DEPRECATED_SINCE(5, 13) // ### Qt 6: remove
666 SH_ScrollBar_StopMouseOverSlider Q_DECL_ENUMERATOR_DEPRECATED = SH_Slider_StopMouseOverSlider,
667#endif
668 SH_BlinkCursorWhenTextSelected,
669 SH_RichText_FullWidthSelection,
670 SH_Menu_Scrollable,
671 SH_GroupBox_TextLabelVerticalAlignment,
672 SH_GroupBox_TextLabelColor,
673 SH_Menu_SloppySubMenus,
674 SH_Table_GridLineColor,
675 SH_LineEdit_PasswordCharacter,
676 SH_DialogButtons_DefaultButton,
677 SH_ToolBox_SelectedPageTitleBold,
678 SH_TabBar_PreferNoArrows,
679 SH_ScrollBar_LeftClickAbsolutePosition,
680 SH_ListViewExpand_SelectMouseType,
681 SH_UnderlineShortcut,
682 SH_SpinBox_AnimateButton,
683 SH_SpinBox_KeyPressAutoRepeatRate,
684 SH_SpinBox_ClickAutoRepeatRate,
685 SH_Menu_FillScreenWithScroll,
686 SH_ToolTipLabel_Opacity,
687 SH_DrawMenuBarSeparator,
688 SH_TitleBar_ModifyNotification,
689 SH_Button_FocusPolicy,
690 SH_MessageBox_UseBorderForButtonSpacing,
691 SH_TitleBar_AutoRaise,
692 SH_ToolButton_PopupDelay,
693 SH_FocusFrame_Mask,
694 SH_RubberBand_Mask,
695 SH_WindowFrame_Mask,
696 SH_SpinControls_DisableOnBounds,
697 SH_Dial_BackgroundRole,
698 SH_ComboBox_LayoutDirection,
699 SH_ItemView_EllipsisLocation,
700 SH_ItemView_ShowDecorationSelected,
701 SH_ItemView_ActivateItemOnSingleClick,
702 SH_ScrollBar_ContextMenu,
703 SH_ScrollBar_RollBetweenButtons,
704 SH_Slider_AbsoluteSetButtons,
705 SH_Slider_PageSetButtons,
706 SH_Menu_KeyboardSearch,
707 SH_TabBar_ElideMode,
708 SH_DialogButtonLayout,
709 SH_ComboBox_PopupFrameStyle,
710 SH_MessageBox_TextInteractionFlags,
711 SH_DialogButtonBox_ButtonsHaveIcons,
712 SH_SpellCheckUnderlineStyle,
713 SH_MessageBox_CenterButtons,
714 SH_Menu_SelectionWrap,
715 SH_ItemView_MovementWithoutUpdatingSelection,
716 SH_ToolTip_Mask,
717 SH_FocusFrame_AboveWidget,
718 SH_TextControl_FocusIndicatorTextCharFormat,
719 SH_WizardStyle,
720 SH_ItemView_ArrowKeysNavigateIntoChildren,
721 SH_Menu_Mask,
722 SH_Menu_FlashTriggeredItem,
723 SH_Menu_FadeOutOnHide,
724 SH_SpinBox_ClickAutoRepeatThreshold,
725 SH_ItemView_PaintAlternatingRowColorsForEmptyArea,
726 SH_FormLayoutWrapPolicy,
727 SH_TabWidget_DefaultTabPosition,
728 SH_ToolBar_Movable,
729 SH_FormLayoutFieldGrowthPolicy,
730 SH_FormLayoutFormAlignment,
731 SH_FormLayoutLabelAlignment,
732 SH_ItemView_DrawDelegateFrame,
733 SH_TabBar_CloseButtonPosition,
734 SH_DockWidget_ButtonsHaveFrame,
735 SH_ToolButtonStyle,
736 SH_RequestSoftwareInputPanel,
737 SH_ScrollBar_Transient,
738 SH_Menu_SupportsSections,
739 SH_ToolTip_WakeUpDelay,
740 SH_ToolTip_FallAsleepDelay,
741 SH_Widget_Animate,
742 SH_Splitter_OpaqueResize,
743 // Whether we should use a native popup.
744 // Only supported for non-editable combo boxes on Mac OS X so far.
745 SH_ComboBox_UseNativePopup,
746 SH_LineEdit_PasswordMaskDelay,
747 SH_TabBar_ChangeCurrentDelay,
748 SH_Menu_SubMenuUniDirection,
749 SH_Menu_SubMenuUniDirectionFailCount,
750 SH_Menu_SubMenuSloppySelectOtherActions,
751 SH_Menu_SubMenuSloppyCloseTimeout,
752 SH_Menu_SubMenuResetWhenReenteringParent,
753 SH_Menu_SubMenuDontStartSloppyOnLeave,
754 SH_ItemView_ScrollMode,
755 SH_TitleBar_ShowToolTipsOnButtons,
756 SH_Widget_Animation_Duration,
757 SH_ComboBox_AllowWheelScrolling,
758 SH_SpinBox_ButtonsInsideFrame,
759 SH_SpinBox_StepModifier,
760 // Add new style hint values here
761
762 SH_CustomBase = 0xf0000000
763 };
764 Q_ENUM(StyleHint)
765
766 virtual int styleHint(StyleHint stylehint, const QStyleOption *opt = nullptr,
767 const QWidget *widget = nullptr, QStyleHintReturn* returnData = nullptr) const = 0;
768
769 enum StandardPixmap {
770 SP_TitleBarMenuButton,
771 SP_TitleBarMinButton,
772 SP_TitleBarMaxButton,
773 SP_TitleBarCloseButton,
774 SP_TitleBarNormalButton,
775 SP_TitleBarShadeButton,
776 SP_TitleBarUnshadeButton,
777 SP_TitleBarContextHelpButton,
778 SP_DockWidgetCloseButton,
779 SP_MessageBoxInformation,
780 SP_MessageBoxWarning,
781 SP_MessageBoxCritical,
782 SP_MessageBoxQuestion,
783 SP_DesktopIcon,
784 SP_TrashIcon,
785 SP_ComputerIcon,
786 SP_DriveFDIcon,
787 SP_DriveHDIcon,
788 SP_DriveCDIcon,
789 SP_DriveDVDIcon,
790 SP_DriveNetIcon,
791 SP_DirOpenIcon,
792 SP_DirClosedIcon,
793 SP_DirLinkIcon,
794 SP_DirLinkOpenIcon,
795 SP_FileIcon,
796 SP_FileLinkIcon,
797 SP_ToolBarHorizontalExtensionButton,
798 SP_ToolBarVerticalExtensionButton,
799 SP_FileDialogStart,
800 SP_FileDialogEnd,
801 SP_FileDialogToParent,
802 SP_FileDialogNewFolder,
803 SP_FileDialogDetailedView,
804 SP_FileDialogInfoView,
805 SP_FileDialogContentsView,
806 SP_FileDialogListView,
807 SP_FileDialogBack,
808 SP_DirIcon,
809 SP_DialogOkButton,
810 SP_DialogCancelButton,
811 SP_DialogHelpButton,
812 SP_DialogOpenButton,
813 SP_DialogSaveButton,
814 SP_DialogCloseButton,
815 SP_DialogApplyButton,
816 SP_DialogResetButton,
817 SP_DialogDiscardButton,
818 SP_DialogYesButton,
819 SP_DialogNoButton,
820 SP_ArrowUp,
821 SP_ArrowDown,
822 SP_ArrowLeft,
823 SP_ArrowRight,
824 SP_ArrowBack,
825 SP_ArrowForward,
826 SP_DirHomeIcon,
827 SP_CommandLink,
828 SP_VistaShield,
829 SP_BrowserReload,
830 SP_BrowserStop,
831 SP_MediaPlay,
832 SP_MediaStop,
833 SP_MediaPause,
834 SP_MediaSkipForward,
835 SP_MediaSkipBackward,
836 SP_MediaSeekForward,
837 SP_MediaSeekBackward,
838 SP_MediaVolume,
839 SP_MediaVolumeMuted,
840 SP_LineEditClearButton,
841 SP_DialogYesToAllButton,
842 SP_DialogNoToAllButton,
843 SP_DialogSaveAllButton,
844 SP_DialogAbortButton,
845 SP_DialogRetryButton,
846 SP_DialogIgnoreButton,
847 SP_RestoreDefaultsButton,
848 // do not add any values below/greater than this
849 SP_CustomBase = 0xf0000000
850 };
851 Q_ENUM(StandardPixmap)
852
853 virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt = nullptr,
854 const QWidget *widget = nullptr) const = 0;
855
856 virtual QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr,
857 const QWidget *widget = nullptr) const = 0;
858
859 virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
860 const QStyleOption *opt) const = 0;
861
862 static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect,
863 const QRect &logicalRect);
864 static QPoint visualPos(Qt::LayoutDirection direction, const QRect &boundingRect,
865 const QPoint &logicalPos);
866 static int sliderPositionFromValue(int min, int max, int val, int space,
867 bool upsideDown = false);
868 static int sliderValueFromPosition(int min, int max, int pos, int space,
869 bool upsideDown = false);
870 static Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment);
871 static QRect alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment,
872 const QSize &size, const QRect &rectangle);
873
874 virtual int layoutSpacing(QSizePolicy::ControlType control1,
875 QSizePolicy::ControlType control2, Qt::Orientation orientation,
876 const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const = 0;
877 int combinedLayoutSpacing(QSizePolicy::ControlTypes controls1,
878 QSizePolicy::ControlTypes controls2, Qt::Orientation orientation,
879 QStyleOption *option = nullptr, QWidget *widget = nullptr) const;
880
881 const QStyle * proxy() const;
882
883private:
884 Q_DISABLE_COPY(QStyle)
885 friend class QWidget;
886 friend class QWidgetPrivate;
887 friend class QApplication;
888 friend class QProxyStyle;
889 friend class QProxyStylePrivate;
890 void setProxy(QStyle *style);
891};
892
893Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::State)
894Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::SubControls)
895
896#if !defined(QT_NO_DEBUG_STREAM)
897// ### Qt 6: Remove in favor of template<class T> QDebug operator<<(QDebug, const QFlags<T> &).
898# if QT_VERSION < QT_VERSION_CHECK(6,0,0)
899Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, QStyle::State state);
900# endif
901#endif
902
903QT_END_NAMESPACE
904
905#endif // QSTYLE_H
906

source code of qtbase/src/widgets/styles/qstyle.h