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, // ### Qt 6: remove
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 SE_DialogButtonBoxLayoutItem, // ### Qt 6: remove
336 SE_LabelLayoutItem,
337 SE_ProgressBarLayoutItem,
338 SE_PushButtonLayoutItem,
339 SE_RadioButtonLayoutItem,
340 SE_SliderLayoutItem,
341 SE_SpinBoxLayoutItem,
342 SE_ToolButtonLayoutItem,
343
344 SE_FrameLayoutItem,
345 SE_GroupBoxLayoutItem,
346 SE_TabWidgetLayoutItem,
347
348 SE_ItemViewItemDecoration,
349 SE_ItemViewItemText,
350 SE_ItemViewItemFocusRect,
351
352 SE_TabBarTabLeftButton,
353 SE_TabBarTabRightButton,
354 SE_TabBarTabText,
355
356 SE_ShapedFrameContents,
357
358 SE_ToolBarHandle,
359
360 SE_TabBarScrollLeftButton,
361 SE_TabBarScrollRightButton,
362 SE_TabBarTearIndicatorRight,
363
364 // do not add any values below/greater than this
365 SE_CustomBase = 0xf0000000
366 };
367 Q_ENUM(SubElement)
368
369 virtual QRect subElementRect(SubElement subElement, const QStyleOption *option,
370 const QWidget *widget = nullptr) const = 0;
371
372
373 enum ComplexControl {
374 CC_SpinBox,
375 CC_ComboBox,
376 CC_ScrollBar,
377 CC_Slider,
378 CC_ToolButton,
379 CC_TitleBar,
380 CC_Dial,
381 CC_GroupBox,
382 CC_MdiControls,
383
384 // do not add any values below/greater than this
385 CC_CustomBase = 0xf0000000
386 };
387 Q_ENUM(ComplexControl)
388
389 enum SubControl {
390 SC_None = 0x00000000,
391
392 SC_ScrollBarAddLine = 0x00000001,
393 SC_ScrollBarSubLine = 0x00000002,
394 SC_ScrollBarAddPage = 0x00000004,
395 SC_ScrollBarSubPage = 0x00000008,
396 SC_ScrollBarFirst = 0x00000010,
397 SC_ScrollBarLast = 0x00000020,
398 SC_ScrollBarSlider = 0x00000040,
399 SC_ScrollBarGroove = 0x00000080,
400
401 SC_SpinBoxUp = 0x00000001,
402 SC_SpinBoxDown = 0x00000002,
403 SC_SpinBoxFrame = 0x00000004,
404 SC_SpinBoxEditField = 0x00000008,
405
406 SC_ComboBoxFrame = 0x00000001,
407 SC_ComboBoxEditField = 0x00000002,
408 SC_ComboBoxArrow = 0x00000004,
409 SC_ComboBoxListBoxPopup = 0x00000008,
410
411 SC_SliderGroove = 0x00000001,
412 SC_SliderHandle = 0x00000002,
413 SC_SliderTickmarks = 0x00000004,
414
415 SC_ToolButton = 0x00000001,
416 SC_ToolButtonMenu = 0x00000002,
417
418 SC_TitleBarSysMenu = 0x00000001,
419 SC_TitleBarMinButton = 0x00000002,
420 SC_TitleBarMaxButton = 0x00000004,
421 SC_TitleBarCloseButton = 0x00000008,
422 SC_TitleBarNormalButton = 0x00000010,
423 SC_TitleBarShadeButton = 0x00000020,
424 SC_TitleBarUnshadeButton = 0x00000040,
425 SC_TitleBarContextHelpButton = 0x00000080,
426 SC_TitleBarLabel = 0x00000100,
427
428 SC_DialGroove = 0x00000001,
429 SC_DialHandle = 0x00000002,
430 SC_DialTickmarks = 0x00000004,
431
432 SC_GroupBoxCheckBox = 0x00000001,
433 SC_GroupBoxLabel = 0x00000002,
434 SC_GroupBoxContents = 0x00000004,
435 SC_GroupBoxFrame = 0x00000008,
436
437 SC_MdiMinButton = 0x00000001,
438 SC_MdiNormalButton = 0x00000002,
439 SC_MdiCloseButton = 0x00000004,
440
441 SC_CustomBase = 0xf0000000,
442 SC_All = 0xffffffff
443 };
444 Q_ENUM(SubControl)
445 Q_DECLARE_FLAGS(SubControls, SubControl)
446
447
448 virtual void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,
449 const QWidget *widget = nullptr) const = 0;
450 virtual SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt,
451 const QPoint &pt, const QWidget *widget = nullptr) const = 0;
452 virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
453 SubControl sc, const QWidget *widget = nullptr) const = 0;
454
455 enum PixelMetric {
456 PM_ButtonMargin,
457 PM_ButtonDefaultIndicator,
458 PM_MenuButtonIndicator,
459 PM_ButtonShiftHorizontal,
460 PM_ButtonShiftVertical,
461
462 PM_DefaultFrameWidth,
463 PM_SpinBoxFrameWidth,
464 PM_ComboBoxFrameWidth,
465
466 PM_MaximumDragDistance,
467
468 PM_ScrollBarExtent,
469 PM_ScrollBarSliderMin,
470
471 PM_SliderThickness, // total slider thickness
472 PM_SliderControlThickness, // thickness of the business part
473 PM_SliderLength, // total length of slider
474 PM_SliderTickmarkOffset, //
475 PM_SliderSpaceAvailable, // available space for slider to move
476
477 PM_DockWidgetSeparatorExtent,
478 PM_DockWidgetHandleExtent,
479 PM_DockWidgetFrameWidth,
480
481 PM_TabBarTabOverlap,
482 PM_TabBarTabHSpace,
483 PM_TabBarTabVSpace,
484 PM_TabBarBaseHeight,
485 PM_TabBarBaseOverlap,
486
487 PM_ProgressBarChunkWidth,
488
489 PM_SplitterWidth,
490 PM_TitleBarHeight,
491
492 PM_MenuScrollerHeight,
493 PM_MenuHMargin,
494 PM_MenuVMargin,
495 PM_MenuPanelWidth,
496 PM_MenuTearoffHeight,
497 PM_MenuDesktopFrameWidth,
498
499 PM_MenuBarPanelWidth,
500 PM_MenuBarItemSpacing,
501 PM_MenuBarVMargin,
502 PM_MenuBarHMargin,
503
504 PM_IndicatorWidth,
505 PM_IndicatorHeight,
506 PM_ExclusiveIndicatorWidth,
507 PM_ExclusiveIndicatorHeight,
508
509 PM_DialogButtonsSeparator,
510 PM_DialogButtonsButtonWidth,
511 PM_DialogButtonsButtonHeight,
512
513 PM_MdiSubWindowFrameWidth,
514 PM_MdiSubWindowMinimizedWidth,
515#if QT_DEPRECATED_SINCE(5, 13) // ### Qt 6: remove
516 PM_MDIFrameWidth Q_DECL_ENUMERATOR_DEPRECATED = PM_MdiSubWindowFrameWidth,
517 PM_MDIMinimizedWidth Q_DECL_ENUMERATOR_DEPRECATED = PM_MdiSubWindowMinimizedWidth,
518#endif
519
520 PM_HeaderMargin,
521 PM_HeaderMarkSize,
522 PM_HeaderGripMargin,
523 PM_TabBarTabShiftHorizontal,
524 PM_TabBarTabShiftVertical,
525 PM_TabBarScrollButtonWidth,
526
527 PM_ToolBarFrameWidth,
528 PM_ToolBarHandleExtent,
529 PM_ToolBarItemSpacing,
530 PM_ToolBarItemMargin,
531 PM_ToolBarSeparatorExtent,
532 PM_ToolBarExtensionExtent,
533
534 PM_SpinBoxSliderHeight,
535
536 PM_DefaultTopLevelMargin, // ### Qt 6: remove
537 PM_DefaultChildMargin, // ### Qt 6: remove
538 PM_DefaultLayoutSpacing, // ### Qt 6: remove
539
540 PM_ToolBarIconSize,
541 PM_ListViewIconSize,
542 PM_IconViewIconSize,
543 PM_SmallIconSize,
544 PM_LargeIconSize,
545
546 PM_FocusFrameVMargin,
547 PM_FocusFrameHMargin,
548
549 PM_ToolTipLabelFrameWidth,
550 PM_CheckBoxLabelSpacing,
551 PM_TabBarIconSize,
552 PM_SizeGripSize,
553 PM_DockWidgetTitleMargin,
554 PM_MessageBoxIconSize,
555 PM_ButtonIconSize,
556
557 PM_DockWidgetTitleBarButtonMargin,
558
559 PM_RadioButtonLabelSpacing,
560 PM_LayoutLeftMargin,
561 PM_LayoutTopMargin,
562 PM_LayoutRightMargin,
563 PM_LayoutBottomMargin,
564 PM_LayoutHorizontalSpacing,
565 PM_LayoutVerticalSpacing,
566 PM_TabBar_ScrollButtonOverlap,
567
568 PM_TextCursorWidth,
569
570 PM_TabCloseIndicatorWidth,
571 PM_TabCloseIndicatorHeight,
572
573 PM_ScrollView_ScrollBarSpacing,
574 PM_ScrollView_ScrollBarOverlap,
575 PM_SubMenuOverlap,
576 PM_TreeViewIndentation,
577
578 PM_HeaderDefaultSectionSizeHorizontal,
579 PM_HeaderDefaultSectionSizeVertical,
580
581 PM_TitleBarButtonIconSize,
582 PM_TitleBarButtonSize,
583
584 // do not add any values below/greater than this
585 PM_CustomBase = 0xf0000000
586 };
587 Q_ENUM(PixelMetric)
588
589 virtual int pixelMetric(PixelMetric metric, const QStyleOption *option = nullptr,
590 const QWidget *widget = nullptr) const = 0;
591
592 enum ContentsType {
593 CT_PushButton,
594 CT_CheckBox,
595 CT_RadioButton,
596 CT_ToolButton,
597 CT_ComboBox,
598 CT_Splitter,
599 CT_ProgressBar,
600 CT_MenuItem,
601 CT_MenuBarItem,
602 CT_MenuBar,
603 CT_Menu,
604 CT_TabBarTab,
605 CT_Slider,
606 CT_ScrollBar,
607 CT_LineEdit,
608 CT_SpinBox,
609 CT_SizeGrip,
610 CT_TabWidget,
611 CT_DialogButtons,
612 CT_HeaderSection,
613 CT_GroupBox,
614 CT_MdiControls,
615 CT_ItemViewItem,
616 // do not add any values below/greater than this
617 CT_CustomBase = 0xf0000000
618 };
619 Q_ENUM(ContentsType)
620
621 virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt,
622 const QSize &contentsSize, const QWidget *w = nullptr) const = 0;
623
624 enum RequestSoftwareInputPanel {
625 RSIP_OnMouseClickAndAlreadyFocused,
626 RSIP_OnMouseClick
627 };
628 Q_ENUM(RequestSoftwareInputPanel)
629
630 enum StyleHint {
631 SH_EtchDisabledText,
632 SH_DitherDisabledText,
633 SH_ScrollBar_MiddleClickAbsolutePosition,
634 SH_ScrollBar_ScrollWhenPointerLeavesControl,
635 SH_TabBar_SelectMouseType,
636 SH_TabBar_Alignment,
637 SH_Header_ArrowAlignment,
638 SH_Slider_SnapToValue,
639 SH_Slider_SloppyKeyEvents,
640 SH_ProgressDialog_CenterCancelButton,
641 SH_ProgressDialog_TextLabelAlignment,
642 SH_PrintDialog_RightAlignButtons,
643 SH_MainWindow_SpaceBelowMenuBar,
644 SH_FontDialog_SelectAssociatedText,
645 SH_Menu_AllowActiveAndDisabled,
646 SH_Menu_SpaceActivatesItem,
647 SH_Menu_SubMenuPopupDelay,
648 SH_ScrollView_FrameOnlyAroundContents,
649 SH_MenuBar_AltKeyNavigation,
650 SH_ComboBox_ListMouseTracking,
651 SH_Menu_MouseTracking,
652 SH_MenuBar_MouseTracking,
653 SH_ItemView_ChangeHighlightOnFocus,
654 SH_Widget_ShareActivation,
655 SH_Workspace_FillSpaceOnMaximize,
656 SH_ComboBox_Popup,
657 SH_TitleBar_NoBorder,
658 SH_Slider_StopMouseOverSlider,
659#if QT_DEPRECATED_SINCE(5, 13) // ### Qt 6: remove
660 SH_ScrollBar_StopMouseOverSlider Q_DECL_ENUMERATOR_DEPRECATED = SH_Slider_StopMouseOverSlider,
661#endif
662 SH_BlinkCursorWhenTextSelected,
663 SH_RichText_FullWidthSelection,
664 SH_Menu_Scrollable,
665 SH_GroupBox_TextLabelVerticalAlignment,
666 SH_GroupBox_TextLabelColor,
667 SH_Menu_SloppySubMenus,
668 SH_Table_GridLineColor,
669 SH_LineEdit_PasswordCharacter,
670 SH_DialogButtons_DefaultButton,
671 SH_ToolBox_SelectedPageTitleBold,
672 SH_TabBar_PreferNoArrows,
673 SH_ScrollBar_LeftClickAbsolutePosition,
674 SH_ListViewExpand_SelectMouseType,
675 SH_UnderlineShortcut,
676 SH_SpinBox_AnimateButton,
677 SH_SpinBox_KeyPressAutoRepeatRate,
678 SH_SpinBox_ClickAutoRepeatRate,
679 SH_Menu_FillScreenWithScroll,
680 SH_ToolTipLabel_Opacity,
681 SH_DrawMenuBarSeparator,
682 SH_TitleBar_ModifyNotification,
683 SH_Button_FocusPolicy,
684 SH_MessageBox_UseBorderForButtonSpacing,
685 SH_TitleBar_AutoRaise,
686 SH_ToolButton_PopupDelay,
687 SH_FocusFrame_Mask,
688 SH_RubberBand_Mask,
689 SH_WindowFrame_Mask,
690 SH_SpinControls_DisableOnBounds,
691 SH_Dial_BackgroundRole,
692 SH_ComboBox_LayoutDirection,
693 SH_ItemView_EllipsisLocation,
694 SH_ItemView_ShowDecorationSelected,
695 SH_ItemView_ActivateItemOnSingleClick,
696 SH_ScrollBar_ContextMenu,
697 SH_ScrollBar_RollBetweenButtons,
698 SH_Slider_AbsoluteSetButtons,
699 SH_Slider_PageSetButtons,
700 SH_Menu_KeyboardSearch,
701 SH_TabBar_ElideMode,
702 SH_DialogButtonLayout,
703 SH_ComboBox_PopupFrameStyle,
704 SH_MessageBox_TextInteractionFlags,
705 SH_DialogButtonBox_ButtonsHaveIcons,
706 SH_SpellCheckUnderlineStyle,
707 SH_MessageBox_CenterButtons,
708 SH_Menu_SelectionWrap,
709 SH_ItemView_MovementWithoutUpdatingSelection,
710 SH_ToolTip_Mask,
711 SH_FocusFrame_AboveWidget,
712 SH_TextControl_FocusIndicatorTextCharFormat,
713 SH_WizardStyle,
714 SH_ItemView_ArrowKeysNavigateIntoChildren,
715 SH_Menu_Mask,
716 SH_Menu_FlashTriggeredItem,
717 SH_Menu_FadeOutOnHide,
718 SH_SpinBox_ClickAutoRepeatThreshold,
719 SH_ItemView_PaintAlternatingRowColorsForEmptyArea,
720 SH_FormLayoutWrapPolicy,
721 SH_TabWidget_DefaultTabPosition,
722 SH_ToolBar_Movable,
723 SH_FormLayoutFieldGrowthPolicy,
724 SH_FormLayoutFormAlignment,
725 SH_FormLayoutLabelAlignment,
726 SH_ItemView_DrawDelegateFrame,
727 SH_TabBar_CloseButtonPosition,
728 SH_DockWidget_ButtonsHaveFrame,
729 SH_ToolButtonStyle,
730 SH_RequestSoftwareInputPanel,
731 SH_ScrollBar_Transient,
732 SH_Menu_SupportsSections,
733 SH_ToolTip_WakeUpDelay,
734 SH_ToolTip_FallAsleepDelay,
735 SH_Widget_Animate,
736 SH_Splitter_OpaqueResize,
737 // Whether we should use a native popup.
738 // Only supported for non-editable combo boxes on Mac OS X so far.
739 SH_ComboBox_UseNativePopup,
740 SH_LineEdit_PasswordMaskDelay,
741 SH_TabBar_ChangeCurrentDelay,
742 SH_Menu_SubMenuUniDirection,
743 SH_Menu_SubMenuUniDirectionFailCount,
744 SH_Menu_SubMenuSloppySelectOtherActions,
745 SH_Menu_SubMenuSloppyCloseTimeout,
746 SH_Menu_SubMenuResetWhenReenteringParent,
747 SH_Menu_SubMenuDontStartSloppyOnLeave,
748 SH_ItemView_ScrollMode,
749 SH_TitleBar_ShowToolTipsOnButtons,
750 SH_Widget_Animation_Duration,
751 SH_ComboBox_AllowWheelScrolling,
752 SH_SpinBox_ButtonsInsideFrame,
753 SH_SpinBox_StepModifier,
754 // Add new style hint values here
755
756 SH_CustomBase = 0xf0000000
757 };
758 Q_ENUM(StyleHint)
759
760 virtual int styleHint(StyleHint stylehint, const QStyleOption *opt = nullptr,
761 const QWidget *widget = nullptr, QStyleHintReturn* returnData = nullptr) const = 0;
762
763 enum StandardPixmap {
764 SP_TitleBarMenuButton,
765 SP_TitleBarMinButton,
766 SP_TitleBarMaxButton,
767 SP_TitleBarCloseButton,
768 SP_TitleBarNormalButton,
769 SP_TitleBarShadeButton,
770 SP_TitleBarUnshadeButton,
771 SP_TitleBarContextHelpButton,
772 SP_DockWidgetCloseButton,
773 SP_MessageBoxInformation,
774 SP_MessageBoxWarning,
775 SP_MessageBoxCritical,
776 SP_MessageBoxQuestion,
777 SP_DesktopIcon,
778 SP_TrashIcon,
779 SP_ComputerIcon,
780 SP_DriveFDIcon,
781 SP_DriveHDIcon,
782 SP_DriveCDIcon,
783 SP_DriveDVDIcon,
784 SP_DriveNetIcon,
785 SP_DirOpenIcon,
786 SP_DirClosedIcon,
787 SP_DirLinkIcon,
788 SP_DirLinkOpenIcon,
789 SP_FileIcon,
790 SP_FileLinkIcon,
791 SP_ToolBarHorizontalExtensionButton,
792 SP_ToolBarVerticalExtensionButton,
793 SP_FileDialogStart,
794 SP_FileDialogEnd,
795 SP_FileDialogToParent,
796 SP_FileDialogNewFolder,
797 SP_FileDialogDetailedView,
798 SP_FileDialogInfoView,
799 SP_FileDialogContentsView,
800 SP_FileDialogListView,
801 SP_FileDialogBack,
802 SP_DirIcon,
803 SP_DialogOkButton,
804 SP_DialogCancelButton,
805 SP_DialogHelpButton,
806 SP_DialogOpenButton,
807 SP_DialogSaveButton,
808 SP_DialogCloseButton,
809 SP_DialogApplyButton,
810 SP_DialogResetButton,
811 SP_DialogDiscardButton,
812 SP_DialogYesButton,
813 SP_DialogNoButton,
814 SP_ArrowUp,
815 SP_ArrowDown,
816 SP_ArrowLeft,
817 SP_ArrowRight,
818 SP_ArrowBack,
819 SP_ArrowForward,
820 SP_DirHomeIcon,
821 SP_CommandLink,
822 SP_VistaShield,
823 SP_BrowserReload,
824 SP_BrowserStop,
825 SP_MediaPlay,
826 SP_MediaStop,
827 SP_MediaPause,
828 SP_MediaSkipForward,
829 SP_MediaSkipBackward,
830 SP_MediaSeekForward,
831 SP_MediaSeekBackward,
832 SP_MediaVolume,
833 SP_MediaVolumeMuted,
834 SP_LineEditClearButton,
835 SP_DialogYesToAllButton,
836 SP_DialogNoToAllButton,
837 SP_DialogSaveAllButton,
838 SP_DialogAbortButton,
839 SP_DialogRetryButton,
840 SP_DialogIgnoreButton,
841 SP_RestoreDefaultsButton,
842 // do not add any values below/greater than this
843 SP_CustomBase = 0xf0000000
844 };
845 Q_ENUM(StandardPixmap)
846
847 virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt = nullptr,
848 const QWidget *widget = nullptr) const = 0;
849
850 virtual QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr,
851 const QWidget *widget = nullptr) const = 0;
852
853 virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
854 const QStyleOption *opt) const = 0;
855
856 static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect,
857 const QRect &logicalRect);
858 static QPoint visualPos(Qt::LayoutDirection direction, const QRect &boundingRect,
859 const QPoint &logicalPos);
860 static int sliderPositionFromValue(int min, int max, int val, int space,
861 bool upsideDown = false);
862 static int sliderValueFromPosition(int min, int max, int pos, int space,
863 bool upsideDown = false);
864 static Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment);
865 static QRect alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment,
866 const QSize &size, const QRect &rectangle);
867
868 virtual int layoutSpacing(QSizePolicy::ControlType control1,
869 QSizePolicy::ControlType control2, Qt::Orientation orientation,
870 const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const = 0;
871 int combinedLayoutSpacing(QSizePolicy::ControlTypes controls1,
872 QSizePolicy::ControlTypes controls2, Qt::Orientation orientation,
873 QStyleOption *option = nullptr, QWidget *widget = nullptr) const;
874
875 const QStyle * proxy() const;
876
877private:
878 Q_DISABLE_COPY(QStyle)
879 friend class QWidget;
880 friend class QWidgetPrivate;
881 friend class QApplication;
882 friend class QProxyStyle;
883 friend class QProxyStylePrivate;
884 void setProxy(QStyle *style);
885};
886
887Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::State)
888Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::SubControls)
889
890#if !defined(QT_NO_DEBUG_STREAM)
891// ### Qt 6: Remove in favor of template<class T> QDebug operator<<(QDebug, const QFlags<T> &).
892# if QT_VERSION < QT_VERSION_CHECK(6,0,0)
893Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, QStyle::State state);
894# endif
895#endif
896
897QT_END_NAMESPACE
898
899#endif // QSTYLE_H
900