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

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