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_FrameStatusBar, // ### Qt 6: remove
145 PE_FrameStatusBarItem = PE_FrameStatusBar,
146 PE_FrameTabWidget,
147 PE_FrameWindow,
148 PE_FrameButtonBevel,
149 PE_FrameButtonTool,
150 PE_FrameTabBarBase,
151
152 PE_PanelButtonCommand,
153 PE_PanelButtonBevel,
154 PE_PanelButtonTool,
155 PE_PanelMenuBar,
156 PE_PanelToolBar,
157 PE_PanelLineEdit,
158
159 PE_IndicatorArrowDown,
160 PE_IndicatorArrowLeft,
161 PE_IndicatorArrowRight,
162 PE_IndicatorArrowUp,
163 PE_IndicatorBranch,
164 PE_IndicatorButtonDropDown,
165 PE_IndicatorViewItemCheck, // ### Qt 6: remove
166 PE_IndicatorItemViewItemCheck = PE_IndicatorViewItemCheck,
167 PE_IndicatorCheckBox,
168 PE_IndicatorDockWidgetResizeHandle,
169 PE_IndicatorHeaderArrow,
170 PE_IndicatorMenuCheckMark,
171 PE_IndicatorProgressChunk,
172 PE_IndicatorRadioButton,
173 PE_IndicatorSpinDown,
174 PE_IndicatorSpinMinus,
175 PE_IndicatorSpinPlus,
176 PE_IndicatorSpinUp,
177 PE_IndicatorToolBarHandle,
178 PE_IndicatorToolBarSeparator,
179 PE_PanelTipLabel,
180 PE_IndicatorTabTear,
181 PE_IndicatorTabTearLeft = PE_IndicatorTabTear,
182 PE_PanelScrollAreaCorner,
183
184 PE_Widget,
185
186 PE_IndicatorColumnViewArrow,
187 PE_IndicatorItemViewItemDrop,
188
189 PE_PanelItemViewItem,
190 PE_PanelItemViewRow, // ### Qt 6: remove
191
192 PE_PanelStatusBar,
193
194 PE_IndicatorTabClose,
195 PE_PanelMenu,
196
197 PE_IndicatorTabTearRight,
198
199 // do not add any values below/greater this
200 PE_CustomBase = 0xf000000
201 };
202 Q_ENUM(PrimitiveElement)
203
204 virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p,
205 const QWidget *w = nullptr) const = 0;
206 enum ControlElement {
207 CE_PushButton,
208 CE_PushButtonBevel,
209 CE_PushButtonLabel,
210
211 CE_CheckBox,
212 CE_CheckBoxLabel,
213
214 CE_RadioButton,
215 CE_RadioButtonLabel,
216
217 CE_TabBarTab,
218 CE_TabBarTabShape,
219 CE_TabBarTabLabel,
220
221 CE_ProgressBar,
222 CE_ProgressBarGroove,
223 CE_ProgressBarContents,
224 CE_ProgressBarLabel,
225
226 CE_MenuItem,
227 CE_MenuScroller,
228 CE_MenuVMargin,
229 CE_MenuHMargin,
230 CE_MenuTearoff,
231 CE_MenuEmptyArea,
232
233 CE_MenuBarItem,
234 CE_MenuBarEmptyArea,
235
236 CE_ToolButtonLabel,
237
238 CE_Header,
239 CE_HeaderSection,
240 CE_HeaderLabel,
241
242 CE_ToolBoxTab,
243 CE_SizeGrip,
244 CE_Splitter,
245 CE_RubberBand,
246 CE_DockWidgetTitle,
247
248 CE_ScrollBarAddLine,
249 CE_ScrollBarSubLine,
250 CE_ScrollBarAddPage,
251 CE_ScrollBarSubPage,
252 CE_ScrollBarSlider,
253 CE_ScrollBarFirst,
254 CE_ScrollBarLast,
255
256 CE_FocusFrame,
257 CE_ComboBoxLabel,
258
259 CE_ToolBar,
260 CE_ToolBoxTabShape,
261 CE_ToolBoxTabLabel,
262 CE_HeaderEmptyArea,
263
264 CE_ColumnViewGrip,
265
266 CE_ItemViewItem,
267
268 CE_ShapedFrame,
269
270 // do not add any values below/greater than this
271 CE_CustomBase = 0xf0000000
272 };
273 Q_ENUM(ControlElement)
274
275 virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p,
276 const QWidget *w = nullptr) const = 0;
277
278 enum SubElement {
279 SE_PushButtonContents,
280 SE_PushButtonFocusRect,
281
282 SE_CheckBoxIndicator,
283 SE_CheckBoxContents,
284 SE_CheckBoxFocusRect,
285 SE_CheckBoxClickRect,
286
287 SE_RadioButtonIndicator,
288 SE_RadioButtonContents,
289 SE_RadioButtonFocusRect,
290 SE_RadioButtonClickRect,
291
292 SE_ComboBoxFocusRect,
293
294 SE_SliderFocusRect,
295
296 SE_ProgressBarGroove,
297 SE_ProgressBarContents,
298 SE_ProgressBarLabel,
299
300 SE_ToolBoxTabContents,
301
302 SE_HeaderLabel,
303 SE_HeaderArrow,
304
305 SE_TabWidgetTabBar,
306 SE_TabWidgetTabPane,
307 SE_TabWidgetTabContents,
308 SE_TabWidgetLeftCorner,
309 SE_TabWidgetRightCorner,
310
311 SE_ItemViewItemCheckIndicator,
312 SE_ViewItemCheckIndicator = SE_ItemViewItemCheckIndicator, // ### Qt 6: remove
313
314 SE_TabBarTearIndicator,
315 SE_TabBarTearIndicatorLeft = SE_TabBarTearIndicator,
316
317 SE_TreeViewDisclosureItem,
318
319 SE_LineEditContents,
320 SE_FrameContents,
321
322 SE_DockWidgetCloseButton,
323 SE_DockWidgetFloatButton,
324 SE_DockWidgetTitleBarText,
325 SE_DockWidgetIcon,
326
327 SE_CheckBoxLayoutItem,
328 SE_ComboBoxLayoutItem,
329 SE_DateTimeEditLayoutItem,
330 SE_DialogButtonBoxLayoutItem, // ### Qt 6: remove
331 SE_LabelLayoutItem,
332 SE_ProgressBarLayoutItem,
333 SE_PushButtonLayoutItem,
334 SE_RadioButtonLayoutItem,
335 SE_SliderLayoutItem,
336 SE_SpinBoxLayoutItem,
337 SE_ToolButtonLayoutItem,
338
339 SE_FrameLayoutItem,
340 SE_GroupBoxLayoutItem,
341 SE_TabWidgetLayoutItem,
342
343 SE_ItemViewItemDecoration,
344 SE_ItemViewItemText,
345 SE_ItemViewItemFocusRect,
346
347 SE_TabBarTabLeftButton,
348 SE_TabBarTabRightButton,
349 SE_TabBarTabText,
350
351 SE_ShapedFrameContents,
352
353 SE_ToolBarHandle,
354
355 SE_TabBarScrollLeftButton,
356 SE_TabBarScrollRightButton,
357 SE_TabBarTearIndicatorRight,
358
359 // do not add any values below/greater than this
360 SE_CustomBase = 0xf0000000
361 };
362 Q_ENUM(SubElement)
363
364 virtual QRect subElementRect(SubElement subElement, const QStyleOption *option,
365 const QWidget *widget = nullptr) const = 0;
366
367
368 enum ComplexControl {
369 CC_SpinBox,
370 CC_ComboBox,
371 CC_ScrollBar,
372 CC_Slider,
373 CC_ToolButton,
374 CC_TitleBar,
375 CC_Dial,
376 CC_GroupBox,
377 CC_MdiControls,
378
379 // do not add any values below/greater than this
380 CC_CustomBase = 0xf0000000
381 };
382 Q_ENUM(ComplexControl)
383
384 enum SubControl {
385 SC_None = 0x00000000,
386
387 SC_ScrollBarAddLine = 0x00000001,
388 SC_ScrollBarSubLine = 0x00000002,
389 SC_ScrollBarAddPage = 0x00000004,
390 SC_ScrollBarSubPage = 0x00000008,
391 SC_ScrollBarFirst = 0x00000010,
392 SC_ScrollBarLast = 0x00000020,
393 SC_ScrollBarSlider = 0x00000040,
394 SC_ScrollBarGroove = 0x00000080,
395
396 SC_SpinBoxUp = 0x00000001,
397 SC_SpinBoxDown = 0x00000002,
398 SC_SpinBoxFrame = 0x00000004,
399 SC_SpinBoxEditField = 0x00000008,
400
401 SC_ComboBoxFrame = 0x00000001,
402 SC_ComboBoxEditField = 0x00000002,
403 SC_ComboBoxArrow = 0x00000004,
404 SC_ComboBoxListBoxPopup = 0x00000008,
405
406 SC_SliderGroove = 0x00000001,
407 SC_SliderHandle = 0x00000002,
408 SC_SliderTickmarks = 0x00000004,
409
410 SC_ToolButton = 0x00000001,
411 SC_ToolButtonMenu = 0x00000002,
412
413 SC_TitleBarSysMenu = 0x00000001,
414 SC_TitleBarMinButton = 0x00000002,
415 SC_TitleBarMaxButton = 0x00000004,
416 SC_TitleBarCloseButton = 0x00000008,
417 SC_TitleBarNormalButton = 0x00000010,
418 SC_TitleBarShadeButton = 0x00000020,
419 SC_TitleBarUnshadeButton = 0x00000040,
420 SC_TitleBarContextHelpButton = 0x00000080,
421 SC_TitleBarLabel = 0x00000100,
422
423 SC_DialGroove = 0x00000001,
424 SC_DialHandle = 0x00000002,
425 SC_DialTickmarks = 0x00000004,
426
427 SC_GroupBoxCheckBox = 0x00000001,
428 SC_GroupBoxLabel = 0x00000002,
429 SC_GroupBoxContents = 0x00000004,
430 SC_GroupBoxFrame = 0x00000008,
431
432 SC_MdiMinButton = 0x00000001,
433 SC_MdiNormalButton = 0x00000002,
434 SC_MdiCloseButton = 0x00000004,
435
436 SC_CustomBase = 0xf0000000,
437 SC_All = 0xffffffff
438 };
439 Q_ENUM(SubControl)
440 Q_DECLARE_FLAGS(SubControls, SubControl)
441
442
443 virtual void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,
444 const QWidget *widget = nullptr) const = 0;
445 virtual SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt,
446 const QPoint &pt, const QWidget *widget = nullptr) const = 0;
447 virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt,
448 SubControl sc, const QWidget *widget = nullptr) const = 0;
449
450 enum PixelMetric {
451 PM_ButtonMargin,
452 PM_ButtonDefaultIndicator,
453 PM_MenuButtonIndicator,
454 PM_ButtonShiftHorizontal,
455 PM_ButtonShiftVertical,
456
457 PM_DefaultFrameWidth,
458 PM_SpinBoxFrameWidth,
459 PM_ComboBoxFrameWidth,
460
461 PM_MaximumDragDistance,
462
463 PM_ScrollBarExtent,
464 PM_ScrollBarSliderMin,
465
466 PM_SliderThickness, // total slider thickness
467 PM_SliderControlThickness, // thickness of the business part
468 PM_SliderLength, // total length of slider
469 PM_SliderTickmarkOffset, //
470 PM_SliderSpaceAvailable, // available space for slider to move
471
472 PM_DockWidgetSeparatorExtent,
473 PM_DockWidgetHandleExtent,
474 PM_DockWidgetFrameWidth,
475
476 PM_TabBarTabOverlap,
477 PM_TabBarTabHSpace,
478 PM_TabBarTabVSpace,
479 PM_TabBarBaseHeight,
480 PM_TabBarBaseOverlap,
481
482 PM_ProgressBarChunkWidth,
483
484 PM_SplitterWidth,
485 PM_TitleBarHeight,
486
487 PM_MenuScrollerHeight,
488 PM_MenuHMargin,
489 PM_MenuVMargin,
490 PM_MenuPanelWidth,
491 PM_MenuTearoffHeight,
492 PM_MenuDesktopFrameWidth,
493
494 PM_MenuBarPanelWidth,
495 PM_MenuBarItemSpacing,
496 PM_MenuBarVMargin,
497 PM_MenuBarHMargin,
498
499 PM_IndicatorWidth,
500 PM_IndicatorHeight,
501 PM_ExclusiveIndicatorWidth,
502 PM_ExclusiveIndicatorHeight,
503
504 PM_DialogButtonsSeparator,
505 PM_DialogButtonsButtonWidth,
506 PM_DialogButtonsButtonHeight,
507
508 PM_MdiSubWindowFrameWidth,
509 PM_MDIFrameWidth = PM_MdiSubWindowFrameWidth, // ### Qt 6: remove
510 PM_MdiSubWindowMinimizedWidth,
511 PM_MDIMinimizedWidth = PM_MdiSubWindowMinimizedWidth, // ### Qt 6: remove
512
513 PM_HeaderMargin,
514 PM_HeaderMarkSize,
515 PM_HeaderGripMargin,
516 PM_TabBarTabShiftHorizontal,
517 PM_TabBarTabShiftVertical,
518 PM_TabBarScrollButtonWidth,
519
520 PM_ToolBarFrameWidth,
521 PM_ToolBarHandleExtent,
522 PM_ToolBarItemSpacing,
523 PM_ToolBarItemMargin,
524 PM_ToolBarSeparatorExtent,
525 PM_ToolBarExtensionExtent,
526
527 PM_SpinBoxSliderHeight,
528
529 PM_DefaultTopLevelMargin, // ### Qt 6: remove
530 PM_DefaultChildMargin, // ### Qt 6: remove
531 PM_DefaultLayoutSpacing, // ### Qt 6: remove
532
533 PM_ToolBarIconSize,
534 PM_ListViewIconSize,
535 PM_IconViewIconSize,
536 PM_SmallIconSize,
537 PM_LargeIconSize,
538
539 PM_FocusFrameVMargin,
540 PM_FocusFrameHMargin,
541
542 PM_ToolTipLabelFrameWidth,
543 PM_CheckBoxLabelSpacing,
544 PM_TabBarIconSize,
545 PM_SizeGripSize,
546 PM_DockWidgetTitleMargin,
547 PM_MessageBoxIconSize,
548 PM_ButtonIconSize,
549
550 PM_DockWidgetTitleBarButtonMargin,
551
552 PM_RadioButtonLabelSpacing,
553 PM_LayoutLeftMargin,
554 PM_LayoutTopMargin,
555 PM_LayoutRightMargin,
556 PM_LayoutBottomMargin,
557 PM_LayoutHorizontalSpacing,
558 PM_LayoutVerticalSpacing,
559 PM_TabBar_ScrollButtonOverlap,
560
561 PM_TextCursorWidth,
562
563 PM_TabCloseIndicatorWidth,
564 PM_TabCloseIndicatorHeight,
565
566 PM_ScrollView_ScrollBarSpacing,
567 PM_ScrollView_ScrollBarOverlap,
568 PM_SubMenuOverlap,
569 PM_TreeViewIndentation,
570
571 PM_HeaderDefaultSectionSizeHorizontal,
572 PM_HeaderDefaultSectionSizeVertical,
573
574 PM_TitleBarButtonIconSize,
575 PM_TitleBarButtonSize,
576
577 // do not add any values below/greater than this
578 PM_CustomBase = 0xf0000000
579 };
580 Q_ENUM(PixelMetric)
581
582 virtual int pixelMetric(PixelMetric metric, const QStyleOption *option = nullptr,
583 const QWidget *widget = nullptr) const = 0;
584
585 enum ContentsType {
586 CT_PushButton,
587 CT_CheckBox,
588 CT_RadioButton,
589 CT_ToolButton,
590 CT_ComboBox,
591 CT_Splitter,
592 CT_ProgressBar,
593 CT_MenuItem,
594 CT_MenuBarItem,
595 CT_MenuBar,
596 CT_Menu,
597 CT_TabBarTab,
598 CT_Slider,
599 CT_ScrollBar,
600 CT_LineEdit,
601 CT_SpinBox,
602 CT_SizeGrip,
603 CT_TabWidget,
604 CT_DialogButtons,
605 CT_HeaderSection,
606 CT_GroupBox,
607 CT_MdiControls,
608 CT_ItemViewItem,
609 // do not add any values below/greater than this
610 CT_CustomBase = 0xf0000000
611 };
612 Q_ENUM(ContentsType)
613
614 virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt,
615 const QSize &contentsSize, const QWidget *w = nullptr) const = 0;
616
617 enum RequestSoftwareInputPanel {
618 RSIP_OnMouseClickAndAlreadyFocused,
619 RSIP_OnMouseClick
620 };
621 Q_ENUM(RequestSoftwareInputPanel)
622
623 enum StyleHint {
624 SH_EtchDisabledText,
625 SH_DitherDisabledText,
626 SH_ScrollBar_MiddleClickAbsolutePosition,
627 SH_ScrollBar_ScrollWhenPointerLeavesControl,
628 SH_TabBar_SelectMouseType,
629 SH_TabBar_Alignment,
630 SH_Header_ArrowAlignment,
631 SH_Slider_SnapToValue,
632 SH_Slider_SloppyKeyEvents,
633 SH_ProgressDialog_CenterCancelButton,
634 SH_ProgressDialog_TextLabelAlignment,
635 SH_PrintDialog_RightAlignButtons,
636 SH_MainWindow_SpaceBelowMenuBar,
637 SH_FontDialog_SelectAssociatedText,
638 SH_Menu_AllowActiveAndDisabled,
639 SH_Menu_SpaceActivatesItem,
640 SH_Menu_SubMenuPopupDelay,
641 SH_ScrollView_FrameOnlyAroundContents,
642 SH_MenuBar_AltKeyNavigation,
643 SH_ComboBox_ListMouseTracking,
644 SH_Menu_MouseTracking,
645 SH_MenuBar_MouseTracking,
646 SH_ItemView_ChangeHighlightOnFocus,
647 SH_Widget_ShareActivation,
648 SH_Workspace_FillSpaceOnMaximize,
649 SH_ComboBox_Popup,
650 SH_TitleBar_NoBorder,
651 SH_Slider_StopMouseOverSlider,
652 SH_ScrollBar_StopMouseOverSlider = SH_Slider_StopMouseOverSlider, // ### Qt 6: remove
653 SH_BlinkCursorWhenTextSelected,
654 SH_RichText_FullWidthSelection,
655 SH_Menu_Scrollable,
656 SH_GroupBox_TextLabelVerticalAlignment,
657 SH_GroupBox_TextLabelColor,
658 SH_Menu_SloppySubMenus,
659 SH_Table_GridLineColor,
660 SH_LineEdit_PasswordCharacter,
661 SH_DialogButtons_DefaultButton,
662 SH_ToolBox_SelectedPageTitleBold,
663 SH_TabBar_PreferNoArrows,
664 SH_ScrollBar_LeftClickAbsolutePosition,
665 SH_ListViewExpand_SelectMouseType,
666 SH_UnderlineShortcut,
667 SH_SpinBox_AnimateButton,
668 SH_SpinBox_KeyPressAutoRepeatRate,
669 SH_SpinBox_ClickAutoRepeatRate,
670 SH_Menu_FillScreenWithScroll,
671 SH_ToolTipLabel_Opacity,
672 SH_DrawMenuBarSeparator,
673 SH_TitleBar_ModifyNotification,
674 SH_Button_FocusPolicy,
675 SH_MessageBox_UseBorderForButtonSpacing,
676 SH_TitleBar_AutoRaise,
677 SH_ToolButton_PopupDelay,
678 SH_FocusFrame_Mask,
679 SH_RubberBand_Mask,
680 SH_WindowFrame_Mask,
681 SH_SpinControls_DisableOnBounds,
682 SH_Dial_BackgroundRole,
683 SH_ComboBox_LayoutDirection,
684 SH_ItemView_EllipsisLocation,
685 SH_ItemView_ShowDecorationSelected,
686 SH_ItemView_ActivateItemOnSingleClick,
687 SH_ScrollBar_ContextMenu,
688 SH_ScrollBar_RollBetweenButtons,
689 SH_Slider_AbsoluteSetButtons,
690 SH_Slider_PageSetButtons,
691 SH_Menu_KeyboardSearch,
692 SH_TabBar_ElideMode,
693 SH_DialogButtonLayout,
694 SH_ComboBox_PopupFrameStyle,
695 SH_MessageBox_TextInteractionFlags,
696 SH_DialogButtonBox_ButtonsHaveIcons,
697 SH_SpellCheckUnderlineStyle,
698 SH_MessageBox_CenterButtons,
699 SH_Menu_SelectionWrap,
700 SH_ItemView_MovementWithoutUpdatingSelection,
701 SH_ToolTip_Mask,
702 SH_FocusFrame_AboveWidget,
703 SH_TextControl_FocusIndicatorTextCharFormat,
704 SH_WizardStyle,
705 SH_ItemView_ArrowKeysNavigateIntoChildren,
706 SH_Menu_Mask,
707 SH_Menu_FlashTriggeredItem,
708 SH_Menu_FadeOutOnHide,
709 SH_SpinBox_ClickAutoRepeatThreshold,
710 SH_ItemView_PaintAlternatingRowColorsForEmptyArea,
711 SH_FormLayoutWrapPolicy,
712 SH_TabWidget_DefaultTabPosition,
713 SH_ToolBar_Movable,
714 SH_FormLayoutFieldGrowthPolicy,
715 SH_FormLayoutFormAlignment,
716 SH_FormLayoutLabelAlignment,
717 SH_ItemView_DrawDelegateFrame,
718 SH_TabBar_CloseButtonPosition,
719 SH_DockWidget_ButtonsHaveFrame,
720 SH_ToolButtonStyle,
721 SH_RequestSoftwareInputPanel,
722 SH_ScrollBar_Transient,
723 SH_Menu_SupportsSections,
724 SH_ToolTip_WakeUpDelay,
725 SH_ToolTip_FallAsleepDelay,
726 SH_Widget_Animate,
727 SH_Splitter_OpaqueResize,
728 // Whether we should use a native popup.
729 // Only supported for non-editable combo boxes on Mac OS X so far.
730 SH_ComboBox_UseNativePopup,
731 SH_LineEdit_PasswordMaskDelay,
732 SH_TabBar_ChangeCurrentDelay,
733 SH_Menu_SubMenuUniDirection,
734 SH_Menu_SubMenuUniDirectionFailCount,
735 SH_Menu_SubMenuSloppySelectOtherActions,
736 SH_Menu_SubMenuSloppyCloseTimeout,
737 SH_Menu_SubMenuResetWhenReenteringParent,
738 SH_Menu_SubMenuDontStartSloppyOnLeave,
739 SH_ItemView_ScrollMode,
740 SH_TitleBar_ShowToolTipsOnButtons,
741 SH_Widget_Animation_Duration,
742 SH_ComboBox_AllowWheelScrolling,
743 SH_SpinBox_ButtonsInsideFrame,
744 SH_SpinBox_StepModifier,
745 // Add new style hint values here
746
747 SH_CustomBase = 0xf0000000
748 };
749 Q_ENUM(StyleHint)
750
751 virtual int styleHint(StyleHint stylehint, const QStyleOption *opt = nullptr,
752 const QWidget *widget = nullptr, QStyleHintReturn* returnData = nullptr) const = 0;
753
754 enum StandardPixmap {
755 SP_TitleBarMenuButton,
756 SP_TitleBarMinButton,
757 SP_TitleBarMaxButton,
758 SP_TitleBarCloseButton,
759 SP_TitleBarNormalButton,
760 SP_TitleBarShadeButton,
761 SP_TitleBarUnshadeButton,
762 SP_TitleBarContextHelpButton,
763 SP_DockWidgetCloseButton,
764 SP_MessageBoxInformation,
765 SP_MessageBoxWarning,
766 SP_MessageBoxCritical,
767 SP_MessageBoxQuestion,
768 SP_DesktopIcon,
769 SP_TrashIcon,
770 SP_ComputerIcon,
771 SP_DriveFDIcon,
772 SP_DriveHDIcon,
773 SP_DriveCDIcon,
774 SP_DriveDVDIcon,
775 SP_DriveNetIcon,
776 SP_DirOpenIcon,
777 SP_DirClosedIcon,
778 SP_DirLinkIcon,
779 SP_DirLinkOpenIcon,
780 SP_FileIcon,
781 SP_FileLinkIcon,
782 SP_ToolBarHorizontalExtensionButton,
783 SP_ToolBarVerticalExtensionButton,
784 SP_FileDialogStart,
785 SP_FileDialogEnd,
786 SP_FileDialogToParent,
787 SP_FileDialogNewFolder,
788 SP_FileDialogDetailedView,
789 SP_FileDialogInfoView,
790 SP_FileDialogContentsView,
791 SP_FileDialogListView,
792 SP_FileDialogBack,
793 SP_DirIcon,
794 SP_DialogOkButton,
795 SP_DialogCancelButton,
796 SP_DialogHelpButton,
797 SP_DialogOpenButton,
798 SP_DialogSaveButton,
799 SP_DialogCloseButton,
800 SP_DialogApplyButton,
801 SP_DialogResetButton,
802 SP_DialogDiscardButton,
803 SP_DialogYesButton,
804 SP_DialogNoButton,
805 SP_ArrowUp,
806 SP_ArrowDown,
807 SP_ArrowLeft,
808 SP_ArrowRight,
809 SP_ArrowBack,
810 SP_ArrowForward,
811 SP_DirHomeIcon,
812 SP_CommandLink,
813 SP_VistaShield,
814 SP_BrowserReload,
815 SP_BrowserStop,
816 SP_MediaPlay,
817 SP_MediaStop,
818 SP_MediaPause,
819 SP_MediaSkipForward,
820 SP_MediaSkipBackward,
821 SP_MediaSeekForward,
822 SP_MediaSeekBackward,
823 SP_MediaVolume,
824 SP_MediaVolumeMuted,
825 SP_LineEditClearButton,
826 // do not add any values below/greater than this
827 SP_CustomBase = 0xf0000000
828 };
829 Q_ENUM(StandardPixmap)
830
831 virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt = nullptr,
832 const QWidget *widget = nullptr) const = 0;
833
834 virtual QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr,
835 const QWidget *widget = nullptr) const = 0;
836
837 virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
838 const QStyleOption *opt) const = 0;
839
840 static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect,
841 const QRect &logicalRect);
842 static QPoint visualPos(Qt::LayoutDirection direction, const QRect &boundingRect,
843 const QPoint &logicalPos);
844 static int sliderPositionFromValue(int min, int max, int val, int space,
845 bool upsideDown = false);
846 static int sliderValueFromPosition(int min, int max, int pos, int space,
847 bool upsideDown = false);
848 static Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment);
849 static QRect alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment,
850 const QSize &size, const QRect &rectangle);
851
852 virtual int layoutSpacing(QSizePolicy::ControlType control1,
853 QSizePolicy::ControlType control2, Qt::Orientation orientation,
854 const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const = 0;
855 int combinedLayoutSpacing(QSizePolicy::ControlTypes controls1,
856 QSizePolicy::ControlTypes controls2, Qt::Orientation orientation,
857 QStyleOption *option = nullptr, QWidget *widget = nullptr) const;
858
859 const QStyle * proxy() const;
860
861private:
862 Q_DISABLE_COPY(QStyle)
863 friend class QWidget;
864 friend class QWidgetPrivate;
865 friend class QApplication;
866 friend class QProxyStyle;
867 friend class QProxyStylePrivate;
868 void setProxy(QStyle *style);
869};
870
871Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::State)
872Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::SubControls)
873
874#if !defined(QT_NO_DEBUG_STREAM)
875// ### Qt 6: Remove in favor of template<class T> QDebug operator<<(QDebug, const QFlags<T> &).
876# if QT_VERSION < QT_VERSION_CHECK(6,0,0)
877Q_WIDGETS_EXPORT QDebug operator<<(QDebug debug, QStyle::State state);
878# endif
879#endif
880
881QT_END_NAMESPACE
882
883#endif // QSTYLE_H
884