Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qstyle.h
Go to the documentation of this file.
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
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#if QT_DEPRECATED_SINCE(6, 8)
468 PM_DialogButtonsSeparator Q_DECL_ENUMERATOR_DEPRECATED_X("Not used and no effect since Qt 4"),
469 PM_DialogButtonsButtonWidth Q_DECL_ENUMERATOR_DEPRECATED_X("Not used and no effect since Qt 4"),
470 PM_DialogButtonsButtonHeight Q_DECL_ENUMERATOR_DEPRECATED_X("Not used and no effect since Qt 4"),
471#endif
472
473 PM_MdiSubWindowFrameWidth = 44,
474 PM_MdiSubWindowMinimizedWidth,
475
476 PM_HeaderMargin,
477 PM_HeaderMarkSize,
478 PM_HeaderGripMargin,
479 PM_TabBarTabShiftHorizontal,
480 PM_TabBarTabShiftVertical,
481 PM_TabBarScrollButtonWidth,
482
483 PM_ToolBarFrameWidth,
484 PM_ToolBarHandleExtent,
485 PM_ToolBarItemSpacing,
486 PM_ToolBarItemMargin,
487 PM_ToolBarSeparatorExtent,
488 PM_ToolBarExtensionExtent,
489
490 PM_SpinBoxSliderHeight,
491
492 PM_ToolBarIconSize,
493 PM_ListViewIconSize,
494 PM_IconViewIconSize,
495 PM_SmallIconSize,
496 PM_LargeIconSize,
497
498 PM_FocusFrameVMargin,
499 PM_FocusFrameHMargin,
500
501 PM_ToolTipLabelFrameWidth,
502 PM_CheckBoxLabelSpacing,
503 PM_TabBarIconSize,
504 PM_SizeGripSize,
505 PM_DockWidgetTitleMargin,
506 PM_MessageBoxIconSize,
507 PM_ButtonIconSize,
508
509 PM_DockWidgetTitleBarButtonMargin,
510
511 PM_RadioButtonLabelSpacing,
512 PM_LayoutLeftMargin,
513 PM_LayoutTopMargin,
514 PM_LayoutRightMargin,
515 PM_LayoutBottomMargin,
516 PM_LayoutHorizontalSpacing,
517 PM_LayoutVerticalSpacing,
518 PM_TabBar_ScrollButtonOverlap,
519
520 PM_TextCursorWidth,
521
522 PM_TabCloseIndicatorWidth,
523 PM_TabCloseIndicatorHeight,
524
525 PM_ScrollView_ScrollBarSpacing,
526 PM_ScrollView_ScrollBarOverlap,
527 PM_SubMenuOverlap,
528 PM_TreeViewIndentation,
529
530 PM_HeaderDefaultSectionSizeHorizontal,
531 PM_HeaderDefaultSectionSizeVertical,
532
533 PM_TitleBarButtonIconSize,
534 PM_TitleBarButtonSize,
535
536 PM_LineEditIconSize,
537 PM_LineEditIconMargin,
538 // do not add any values below/greater than this
539 PM_CustomBase = 0xf0000000
540 };
541 Q_ENUM(PixelMetric)
542
543 virtual int pixelMetric(PixelMetric metric, const QStyleOption *option = nullptr,
544 const QWidget *widget = nullptr) const = 0;
545
546 enum ContentsType {
547 CT_PushButton,
548 CT_CheckBox,
549 CT_RadioButton,
550 CT_ToolButton,
551 CT_ComboBox,
552 CT_Splitter,
553 CT_ProgressBar,
554 CT_MenuItem,
555 CT_MenuBarItem,
556 CT_MenuBar,
557 CT_Menu,
558 CT_TabBarTab,
559 CT_Slider,
560 CT_ScrollBar,
561 CT_LineEdit,
562 CT_SpinBox,
563 CT_SizeGrip,
564 CT_TabWidget,
565 CT_DialogButtons,
566 CT_HeaderSection,
567 CT_GroupBox,
568 CT_MdiControls,
569 CT_ItemViewItem,
570 // do not add any values below/greater than this
571 CT_CustomBase = 0xf0000000
572 };
573 Q_ENUM(ContentsType)
574
575 virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt,
576 const QSize &contentsSize, const QWidget *w = nullptr) const = 0;
577
578 enum RequestSoftwareInputPanel {
579 RSIP_OnMouseClickAndAlreadyFocused,
580 RSIP_OnMouseClick
581 };
582 Q_ENUM(RequestSoftwareInputPanel)
583
584 enum StyleHint {
585 SH_EtchDisabledText,
586 SH_DitherDisabledText,
587 SH_ScrollBar_MiddleClickAbsolutePosition,
588 SH_ScrollBar_ScrollWhenPointerLeavesControl,
589 SH_TabBar_SelectMouseType,
590 SH_TabBar_Alignment,
591 SH_Header_ArrowAlignment,
592 SH_Slider_SnapToValue,
593 SH_Slider_SloppyKeyEvents,
594 SH_ProgressDialog_CenterCancelButton,
595 SH_ProgressDialog_TextLabelAlignment,
596 SH_PrintDialog_RightAlignButtons,
597 SH_MainWindow_SpaceBelowMenuBar,
598 SH_FontDialog_SelectAssociatedText,
599 SH_Menu_AllowActiveAndDisabled,
600 SH_Menu_SpaceActivatesItem,
601 SH_Menu_SubMenuPopupDelay,
602 SH_ScrollView_FrameOnlyAroundContents,
603 SH_MenuBar_AltKeyNavigation,
604 SH_ComboBox_ListMouseTracking,
605 SH_Menu_MouseTracking,
606 SH_MenuBar_MouseTracking,
607 SH_ItemView_ChangeHighlightOnFocus,
608 SH_Widget_ShareActivation,
609 SH_Workspace_FillSpaceOnMaximize,
610 SH_ComboBox_Popup,
611 SH_TitleBar_NoBorder,
612 SH_Slider_StopMouseOverSlider,
613 SH_BlinkCursorWhenTextSelected,
614 SH_RichText_FullWidthSelection,
615 SH_Menu_Scrollable,
616 SH_GroupBox_TextLabelVerticalAlignment,
617 SH_GroupBox_TextLabelColor,
618 SH_Menu_SloppySubMenus,
619 SH_Table_GridLineColor,
620 SH_LineEdit_PasswordCharacter,
621 SH_DialogButtons_DefaultButton,
622 SH_ToolBox_SelectedPageTitleBold,
623 SH_TabBar_PreferNoArrows,
624 SH_ScrollBar_LeftClickAbsolutePosition,
625 SH_ListViewExpand_SelectMouseType,
626 SH_UnderlineShortcut,
627 SH_SpinBox_AnimateButton,
628 SH_SpinBox_KeyPressAutoRepeatRate,
629 SH_SpinBox_ClickAutoRepeatRate,
630 SH_Menu_FillScreenWithScroll,
631 SH_ToolTipLabel_Opacity,
632 SH_DrawMenuBarSeparator,
633 SH_TitleBar_ModifyNotification,
634 SH_Button_FocusPolicy,
635 SH_MessageBox_UseBorderForButtonSpacing,
636 SH_TitleBar_AutoRaise,
637 SH_ToolButton_PopupDelay,
638 SH_FocusFrame_Mask,
639 SH_RubberBand_Mask,
640 SH_WindowFrame_Mask,
641 SH_SpinControls_DisableOnBounds,
642 SH_Dial_BackgroundRole,
643 SH_ComboBox_LayoutDirection,
644 SH_ItemView_EllipsisLocation,
645 SH_ItemView_ShowDecorationSelected,
646 SH_ItemView_ActivateItemOnSingleClick,
647 SH_ScrollBar_ContextMenu,
648 SH_ScrollBar_RollBetweenButtons,
649 SH_Slider_AbsoluteSetButtons,
650 SH_Slider_PageSetButtons,
651 SH_Menu_KeyboardSearch,
652 SH_TabBar_ElideMode,
653 SH_DialogButtonLayout,
654 SH_ComboBox_PopupFrameStyle,
655 SH_MessageBox_TextInteractionFlags,
656 SH_DialogButtonBox_ButtonsHaveIcons,
657 SH_MessageBox_CenterButtons,
658 SH_Menu_SelectionWrap,
659 SH_ItemView_MovementWithoutUpdatingSelection,
660 SH_ToolTip_Mask,
661 SH_FocusFrame_AboveWidget,
662 SH_TextControl_FocusIndicatorTextCharFormat,
663 SH_WizardStyle,
664 SH_ItemView_ArrowKeysNavigateIntoChildren,
665 SH_Menu_Mask,
666 SH_Menu_FlashTriggeredItem,
667 SH_Menu_FadeOutOnHide,
668 SH_SpinBox_ClickAutoRepeatThreshold,
669 SH_ItemView_PaintAlternatingRowColorsForEmptyArea,
670 SH_FormLayoutWrapPolicy,
671 SH_TabWidget_DefaultTabPosition,
672 SH_ToolBar_Movable,
673 SH_FormLayoutFieldGrowthPolicy,
674 SH_FormLayoutFormAlignment,
675 SH_FormLayoutLabelAlignment,
676 SH_ItemView_DrawDelegateFrame,
677 SH_TabBar_CloseButtonPosition,
678 SH_DockWidget_ButtonsHaveFrame,
679 SH_ToolButtonStyle,
680 SH_RequestSoftwareInputPanel,
681 SH_ScrollBar_Transient,
682 SH_Menu_SupportsSections,
683 SH_ToolTip_WakeUpDelay,
684 SH_ToolTip_FallAsleepDelay,
685 SH_Widget_Animate,
686 SH_Splitter_OpaqueResize,
687 // Whether we should use a native popup.
688 // Only supported for non-editable combo boxes on Mac OS X so far.
689 SH_ComboBox_UseNativePopup,
690 SH_LineEdit_PasswordMaskDelay,
691 SH_TabBar_ChangeCurrentDelay,
692 SH_Menu_SubMenuUniDirection,
693 SH_Menu_SubMenuUniDirectionFailCount,
694 SH_Menu_SubMenuSloppySelectOtherActions,
695 SH_Menu_SubMenuSloppyCloseTimeout,
696 SH_Menu_SubMenuResetWhenReenteringParent,
697 SH_Menu_SubMenuDontStartSloppyOnLeave,
698 SH_ItemView_ScrollMode,
699 SH_TitleBar_ShowToolTipsOnButtons,
700 SH_Widget_Animation_Duration,
701 SH_ComboBox_AllowWheelScrolling,
702 SH_SpinBox_ButtonsInsideFrame,
703 SH_SpinBox_StepModifier,
704 SH_TabBar_AllowWheelScrolling,
705 SH_Table_AlwaysDrawLeftTopGridLines,
706 SH_SpinBox_SelectOnStep,
707 // Add new style hint values here
708
709 SH_CustomBase = 0xf0000000
710 };
711 Q_ENUM(StyleHint)
712
713 virtual int styleHint(StyleHint stylehint, const QStyleOption *opt = nullptr,
714 const QWidget *widget = nullptr, QStyleHintReturn* returnData = nullptr) const = 0;
715
716 enum StandardPixmap {
717 SP_TitleBarMenuButton,
718 SP_TitleBarMinButton,
719 SP_TitleBarMaxButton,
720 SP_TitleBarCloseButton,
721 SP_TitleBarNormalButton,
722 SP_TitleBarShadeButton,
723 SP_TitleBarUnshadeButton,
724 SP_TitleBarContextHelpButton,
725 SP_DockWidgetCloseButton,
726 SP_MessageBoxInformation,
727 SP_MessageBoxWarning,
728 SP_MessageBoxCritical,
729 SP_MessageBoxQuestion,
730 SP_DesktopIcon,
731 SP_TrashIcon,
732 SP_ComputerIcon,
733 SP_DriveFDIcon,
734 SP_DriveHDIcon,
735 SP_DriveCDIcon,
736 SP_DriveDVDIcon,
737 SP_DriveNetIcon,
738 SP_DirOpenIcon,
739 SP_DirClosedIcon,
740 SP_DirLinkIcon,
741 SP_DirLinkOpenIcon,
742 SP_FileIcon,
743 SP_FileLinkIcon,
744 SP_ToolBarHorizontalExtensionButton,
745 SP_ToolBarVerticalExtensionButton,
746 SP_FileDialogStart,
747 SP_FileDialogEnd,
748 SP_FileDialogToParent,
749 SP_FileDialogNewFolder,
750 SP_FileDialogDetailedView,
751 SP_FileDialogInfoView,
752 SP_FileDialogContentsView,
753 SP_FileDialogListView,
754 SP_FileDialogBack,
755 SP_DirIcon,
756 SP_DialogOkButton,
757 SP_DialogCancelButton,
758 SP_DialogHelpButton,
759 SP_DialogOpenButton,
760 SP_DialogSaveButton,
761 SP_DialogCloseButton,
762 SP_DialogApplyButton,
763 SP_DialogResetButton,
764 SP_DialogDiscardButton,
765 SP_DialogYesButton,
766 SP_DialogNoButton,
767 SP_ArrowUp,
768 SP_ArrowDown,
769 SP_ArrowLeft,
770 SP_ArrowRight,
771 SP_ArrowBack,
772 SP_ArrowForward,
773 SP_DirHomeIcon,
774 SP_CommandLink,
775 SP_VistaShield,
776 SP_BrowserReload,
777 SP_BrowserStop,
778 SP_MediaPlay,
779 SP_MediaStop,
780 SP_MediaPause,
781 SP_MediaSkipForward,
782 SP_MediaSkipBackward,
783 SP_MediaSeekForward,
784 SP_MediaSeekBackward,
785 SP_MediaVolume,
786 SP_MediaVolumeMuted,
787 SP_LineEditClearButton,
788 SP_DialogYesToAllButton,
789 SP_DialogNoToAllButton,
790 SP_DialogSaveAllButton,
791 SP_DialogAbortButton,
792 SP_DialogRetryButton,
793 SP_DialogIgnoreButton,
794 SP_RestoreDefaultsButton,
795 SP_TabCloseButton,
796 NStandardPixmap, // assertion value for sync with QPlatformTheme::StandardPixmap
797 // do not add any values below/greater than this
798 SP_CustomBase = 0xf0000000
799 };
800 Q_ENUM(StandardPixmap)
801
802 virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt = nullptr,
803 const QWidget *widget = nullptr) const = 0;
804
805 virtual QIcon standardIcon(StandardPixmap standardIcon, const QStyleOption *option = nullptr,
806 const QWidget *widget = nullptr) const = 0;
807
808 virtual QPixmap generatedIconPixmap(QIcon::Mode iconMode, const QPixmap &pixmap,
809 const QStyleOption *opt) const = 0;
810
811 static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect,
812 const QRect &logicalRect);
813 static QPoint visualPos(Qt::LayoutDirection direction, const QRect &boundingRect,
814 const QPoint &logicalPos);
815 static int sliderPositionFromValue(int min, int max, int val, int space,
816 bool upsideDown = false);
817 static int sliderValueFromPosition(int min, int max, int pos, int space,
818 bool upsideDown = false);
819 static Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment);
820 static QRect alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment,
821 const QSize &size, const QRect &rectangle);
822
823 virtual int layoutSpacing(QSizePolicy::ControlType control1,
824 QSizePolicy::ControlType control2, Qt::Orientation orientation,
825 const QStyleOption *option = nullptr, const QWidget *widget = nullptr) const = 0;
826 int combinedLayoutSpacing(QSizePolicy::ControlTypes controls1,
827 QSizePolicy::ControlTypes controls2, Qt::Orientation orientation,
828 QStyleOption *option = nullptr, QWidget *widget = nullptr) const;
829
830 const QStyle * proxy() const;
831
832private:
833 void setName(const QString &name);
834
835private:
836 Q_DISABLE_COPY(QStyle)
837 friend class QWidget;
838 friend class QWidgetPrivate;
839 friend class QApplication;
840 friend class QProxyStyle;
841 friend class QProxyStylePrivate;
842 friend class QStyleFactory;
843 friend class QStyleSheetProxySaver;
844 void setProxy(QStyle *style);
845};
846
847Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::State)
848Q_DECLARE_OPERATORS_FOR_FLAGS(QStyle::SubControls)
849
850QT_END_NAMESPACE
851
852#endif // QSTYLE_H
\inmodule QtSql
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI.
Definition qstyle.h:29
Combined button and popup list for selecting options.