QStyle(3qt)
okay so this is the QStyle(3qt) manual page, bestie, and it's literally the blueprint for how Qt apps look and feel. it's giving main character energy for the entire GUI. π β¨
NAME
QStyle β the look and feel of a GUI. no cap, that's the whole vibe. π
SYNOPSIS
#include <qstyle.h>
Inherits QObject.
Inherited by QCommonStyle.
Public Members
okay so here's the entire squad of public members. we got constructors, destructors, polishes, draws, enums, the whole thing. let's go one by one, bestie, and don't skip a single one because they all matter. π«Ά
QStyle ()virtual ~QStyle ()virtual void polish ( QWidget * )virtual void unPolish ( QWidget * )virtual void polish ( QApplication * )virtual void unPolish ( QApplication * )virtual void polish ( QPalette & )virtual void polishPopupMenu ( QPopupMenu * ) = 0virtual QRect itemRect ( QPainter * p, const QRect & r, int flags, bool enabled, const QPixmap * pixmap, const QString & text, int len = -1 ) constvirtual void drawItem ( QPainter * p, const QRect & r, int flags, const QColorGroup & g, bool enabled, const QPixmap * pixmap, const QString & text, int len = -1, const QColor * penColor = 0 ) const- enum
PrimitiveElement:
enum PrimitiveElement { PE_ButtonCommand, PE_ButtonDefault,
PE_ButtonBevel, PE_ButtonTool, PE_ButtonDropDown, PE_FocusRect,
PE_ArrowUp, PE_ArrowDown, PE_ArrowRight, PE_ArrowLeft,
PE_SpinWidgetUp, PE_SpinWidgetDown, PE_SpinWidgetPlus,
PE_SpinWidgetMinus, PE_Indicator, PE_IndicatorMask,
PE_ExclusiveIndicator, PE_ExclusiveIndicatorMask,
PE_DockWindowHandle, PE_DockWindowSeparator,
PE_DockWindowResizeHandle, PE_Splitter, PE_Panel, PE_PanelPopup,
PE_PanelMenuBar, PE_PanelDockWindow, PE_TabBarBase,
PE_HeaderSection, PE_HeaderArrow, PE_StatusBarSection,
PE_GroupBoxFrame, PE_Separator, PE_SizeGrip, PE_CheckMark,
PE_ScrollBarAddLine, PE_ScrollBarSubLine, PE_ScrollBarAddPage,
PE_ScrollBarSubPage, PE_ScrollBarSlider, PE_ScrollBarFirst,
PE_ScrollBarLast, PE_ProgressBarChunk, PE_PanelLineEdit,
PE_PanelTabWidget, PE_WindowFrame, PE_CheckListController,
PE_CheckListIndicator, PE_CheckListExclusiveIndicator,
PE_PanelGroupBox, PE_RubberBand, PE_CustomBase = 0xf000000 }
- enum
StyleFlags:
enum StyleFlags { Style_Default = 0x00000000, Style_Enabled =
0x00000001, Style_Raised = 0x00000002, Style_Sunken = 0x00000004,
Style_Off = 0x00000008, Style_NoChange = 0x00000010, Style_On =
0x00000020, Style_Down = 0x00000040, Style_Horizontal = 0x00000080,
Style_HasFocus = 0x00000100, Style_Top = 0x00000200, Style_Bottom =
0x00000400, Style_FocusAtBorder = 0x00000800, Style_AutoRaise =
0x00001000, Style_MouseOver = 0x00002000, Style_Up = 0x00004000,
Style_Selected = 0x00008000, Style_Active = 0x00010000,
Style_ButtonDefault = 0x00020000 }
virtual void drawPrimitive ( PrimitiveElement pe, QPainter * p, const QRect & r, const QColorGroup & cg, SFlags flags = Style_Default, const QStyleOption & opt = QStyleOption::Default ) const = 0- enum
ControlElement:
enum ControlElement { CE_PushButton, CE_PushButtonLabel, CE_CheckBox,
CE_CheckBoxLabel, CE_RadioButton, CE_RadioButtonLabel, CE_TabBarTab,
CE_TabBarLabel, CE_ProgressBarGroove, CE_ProgressBarContents,
CE_ProgressBarLabel, CE_PopupMenuItem, CE_MenuBarItem,
CE_ToolButtonLabel, CE_MenuBarEmptyArea, CE_PopupMenuScroller,
CE_DockWindowEmptyArea, CE_PopupMenuVerticalExtra,
CE_PopupMenuHorizontalExtra, CE_ToolBoxTab, CE_HeaderLabel,
CE_CustomBase = 0xf0000000 }
virtual void drawControl ( ControlElement element, QPainter * p, const QWidget * widget, const QRect & r, const QColorGroup & cg, SFlags how = Style_Default, const QStyleOption & opt = QStyleOption::Default ) const = 0virtual void drawControlMask ( ControlElement element, QPainter * p, const QWidget * widget, const QRect & r, const QStyleOption & opt = QStyleOption::Default ) const = 0- enum
SubRect:
enum SubRect { SR_PushButtonContents, SR_PushButtonFocusRect,
SR_CheckBoxIndicator, SR_CheckBoxContents, SR_CheckBoxFocusRect,
SR_RadioButtonIndicator, SR_RadioButtonContents,
SR_RadioButtonFocusRect, SR_ComboBoxFocusRect, SR_SliderFocusRect,
SR_DockWindowHandleRect, SR_ProgressBarGroove,
SR_ProgressBarContents, SR_ProgressBarLabel, SR_ToolButtonContents,
SR_DialogButtonAccept, SR_DialogButtonReject, SR_DialogButtonApply,
SR_DialogButtonHelp, SR_DialogButtonAll, SR_DialogButtonAbort,
SR_DialogButtonIgnore, SR_DialogButtonRetry, SR_DialogButtonCustom,
SR_ToolBoxTabContents, SR_CustomBase = 0xf0000000 }
virtual QRect subRect ( SubRect subrect, const QWidget * widget ) const = 0- enum
ComplexControl:
enum ComplexControl { CC_SpinWidget, CC_ComboBox, CC_ScrollBar,
CC_Slider, CC_ToolButton, CC_TitleBar, CC_ListView, CC_CustomBase =
0xf0000000 }
- enum
SubControl:
enum SubControl { SC_None = 0x00000000, SC_ScrollBarAddLine =
0x00000001, SC_ScrollBarSubLine = 0x00000002, SC_ScrollBarAddPage =
0x00000004, SC_ScrollBarSubPage = 0x00000008, SC_ScrollBarFirst =
0x00000010, SC_ScrollBarLast = 0x00000020, SC_ScrollBarSlider =
0x00000040, SC_ScrollBarGroove = 0x00000080, SC_SpinWidgetUp =
0x00000001, SC_SpinWidgetDown = 0x00000002, SC_SpinWidgetFrame =
0x00000004, SC_SpinWidgetEditField = 0x00000008,
SC_SpinWidgetButtonField = 0x00000010, SC_ComboBoxFrame =
0x00000001, SC_ComboBoxEditField = 0x00000002, SC_ComboBoxArrow =
0x00000004, SC_ComboBoxListBoxPopup = 0x00000008, SC_SliderGroove =
0x00000001, SC_SliderHandle = 0x00000002, SC_SliderTickmarks =
0x00000004, SC_ToolButton = 0x00000001, SC_ToolButtonMenu =
0x00000002, SC_TitleBarLabel = 0x00000001, SC_TitleBarSysMenu =
0x00000002, SC_TitleBarMinButton = 0x00000004, SC_TitleBarMaxButton
= 0x00000008, SC_TitleBarCloseButton = 0x00000010,
SC_TitleBarNormalButton = 0x00000020, SC_TitleBarShadeButton =
0x00000040, SC_TitleBarUnshadeButton = 0x00000080, SC_ListView =
0x00000001, SC_ListViewBranch = 0x00000002, SC_ListViewExpand =
0x00000004, SC_All = 0xffffffff }
virtual void drawComplexControl ( ComplexControl control, QPainter * p, const QWidget * widget, const QRect & r, const QColorGroup & cg, SFlags how = Style_Default, SCFlags sub = SC_All, SCFlags subActive = SC_None, const QStyleOption & opt = QStyleOption::Default ) const = 0virtual void drawComplexControlMask ( ComplexControl control, QPainter * p, const QWidget * widget, const QRect & r, const QStyleOption & opt = QStyleOption::Default ) const = 0virtual QRect querySubControlMetrics ( ComplexControl control, const QWidget * widget, SubControl subcontrol, const QStyleOption & opt = QStyleOption::Default ) const = 0virtual SubControl querySubControl ( ComplexControl control, const QWidget * widget, const QPoint & pos, const QStyleOption & opt = QStyleOption::Default ) const = 0- enum
PixelMetric:
enum PixelMetric { PM_ButtonMargin, PM_ButtonDefaultIndicator,
PM_MenuButtonIndicator, PM_ButtonShiftHorizontal,
PM_ButtonShiftVertical, PM_DefaultFrameWidth, PM_SpinBoxFrameWidth,
PM_MaximumDragDistance, PM_ScrollBarExtent, PM_ScrollBarSliderMin,
PM_SliderThickness, PM_SliderControlThickness, PM_SliderLength,
PM_SliderTickmarkOffset, PM_SliderSpaceAvailable,
PM_DockWindowSeparatorExtent, PM_DockWindowHandleExtent,
PM_DockWindowFrameWidth, PM_MenuBarFrameWidth, PM_TabBarTabOverlap,
PM_TabBarTabHSpace, PM_TabBarTabVSpace, PM_TabBarBaseHeight,
PM_TabBarBaseOverlap, PM_ProgressBarChunkWidth, PM_SplitterWidth,
PM_TitleBarHeight, PM_IndicatorWidth, PM_IndicatorHeight,
PM_ExclusiveIndicatorWidth, PM_ExclusiveIndicatorHeight,
PM_PopupMenuScrollerHeight, PM_CheckListButtonSize,
PM_CheckListControllerSize, PM_PopupMenuFrameHorizontalExtra,
PM_PopupMenuFrameVerticalExtra, PM_DialogButtonsSeparator,
PM_DialogButtonsButtonWidth, PM_DialogButtonsButtonHeight,
PM_MDIFrameWidth, PM_MDIMinimizedWidth, PM_HeaderMargin,
PM_HeaderMarkSize, PM_HeaderGripMargin, PM_TabBarTabShiftHorizontal,
PM_TabBarTabShiftVertical, PM_TabBarScrollButtonWidth,
PM_MenuBarItemSpacing, PM_ToolBarItemSpacing, PM_CustomBase =
0xf0000000 }
virtual int pixelMetric ( PixelMetric metric, const QWidget * widget = 0 ) const = 0- enum
ContentsType:
enum ContentsType { CT_PushButton, CT_CheckBox, CT_RadioButton,
CT_ToolButton, CT_ComboBox, CT_Splitter, CT_DockWindow,
CT_ProgressBar, CT_PopupMenuItem, CT_TabBarTab, CT_Slider,
CT_Header, CT_LineEdit, CT_MenuBar, CT_SpinBox, CT_SizeGrip,
CT_TabWidget, CT_DialogButtons, CT_CustomBase = 0xf0000000 }
virtual QSize sizeFromContents ( ContentsType contents, const QWidget * widget, const QSize & contentsSize, const QStyleOption & opt = QStyleOption::Default ) const = 0- enum
StyleHint:
enum StyleHint { SH_EtchDisabledText, SH_GUIStyle,
SH_ScrollBar_BackgroundMode,
SH_ScrollBar_MiddleClickAbsolutePosition,
SH_ScrollBar_ScrollWhenPointerLeavesControl,
SH_TabBar_SelectMouseType, SH_TabBar_Alignment,
SH_Header_ArrowAlignment, SH_Slider_SnapToValue,
SH_Slider_SloppyKeyEvents, SH_ProgressDialog_CenterCancelButton,
SH_ProgressDialog_TextLabelAlignment,
SH_PrintDialog_RightAlignButtons, SH_MainWindow_SpaceBelowMenuBar,
SH_FontDialog_SelectAssociatedText,
SH_PopupMenu_AllowActiveAndDisabled,
SH_PopupMenu_SpaceActivatesItem, SH_PopupMenu_SubMenuPopupDelay,
SH_ScrollView_FrameOnlyAroundContents, SH_MenuBar_AltKeyNavigation,
SH_ComboBox_ListMouseTracking, SH_PopupMenu_MouseTracking,
SH_MenuBar_MouseTracking, SH_ItemView_ChangeHighlightOnFocus,
SH_Widget_ShareActivation, SH_Workspace_FillSpaceOnMaximize,
SH_ComboBox_Popup, SH_TitleBar_NoBorder,
SH_ScrollBar_StopMouseOverSlider, SH_BlinkCursorWhenTextSelected,
SH_RichText_FullWidthSelection, SH_PopupMenu_Scrollable,
SH_GroupBox_TextLabelVerticalAlignment, SH_GroupBox_TextLabelColor,
SH_PopupMenu_SloppySubMenus, SH_Table_GridLineColor,
SH_LineEdit_PasswordCharacter, SH_DialogButtons_DefaultButton,
SH_ToolBox_SelectedPageTitleBold, SH_TabBar_PreferNoArrows,
SH_ScrollBar_LeftClickAbsolutePosition,
SH_ListViewExpand_SelectMouseType, SH_UnderlineAccelerator,
SH_ToolButton_Uses3D, SH_CustomBase = 0xf0000000 }
virtual int styleHint ( StyleHint stylehint, const QWidget * widget = 0, const QStyleOption & opt = QStyleOption::Default, QStyleHintReturn * returnData = 0 ) const = 0- enum
StylePixmap:
enum StylePixmap { SP_TitleBarMinButton, SP_TitleBarMaxButton,
SP_TitleBarCloseButton, SP_TitleBarNormalButton,
SP_TitleBarShadeButton, SP_TitleBarUnshadeButton,
SP_DockWindowCloseButton, SP_MessageBoxInformation,
SP_MessageBoxWarning, SP_MessageBoxCritical, SP_MessageBoxQuestion,
SP_CustomBase = 0xf0000000 }
virtual QPixmap stylePixmap ( StylePixmap stylepixmap, const QWidget * widget = 0, const QStyleOption & opt = QStyleOption::Default ) const = 0int defaultFrameWidth () const(obsolete)void tabbarMetrics ( const QWidget * t, int & hf, int & vf, int & ov ) const(obsolete)QSize scrollBarExtent () const(obsolete)
and that's the public members, bestie β every single one, no skips. part 2 is coming so stay tuned, okay? ππ¦
Static Public Members
QRect visualRect ( const QRect & logical, const QWidget * w )QRect visualRect ( const QRect & logical, const QRect & bounding )
β¨ DESCRIPTION β¨
Okay bestie, sit down, hydrate, because QStyle is a big one. π The QStyle class specifies the look and feel of a GUI. That's the whole vibe. The fit. The lewk. π
A large number of GUI elements are common to many widgets, and the way that QStyle works is it lets you modify the look of these elements across all widgets that use the QStyle functions. One style change, every widget gets the glow-up. Iconic. π
It also provides two feel options: Motif and Windows. Two feels, pick your fighter. π¦
Now, ngl, it is not possible to fully enumerate the look of graphical elements and the feel of widgets in a GUI β like, that's just too much to list out fr fr. But even so, QStyle provides a considerable amount of control and customisability. She's flexible like that. β¨
History time, because we love a lore drop π: in Qt 1.x the look and feel option for widgets was specified by a single value β the GUIStyle. Starting with Qt 2.0, this notion was expanded to allow the look to be specified by virtual drawing functions. Glow-up era. π
Derived classes may reimplement some or all of the drawing functions to modify the look of all widgets that use those functions. So like, you don't have to do everything β reimplement the ones you care about and the rest just vibe. π«Ά
π RTL bestie check! Languages written from right to left (such as Arabic and Hebrew) usually also mirror the whole layout of widgets. If you design a style, you should take special care when drawing asymmetric elements to make sure that they also look correct in a mirrored layout. You can start your application with -reverse to check the mirrored layout. Also notice, that for a reversed layout, the light usually comes from top right instead of top left. π‘
The actual reverse layout is performed automatically when possible. However, for the sake of flexibility, the translation cannot be performed everywhere. π The documentation for each function in the QStyle API states whether the function expects/returns logical or screen coordinates. Using logical coordinates (in ComplexControls, for example) provides great flexibility in controlling the look of a widget. Use visualRect() when necessary to translate logical coordinates into screen coordinates for drawing. π§
More lore π: in Qt versions prior to 3.0, if you wanted a low level route into changing the appearance of a widget, you would reimplement polish(). But with the new 3.0 style engine the recommended approach is to reimplement the draw functions, for example drawItem(), drawPrimitive(), drawControl(), drawControlMask(), drawComplexControl() and drawComplexControlMask(). Each of these functions is called with a range of parameters that provide information that you can use to determine how to draw them, e.g. style flags, rectangle, color group, etc. Everything you need to make the call. π₯
For information on changing elements of an existing style or creating your own style see the Style overview.
Styles can also be created as plugins. Plug-in era. π§©
See also Widget Appearance and Style.
πΈ Member Type Documentation πΈ
QStyle::ComplexControl
This enum represents a ComplexControl. ComplexControls have different behaviour depending upon where the user clicks on them or which keys are pressed. So like, where you tap matters. Vibe-sensitive. π
QStyle::CC_SpinWidgetQStyle::CC_ComboBoxQStyle::CC_ScrollBarQStyle::CC_SliderQStyle::CC_ToolButtonQStyle::CC_TitleBarQStyle::CC_ListViewQStyle::CC_CustomBaseβ base value for customControlElements. All values above this are reserved for custom use. Therefore, custom values must be greater than this value. β οΈ
See also SubControl and drawComplexControl().
QStyle::ContentsType
This enum represents a ContentsType. It is used to calculate sizes for the contents of various widgets. Sizing math, but make it fashion. πβ¨
QStyle::CT_PushButtonQStyle::CT_CheckBoxQStyle::CT_RadioButtonQStyle::CT_ToolButtonQStyle::CT_ComboBoxQStyle::CT_SplitterQStyle::CT_DockWindowQStyle::CT_ProgressBarQStyle::CT_PopupMenuItemQStyle::CT_TabBarTabQStyle::CT_SliderQStyle::CT_HeaderQStyle::CT_LineEditQStyle::CT_MenuBarQStyle::CT_SpinBoxQStyle::CT_SizeGripQStyle::CT_TabWidgetQStyle::CT_DialogButtonsQStyle::CT_CustomBaseβ base value for customControlElements. All values above this are reserved for custom use. Custom values must be greater than this value. β οΈ
See also sizeFromContents().
QStyle::ControlElement
This enum represents a ControlElement. A ControlElement is part of a widget that performs some action or displays information to the user. Little functional pieces. The main characters of a widget, honestly. π
QStyle::CE_PushButtonβ the bevel and default indicator of aQPushButton.QStyle::CE_PushButtonLabelβ the label (iconset with text or pixmap) of aQPushButton.QStyle::CE_CheckBoxβ the indicator of aQCheckBox.QStyle::CE_CheckBoxLabelβ the label (text or pixmap) of aQCheckBox.QStyle::CE_RadioButtonβ the indicator of aQRadioButton.QStyle::CE_RadioButtonLabelβ the label (text or pixmap) of aQRadioButton.QStyle::CE_TabBarTabβ the tab within aQTabBar(aQTab).QStyle::CE_TabBarLabelβ the label within aQTab.QStyle::CE_ProgressBarGrooveβ the groove where the progress indicator is drawn in aQProgressBar.QStyle::CE_ProgressBarContentsβ the progress indicator of aQProgressBar.QStyle::CE_ProgressBarLabelβ the text label of aQProgressBar.QStyle::CE_PopupMenuItemβ a menu item in aQPopupMenu.QStyle::CE_PopupMenuScrollerβ scrolling areas in a popumenu when the style supports scrolling.QStyle::CE_PopupMenuHorizontalExtraβ extra frame area set aside withPM_PopupMenuFrameHorizontalExtraQStyle::CE_PopupMenuVerticalExtraβ extra frame area set aside withPM_PopupMenuFrameVerticalExtraQStyle::CE_MenuBarItemβ a menu item in aQMenuBar.QStyle::CE_ToolButtonLabelβ a tool button's label.QStyle::CE_MenuBarEmptyAreaβ the empty area of aQMenuBar.QStyle::CE_DockWindowEmptyAreaβ the empty area of aQDockWindow.QStyle::CE_ToolBoxTabβ the toolbox's tab areaQStyle::CE_HeaderLabelβ the header's labelQStyle::CE_CustomBaseβ base value for customControlElements. All values above this are reserved for custom use. Therefore, custom values must be greater than this value. β οΈ
See also drawControl().
QStyle::PixelMetric
This enum represents a PixelMetric. A PixelMetric is a style dependent size represented as a single pixel value. One number, one measurement, very demure. ππ
QStyle::PM_ButtonMarginβ amount of whitespace between pushbutton labels and the frame.QStyle::PM_ButtonDefaultIndicatorβ width of the default-button indicator frame.QStyle::PM_MenuButtonIndicatorβ width of the menu button indicator proportional to the widget height.QStyle::PM_ButtonShiftHorizontalβ horizontal contents shift of a button when the button is down.QStyle::PM_ButtonShiftVerticalβ vertical contents shift of a button when the button is down.QStyle::PM_DefaultFrameWidthβ default frame width, usually2.QStyle::PM_SpinBoxFrameWidthβ frame width of a spin box.QStyle::PM_MDIFrameWidthβ frame width of an MDI window.QStyle::PM_MDIMinimizedWidthβ width of a minimized MSI window.QStyle::PM_MaximumDragDistanceβ Some feels require the scrollbar or other sliders to jump back to the original position when the mouse pointer is too far away while dragging. A value of-1disables this behavior.QStyle::PM_ScrollBarExtentβ width of a vertical scrollbar and the height of a horizontal scrollbar.QStyle::PM_ScrollBarSliderMinβ the minimum height of a vertical scrollbar's slider and the minimum width of a horiztonal scrollbar slider.QStyle::PM_SliderThicknessβ total slider thickness.QStyle::PM_SliderControlThicknessβ thickness of the slider handle.QStyle::PM_SliderLengthβ length of the slider.QStyle::PM_SliderTickmarkOffsetβ the offset between the tickmarks and the slider.QStyle::PM_SliderSpaceAvailableβ the available space for the slider to move.QStyle::PM_DockWindowSeparatorExtentβ width of a separator in a horiztonal dock window and the height of a separator in a vertical dock window.QStyle::PM_DockWindowHandleExtentβ width of the handle in a horizontal dock window and the height of the handle in a vertical dock window.QStyle::PM_DockWindowFrameWidthβ frame width of a dock window.QStyle::PM_MenuBarFrameWidthβ frame width of a menubar.QStyle::PM_MenuBarItemSpacingβ spacing between menubar items.QStyle::PM_ToolBarItemSpacingβ spacing between toolbar items.QStyle::PM_TabBarTabOverlapβ number of pixels the tabs should overlap.QStyle::PM_TabBarTabHSpaceβ extra space added to the tab width.QStyle::PM_TabBarTabVSpaceβ extra space added to the tab height.QStyle::PM_TabBarBaseHeightβ height of the area between the tab bar and the tab pages.QStyle::PM_TabBarBaseOverlapβ number of pixels the tab bar overlaps the tab bar base.QStyle::PM_TabBarScrollButtonWidthQStyle::PM_TabBarTabShiftHorizontalβ horizontal pixel shift when a tab is selected.QStyle::PM_TabBarTabShiftVerticalβ vertical pixel shift when a tab is selected.QStyle::PM_ProgressBarChunkWidthβ width of a chunk in a progress bar indicator.QStyle::PM_SplitterWidthβ width of a splitter.QStyle::PM_TitleBarHeightβ height of the title bar.QStyle::PM_PopupMenuFrameHorizontalExtraβ additional border, e.g. for panelsQStyle::PM_PopupMenuFrameVerticalExtraβ additional border, e.g. for panelsQStyle::PM_IndicatorWidthβ width of a check box indicator.QStyle::PM_IndicatorHeightβ height of a checkbox indicator.QStyle::PM_ExclusiveIndicatorWidthβ width of a radio button indicator.QStyle::PM_ExclusiveIndicatorHeightβ height of a radio button indicator.QStyle::PM_PopupMenuScrollerHeightβ height of the scroller area in a popupmenu.QStyle::PM_PopupMenuScrollerHeightβ height of the scroller area in a popupmenu.QStyle::PM_CheckListButtonSizeβ area (width/height) of the checkbox/radiobutton in aQCheckListItemQStyle::PM_CheckListControllerSizeβ area (width/height) of the controller in aQCheckListItemQStyle::PM_DialogButtonsSeparatorβ distance between buttons in a dialog buttons widget.QStyle::PM_DialogButtonsButtonWidthβ minimum width of a button in a dialog buttons widget.QStyle::PM_DialogButtonsButtonHeightβ minimum height of a button in a dialog buttons widget.QStyle::PM_HeaderMarkSizeQStyle::PM_HeaderGripMarginQStyle::PM_HeaderMarginQStyle::PM_CustomBaseβ base value for customControlElements. All values above this are reserved for custom use. Therefore, custom values must be greater than this value. β οΈ
See also pixelMetric().
β¨ QStyle::PrimitiveElement β¨
okay bestie, this enum is literally the PrimitiveElements of a style. A PrimitiveElement is a common GUI element, like a checkbox indicator or a pushbutton bevel. periodt π
QStyle::PE_ButtonCommandβ a button that kicks off an action, for example, aQPushButton. π₯QStyle::PE_ButtonDefaultβ this button is the default button, like in a dialog. πQStyle::PE_ButtonBevelβ your generic button bevel. πQStyle::PE_ButtonToolβ a tool button, for example, aQToolButton.QStyle::PE_ButtonDropDownβ a drop down button, for example, a tool button that shows a popup menu, for example,QPopupMenu.QStyle::PE_FocusRectβ a generic focus indicator. β¨QStyle::PE_ArrowUpβ an up arrow. β¬οΈQStyle::PE_ArrowDownβ a down arrow. β¬οΈQStyle::PE_ArrowRightβ a right arrow. β‘οΈQStyle::PE_ArrowLeftβ a left arrow. β¬ οΈQStyle::PE_SpinWidgetUpβ the up symbol for a spin widget, for example aQSpinBox.QStyle::PE_SpinWidgetDownβ the down symbol for a spin widget.QStyle::PE_SpinWidgetPlusβ the increase symbol for a spin widget.QStyle::PE_SpinWidgetMinusβ the decrease symbol for a spin widget.QStyle::PE_Indicatorβ an on/off indicator, for example, aQCheckBox.QStyle::PE_IndicatorMaskβ a bitmap mask for an indicator.QStyle::PE_ExclusiveIndicatorβ an exclusive on/off indicator, for example, aQRadioButton.QStyle::PE_ExclusiveIndicatorMaskβ a bitmap mask for an exclusive indicator.QStyle::PE_DockWindowHandleβ a tear off handle for dock windows and toolbars, for exampleQDockWindowsandQToolBars.QStyle::PE_DockWindowSeparatorβ an item separator for dock window and toolbar contents.QStyle::PE_DockWindowResizeHandleβ a resize handle for dock windows.QStyle::PE_Splitterβ a splitter handle; see alsoQSplitter.QStyle::PE_Panelβ a generic panel frame; see alsoQFrame.QStyle::PE_PanelPopupβ a panel frame for popup windows/menus; see alsoQPopupMenu.QStyle::PE_PanelMenuBarβ a panel frame for menu bars.QStyle::PE_PanelDockWindowβ a panel frame for dock windows and toolbars.QStyle::PE_PanelTabWidgetβ a panel frame for tab widgets.QStyle::PE_PanelLineEditβ a panel frame for line edits.QStyle::PE_PanelGroupBoxβ a panel frame for group boxes.QStyle::PE_TabBarBaseβ the area below tabs in a tab widget, for example,QTab.QStyle::PE_HeaderSectionβ a section of a list or table header; see alsoQHeader.QStyle::PE_HeaderArrowβ an arrow used to indicate sorting on a list or table headerQStyle::PE_StatusBarSectionβ a section of a status bar; see alsoQStatusBar.QStyle::PE_GroupBoxFrameβ a frame around a group box; see alsoQGroupBox.QStyle::PE_WindowFrameβ a frame around a MDI window or a docking windowQStyle::PE_Separatorβ a generic separator.QStyle::PE_SizeGripβ a window resize handle; see alsoQSizeGrip.QStyle::PE_CheckMarkβ a generic check mark; see alsoQCheckBox.QStyle::PE_ScrollBarAddLineβ a scrollbar line increase indicator (i.e. scroll down); see alsoQScrollBar.QStyle::PE_ScrollBarSubLineβ a scrollbar line decrease indicator (i.e. scroll up).QStyle::PE_ScrollBarAddPageβ a scolllbar page increase indicator (i.e. page down).QStyle::PE_ScrollBarSubPageβ a scrollbar page decrease indicator (i.e. page up).QStyle::PE_ScrollBarSliderβ a scrollbar sliderQStyle::PE_ScrollBarFirstβ a scrollbar first line indicator (i.e. home).QStyle::PE_ScrollBarLastβ a scrollbar last line indicator (i.e. end).QStyle::PE_ProgressBarChunkβ a section of a progress bar indicator; see alsoQProgressBar.QStyle::PE_CheckListControllerβ the controller part of a listview itemQStyle::PE_CheckListIndicatorβ the checkbox part of a listview itemQStyle::PE_CheckListExclusiveIndicatorβ the radiobutton part of a listview itemQStyle::PE_RubberBandβ a rubber band used in such things as iconviewQStyle::PE_CustomBaseβ the base value for custom PrimitiveElements. All values above this are reserved for custom use. Custom values must be greater than this value. π¨
See also drawPrimitive().
π QStyle::StyleFlags π
This enum represents flags for drawing PrimitiveElements. Not all primitives use all of these flags. Note that these flags may mean different things to different primitives. For an explanation of the relationship between primitives and their flags, as well as the different meanings of the flags, see the Style overview. iykyk π
QStyle::Style_DefaultQStyle::Style_EnabledQStyle::Style_RaisedQStyle::Style_SunkenQStyle::Style_OffQStyle::Style_NoChangeQStyle::Style_OnQStyle::Style_DownQStyle::Style_HorizontalQStyle::Style_HasFocusQStyle::Style_TopQStyle::Style_BottomQStyle::Style_FocusAtBorderQStyle::Style_AutoRaiseQStyle::Style_MouseOverQStyle::Style_UpQStyle::Style_SelectedQStyle::Style_HasFocusQStyle::Style_ActiveQStyle::Style_ButtonDefault
See also drawPrimitive().
π QStyle::StyleHint π
This enum represents a StyleHint. A StyleHint is a general look and/or feel hint. main character energy fr fr β¨
QStyle::SH_EtchDisabledTextβ disabled text is "etched" like Windows.QStyle::SH_GUIStyleβ the GUI style to use.QStyle::SH_ScrollBar_BackgroundModeβ the background mode for aQScrollBar. Possible values are any of those in theBackgroundModeenum.QStyle::SH_ScrollBar_MiddleClickAbsolutePositionβ a boolean value. IfTRUE, middle clicking on a scrollbar causes the slider to jump to that position. IfFALSE, the middle clicking is ignored.QStyle::SH_ScrollBar_LeftClickAbsolutePositionβ a boolean value. IfTRUE, left clicking on a scrollbar causes the slider to jump to that position. IfFALSE, the left clicking will behave as appropriate for each control.QStyle::SH_ScrollBar_ScrollWhenPointerLeavesControlβ a boolean value. IfTRUE, when clicking a scrollbarSubControl, holding the mouse button down and moving the pointer outside theSubControl, the scrollbar continues to scroll. IfFALSE, the scollbar stops scrolling when the pointer leaves theSubControl.QStyle::SH_TabBar_Alignmentβ the alignment for tabs in aQTabWidget. Possible values areQt::AlignLeft,Qt::AlignCenterandQt::AlignRight.QStyle::SH_Header_ArrowAlignmentβ the placement of the sorting indicator may appear in list or table headers. Possible values areQt::LeftorQt::Right.QStyle::SH_Slider_SnapToValueβ sliders snap to values while moving, like WindowsQStyle::SH_Slider_SloppyKeyEventsβ key presses handled in a sloppy manner, i.e. left on a vertical slider subtracts a line.QStyle::SH_ProgressDialog_CenterCancelButtonβ center button on progress dialogs, like Motif, otherwise right aligned.QStyle::SH_ProgressDialog_TextLabelAlignmentβQt::AlignmentFlags-- text label alignment in progress dialogs; Center on windows,Auto|VCenterotherwise.QStyle::SH_PrintDialog_RightAlignButtonsβ right align buttons in the print dialog, like Windows.QStyle::SH_MainWindow_SpaceBelowMenuBarβ 1 or 2 pixel space between the menubar and the dockarea, like Windows.QStyle::SH_FontDialog_SelectAssociatedTextβ select the text in the line edit, or when selecting an item from the listbox, or when the line edit receives focus, like Windows.QStyle::SH_PopupMenu_AllowActiveAndDisabledβ allows disabled menu items to be active.QStyle::SH_PopupMenu_SpaceActivatesItemβ pressing Space activates the item, like Motif.QStyle::SH_PopupMenu_SubMenuPopupDelayβ the number of milliseconds to wait before opening a submenu; 256 on windows, 96 on Motif.QStyle::SH_PopupMenu_Scrollableβ whether popupmenu's must support scrolling.QStyle::SH_PopupMenu_SloppySubMenusβ whether popupmenu's must support sloppy submenu; as implemented on Mac OS.QStyle::SH_ScrollView_FrameOnlyAroundContentsβ whether scrollviews draw their frame only around contents (like Motif), or around contents, scrollbars and corner widgets (like Windows).QStyle::SH_MenuBar_AltKeyNavigationβ menubars items are navigable by pressing Alt, followed by using the arrow keys to select the desired item.QStyle::SH_ComboBox_ListMouseTrackingβ mouse tracking in combobox dropdown lists.QStyle::SH_PopupMenu_MouseTrackingβ mouse tracking in popup menus.QStyle::SH_MenuBar_MouseTrackingβ mouse tracking in menubars.QStyle::SH_ItemView_ChangeHighlightOnFocusβ gray out selected items when losing focus.QStyle::SH_Widget_ShareActivationβ turn on sharing activation with floating modeless dialogs.QStyle::SH_TabBar_SelectMouseTypeβ which type of mouse event should cause a tab to be selected.QStyle::SH_ListViewExpand_SelectMouseTypeβ which type of mouse event should cause a listview expansion to be selected.QStyle::SH_TabBar_PreferNoArrowsβ whether a tabbar should suggest a size to prevent scoll arrows.QStyle::SH_ComboBox_Popupβ allows popups as a combobox dropdown menu.QStyle::SH_Workspace_FillSpaceOnMaximizeβ the workspace should maximize the client area.QStyle::SH_TitleBar_NoBorderβ the titlebar has no borderQStyle::SH_ScrollBar_StopMouseOverSliderβ stops autorepeat when slider reaches mouseQStyle::SH_BlinkCursorWhenTextSelectedβ whether cursor should blink when text is selectedQStyle::SH_RichText_FullWidthSelectionβ whether richtext selections should extend the full width of the document.QStyle::SH_GroupBox_TextLabelVerticalAlignmentβ how to vertically align a groupbox's text label.QStyle::SH_GroupBox_TextLabelColorβ how to paint a groupbox's text label.QStyle::SH_DialogButtons_DefaultButtonβ which buttons gets the default status in a dialog's button widget.QStyle::SH_CustomBaseβ base value for custom ControlElements. All values above this are reserved for custom use. Therefore, custom values must be greater than this value.QStyle::SH_ToolButton_Uses3Dβ indicates whetherQToolButtonsshould use a 3D frame when the mouse is over themQStyle::SH_ToolBox_SelectedPageTitleBoldβ Boldness of the selected page title in aQToolBox.QStyle::SH_LineEdit_PasswordCharacterβ TheQCharUnicode character to be used for passwords.QStyle::SH_Table_GridLineColorQStyle::SH_UnderlineAcceleratorβ whether accelerators are underlined
See also styleHint().
π QStyle::StylePixmap
okay so this enum is literally a list of pixmaps, and a StylePixmap is a pixmap that can follow some existing GUI style or guideline. so like, the vibe of the pixmap. slay.
QStyle::SP_TitleBarMinButtonβ minimize button on titlebars. For example, in aQWorkspace.QStyle::SP_TitleBarMaxButtonβ maximize button on titlebars.QStyle::SP_TitleBarCloseButtonβ close button on titlebars.QStyle::SP_TitleBarNormalButtonβ normal (restore) button on titlebars.QStyle::SP_TitleBarShadeButtonβ shade button on titlebars.QStyle::SP_TitleBarUnshadeButtonβ unshade button on titlebars.QStyle::SP_MessageBoxInformationβ the 'information' icon.QStyle::SP_MessageBoxWarningβ the 'warning' icon.QStyle::SP_MessageBoxCriticalβ the 'critical' icon.QStyle::SP_MessageBoxQuestionβ the 'question' icon.QStyle::SP_DockWindowCloseButtonβ close button on dock windows; see alsoQDockWindow.QStyle::SP_CustomBaseβ base value for customControlElements. All values above this are reserved for custom use. Therefore, custom values must be greater than this value.
See also stylePixmap().
π¦ QStyle::SubControl
this one is all about the lil pieces inside a ComplexControl. like the sub-parts of a widget, the supporting cast, the ensemble. iconic.
QStyle::SC_Noneβ special value that matches no otherSubControl.QStyle::SC_ScrollBarAddLineβ scrollbar add line (i.e. down/right arrow); see alsoQScrollbar.QStyle::SC_ScrollBarSubLineβ scrollbar sub line (i.e. up/left arrow).QStyle::SC_ScrollBarAddPageβ scrollbar add page (i.e. page down).QStyle::SC_ScrollBarSubPageβ scrollbar sub page (i.e. page up).QStyle::SC_ScrollBarFirstβ scrollbar first line (i.e. home).QStyle::SC_ScrollBarLastβ scrollbar last line (i.e. end).QStyle::SC_ScrollBarSliderβ scrollbar slider handle.QStyle::SC_ScrollBarGrooveβ special subcontrol which contains the area in which the slider handle may move.QStyle::SC_SpinWidgetUpβ spinwidget up/increase; see alsoQSpinBox.QStyle::SC_SpinWidgetDownβ spinwidget down/decrease.QStyle::SC_SpinWidgetFrameβ spinwidget frame.QStyle::SC_SpinWidgetEditFieldβ spinwidget edit field.QStyle::SC_SpinWidgetButtonFieldβ spinwidget button field.QStyle::SC_ComboBoxEditFieldβ combobox edit field; see alsoQComboBox.QStyle::SC_ComboBoxArrowβ combobox arrowQStyle::SC_ComboBoxFrameβ combobox frameQStyle::SC_ComboBoxListBoxPopupβ combobox list boxQStyle::SC_SliderGrooveβ special subcontrol which contains the area in which the slider handle may move.QStyle::SC_SliderHandleβ slider handle.QStyle::SC_SliderTickmarksβ slider tickmarks.QStyle::SC_ToolButtonβ tool button; see alsoQToolbutton.QStyle::SC_ToolButtonMenuβ subcontrol for opening a popup menu in a tool button; see alsoQPopupMenu.QStyle::SC_TitleBarSysMenuβ system menu button (i.e. restore, close, etc.).QStyle::SC_TitleBarMinButtonβ minimize button.QStyle::SC_TitleBarMaxButtonβ maximize button.QStyle::SC_TitleBarCloseButtonβ close button.QStyle::SC_TitleBarLabelβ window title label.QStyle::SC_TitleBarNormalButtonβ normal (restore) button.QStyle::SC_TitleBarShadeButtonβ shade button.QStyle::SC_TitleBarUnshadeButtonβ unshade button.QStyle::SC_ListViewβ the list view area.QStyle::SC_ListViewBranchβ (internal)QStyle::SC_ListViewExpandβ expand item (i.e. show/hide child items).QStyle::SC_Allβ special value that matches allSubControls.
See also ComplexControl.
π QStyle::SubRect
bestie this one is about zones. this enum represents a sub-area of a widget, and style implementations would use these areas to draw the different parts of a widget. every part gets its own little neighborhood. π
QStyle::SR_PushButtonContentsβ area containing the label (iconset with text or pixmap).QStyle::SR_PushButtonFocusRectβ area for the focus rect (usually larger than the contents rect).QStyle::SR_CheckBoxIndicatorβ area for the state indicator (e.g. check mark).QStyle::SR_CheckBoxContentsβ area for the label (text or pixmap).QStyle::SR_CheckBoxFocusRectβ area for the focus indicator.QStyle::SR_RadioButtonIndicatorβ area for the state indicator.QStyle::SR_RadioButtonContentsβ area for the label.QStyle::SR_RadioButtonFocusRectβ area for the focus indicator.QStyle::SR_ComboBoxFocusRectβ area for the focus indicator.QStyle::SR_SliderFocusRectβ area for the focus indicator.QStyle::SR_DockWindowHandleRectβ area for the tear-off handle.QStyle::SR_ProgressBarGrooveβ area for the groove.QStyle::SR_ProgressBarContentsβ area for the progress indicator.QStyle::SR_ProgressBarLabelβ area for the text label.QStyle::SR_ToolButtonContentsβ area for the tool button's label.QStyle::SR_DialogButtonAcceptβ area for a dialog's accept button.QStyle::SR_DialogButtonRejectβ area for a dialog's reject button.QStyle::SR_DialogButtonApplyβ area for a dialog's apply button.QStyle::SR_DialogButtonHelpβ area for a dialog's help button.QStyle::SR_DialogButtonAllβ area for a dialog's all button.QStyle::SR_DialogButtonRetryβ area for a dialog's retry button.QStyle::SR_DialogButtonAbortβ area for a dialog's abort button.QStyle::SR_DialogButtonIgnoreβ area for a dialog's ignore button.QStyle::SR_DialogButtonCustomβ area for a dialog's custom widget area (in button row).QStyle::SR_ToolBoxTabContentsβ area for a toolbox tab's icon and labelQStyle::SR_CustomBaseβ base value for customControlElements. All values above this are reserved for custom use. Therefore, custom values must be greater than this value.
See also subRect().
π οΈ MEMBER FUNCTION DOCUMENTATION π οΈ
β¨ QStyle::QStyle ()
Constructs a QStyle. that's it, that's the whole thing. short king behavior. π
β¨ QStyle::~QStyle () [virtual]
Destroys the style and frees all allocated resources. clean exit, no mess left behind, we love a queen who cleans up after herself. π§
β οΈ int QStyle::defaultFrameWidth () const
bestie, this function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. like, fr fr, don't. it's giving legacy code energy and not in a cute way. π
π₯ void QStyle::drawComplexControl ( ... ) const [pure virtual]
void QStyle::drawComplexControl ( ComplexControl control, QPainter * p, const
QWidget * widget, const QRect & r, const QColorGroup & cg, SFlags how =
Style_Default, SCFlags sub = SC_All, SCFlags subActive = SC_None, const
QStyleOption & opt = QStyleOption::Default ) const [pure virtual]
Draws the ComplexControl control using the painter p in the area r. Colors are used from the color group cg. The sub argument specifies which SubControls to draw. Multiple SubControls can be OR'ed together. The subActive argument specifies which SubControl is active.
The rect r should be in logical coordinates. Reimplementations of this function should use visualRect() to change the logical coordinates into screen coordinates when using drawPrimitive() and drawControl(). do not skip this step, it's literally the whole plot twist.
The how argument is used to control how the ComplexControl is drawn. Multiple flags can OR'ed together. See the table below for an explanation of which flags are used with the various ComplexControls.
The widget argument is a pointer to a QWidget or one of its subclasses. The widget can be cast to the appropriate type based on the value of control. The opt argument can be used to pass extra information required when drawing the ComplexControl. Note that opt may be the default value even for ComplexControls that can make use of the extra options. See the table below for the appropriate widget and opt usage:
<center>.nf
</center>
See also ComplexControl and SubControl.
π₯ void QStyle::drawComplexControlMask ( ... ) const [pure virtual]
void QStyle::drawComplexControlMask ( ComplexControl control, QPainter * p,
const QWidget * widget, const QRect & r, const QStyleOption & opt =
QStyleOption::Default ) const [pure virtual]
Draw a bitmask for the ComplexControl control using the painter p in the area r. See drawComplexControl() for an explanation of the use of the widget and opt arguments.
The rect r should be in logical coordinates. Reimplementations of this function should use visualRect() to change the logical corrdinates into screen coordinates when using drawPrimitive() and drawControl(). (yes bestie, "corrdinates" β the typo is canon, we don't touch the canon π
)
See also drawComplexControl() and ComplexControl.
π void QStyle::drawControl ( ... ) const [pure virtual]
void QStyle::drawControl ( ControlElement element, QPainter * p, const QWidget
* widget, const QRect & r, const QColorGroup & cg, SFlags how =
Style_Default, const QStyleOption & opt = QStyleOption::Default ) const
[pure virtual]
Draws the ControlElement element using the painter p in the area r. Colors are used from the color group cg.
The rect r should be in screen coordinates. (note: screen, not logical β different function, different rules, keep up bestie π«Ά)
The how argument is used to control how the ControlElement is drawn. Multiple flags can be OR'ed together. See the table below for an explanation of which flags are used with the various ControlElements.
The widget argument is a pointer to a QWidget or one of its subclasses. The widget can be cast to the appropriate type based on the value of element. The opt argument can be used to pass extra information required when drawing the ControlElement. Note that opt may be the default value even for ControlElements that can make use of the extra options. See the table below for the appropriate widget and opt usage:
<center>.nf
</center>
See also ControlElement and StyleFlags.
π void QStyle::drawControlMask ( ... ) const [pure virtual]
void QStyle::drawControlMask ( ControlElement element, QPainter * p, const
QWidget * widget, const QRect & r, const QStyleOption & opt =
QStyleOption::Default ) const [pure virtual]
Draw a bitmask for the ControlElement element using the painter p in the area r. See drawControl() for an explanation of the use of the widget and opt arguments.
The rect r should be in screen coordinates.
See also drawControl() and ControlElement.
π void QStyle::drawItem ( ... ) const [virtual]
void QStyle::drawItem ( QPainter * p, const QRect & r, int flags, const
QColorGroup & g, bool enabled, const QPixmap * pixmap, const QString &
text, int len = -1, const QColor * penColor = 0 ) const [virtual]
Draws the text or pixmap in rectangle r using painter p and color group g. The pen color is specified with penColor. The enabled bool indicates whether or not the item is enabled; when reimplementing this bool should influence how the item is drawn. If len is -1 (the default) all the text is drawn; otherwise only the first len characters of text are drawn. The text is aligned and wrapped according to the alignment flags (see Qt::AlignmentFlags).
By default, if both the text and the pixmap are not null, the pixmap is drawn and the text is ignored. like pixmap said "move, i'm the main character now" π
void QStyle::drawPrimitive ( PrimitiveElement pe, QPainter * p, const QRect & r, const QColorGroup & cg, SFlags flags = Style_Default, const QStyleOption & opt = QStyleOption::Default ) const [pure virtual]
okay bestie this one is the whole entire moment, it's the pure virtual that every style subclass has GOT to implement or it simply will not compile π
It draws the style PrimitiveElement pe using the painter p in the area r, and the colors come from the color group cg.
Heads up: the rect r should be in screen coordinates. Not logical, not widget-local, screen. Do not play with me on this.
The flags argument controls how the PrimitiveElement gets drawn, and you can OR multiple flags together. Fr fr:
- a pressed button would be drawn with
Style_EnabledandStyle_Down.
The opt argument can be used to control how various PrimitiveElements are drawn. And here's the little trap: opt may be the default value even for PrimitiveElements that make use of extra options. When opt is non-default, it is used as follows:
<center>.nf
</center>
For all other PrimitiveElements, opt is unused.
See also StyleFlags.
Example: themes/wood.cpp.
QRect QStyle::itemRect ( QPainter * p, const QRect & r, int flags, bool enabled, const QPixmap * pixmap, const QString & text, int len = -1 ) const [virtual]
Returns the appropriate area (see below, bestie) within rectangle r in which to draw the text or pixmap using painter p. If len is -1 (the default) all the text is drawn; otherwise only the first len characters of text are drawn. The text is aligned in accordance with the alignment flags (see Qt::AlignmentFlags). The enabled bool says whether or not the item is enabled.
If r is larger than the area needed to render the text, the rectangle that is returned will be offset within r in accordance with the alignment flags. For example, if flags is AlignCenter, the returned rectangle will be centered within r. If r is smaller than the area needed, the rectangle that is returned will be larger than r (the smallest rectangle large enough to render the text or pixmap).
By default, if both the text and the pixmap are not null, the pixmap is drawn and the text is ignored. (pixmap said main character energy, text said ok I'll wait π)
int QStyle::pixelMetric ( PixelMetric metric, const QWidget * widget = 0 ) const [pure virtual]
Returns the pixel metric for metric. The widget argument is a pointer to a QWidget or one of its subclasses. The widget can be cast to the appropriate type based on the value of metric. Note that widget may be zero even for PixelMetrics that can make use of widget β so check before you dereference, bestie, I'm begging. See the table below for the appropriate widget casts:
<center>.nf
</center>
void QStyle::polish ( QWidget * ) [virtual]
Initializes the appearance of a widget. β¨
This function is called for every widget at some point after it has been fully created but just before it is shown the very first time.
Reasonable actions in this function might be to call QWidget::setBackgroundMode() for the widget. An example of highly unreasonable use would be setting the geometry! Like, do not. Reimplementing this function gives you a back-door through which you can change the appearance of a widget. With Qt 3.0's style engine you will rarely need to write your own polish(); instead reimplement drawItem(), drawPrimitive(), etc.
The QWidget::inherits() function may provide enough information to allow class-specific customizations. But be careful not to hard-code things too much, because new QStyle subclasses are expected to work reasonably with all current and future widgets. (future-proofing is the vibe π
)
See also unPolish().
void QStyle::polish ( QApplication * ) [virtual]
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Late initialization of the QApplication object.
See also unPolish().
void QStyle::polish ( QPalette & ) [virtual]
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
The style may have certain requirements for color palettes. In this function it has the chance to change the palette according to these requirements. glow-up for your palette, basically π
See also QPalette and QApplication::setPalette().
void QStyle::polishPopupMenu ( QPopupMenu * ) [pure virtual]
Polishes the popup menu according to the GUI style. This usually means setting the mouse tracking (QPopupMenu::setMouseTracking()) and whether the menu is checkable by default (QPopupMenu::setCheckable()).
SubControl QStyle::querySubControl ( ComplexControl control, const QWidget * widget, const QPoint & pos, const QStyleOption & opt = QStyleOption::Default ) const [pure virtual]
Returns the SubControl for widget at the point pos. The widget argument is a pointer to a QWidget or one of its subclasses. The widget can be cast to the appropriate type based on the value of control. The opt argument can be used to pass extra information required when drawing the ComplexControl. Note that opt may be the default value even for ComplexControls that can make use of the extra options. See drawComplexControl() for an explanation of the widget and opt arguments.
Note thatposis passed in screen coordinates. When usingquerySubControlMetrics()to check for hits and misses, usevisualRect()to change the logical coordinates into screen coordinates. iykyk π
See also drawComplexControl(), ComplexControl, SubControl, and querySubControlMetrics().
QRect QStyle::querySubControlMetrics ( ComplexControl control, const QWidget * widget, SubControl subcontrol, const QStyleOption & opt = QStyleOption::Default ) const [pure virtual]
Returns the rect for the SubControl subcontrol for widget in logical coordinates.
The widget argument is a pointer to a QWidget or one of its subclasses. The widget can be cast to the appropriate type based on the value of control. The opt argument can be used to pass extra information required when drawing the ComplexControl. Note that opt may be the default value even for ComplexControls that can make use of the extra options. See drawComplexControl() for an explanation of the widget and opt arguments.
See also drawComplexControl(), ComplexControl, and SubControl.
QSize QStyle::scrollBarExtent () const
This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. bestie she's retired, let her rest π
QSize QStyle::sizeFromContents ( ContentsType contents, const QWidget * widget, const QSize & contentsSize, const QStyleOption & opt = QStyleOption::Default ) const [pure virtual]
Returns the size of widget based on the contents size contentsSize.
The widget argument is a pointer to a QWidget or one of its subclasses. The widget can be cast to the appropriate type based on the value of contents. The opt argument can be used to pass extra information required when calculating the size. Note that opt may be the default value even for ContentsTypes that can make use of the extra options. See the table below for the appropriate widget and opt usage:
<center>.nf
</center>
int QStyle::styleHint ( StyleHint stylehint, const QWidget * widget = 0, const QStyleOption & opt = QStyleOption::Default, QStyleHintReturn * returnData = 0 ) const [pure virtual]
Returns the style hint stylehint for widget. Currently, widget, opt, and returnData are unused; they're included to allow for future enhancements. (they're just sitting there being decorative, honestly iconic π¦)
For an explanation of the return value see StyleHint.
QPixmap QStyle::stylePixmap ( StylePixmap stylepixmap, const QWidget * widget = 0, const QStyleOption & opt = QStyleOption::Default ) const [pure virtual]
Returns a pixmap for stylepixmap. π
The opt argument can be used to pass extra information required when drawing the ControlElement. Note that opt may be the default value even for StylePixmaps that can make use of the extra options. Currently, the opt argument is unused.
The widget argument is a pointer to a QWidget or one of its subclasses. The widget can be cast to the appropriate type based on the value of stylepixmap. See the table below for the appropriate widget casts:
<center>.nf
</center>
See also StylePixmap.
QRect QStyle::subRect ( SubRect subrect, const QWidget * widget ) const [pure virtual]
Returns the sub-area subrect for the widget in logical coordinates.
The widget argument is a pointer to a QWidget or one of its subclasses. The widget can be cast to the appropriate type based on the value of subrect. See the table below for the appropriate widget casts:
<center>.nf
</center>
The tear-off handle (SR_DockWindowHandleRect) for QDockWindow is a private class. Use QWidget::parentWidget() to access the QDockWindow:
if ( !widget->parentWidget() )
return;
const QDockWindow *dw = (const QDockWindow *) widget->parentWidget();
See also SubRect.
void QStyle::tabbarMetrics ( const QWidget * t, int & hf, int & vf, int & ov ) const
This function is obsolete. It is provided to keep old source working. We strongly advise against using it in new code. another one that's giving "please stop calling me" π
void QStyle::unPolish ( QWidget * ) [virtual]
Undoes the initialization of a widget's appearance.
This function is the counterpart to polish. It is called for every polished widget when the style is dynamically changed. The former style has to unpolish its settings before the new style can polish them again. (it's the "undo my makeup so the next look can go on" step π
)
See also polish().
void QStyle::unPolish ( QApplication * ) [virtual]
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Undoes the application polish.
See also polish().
QRect QStyle::visualRect ( const QRect & logical, const QWidget * w ) [static]
Returns the rect logical in screen coordinates. The bounding rect for widget w is used to perform the translation. This function is provided to aid style implementors in supporting right-to-left mode. πΈ
See also QApplication::reverseLayout().
QRect QStyle::visualRect ( const QRect & logical, const QRect & bounding ) [static]
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Returns the rect logical in screen coordinates. The rect bounding is used to perform the translation. This function is provided to aid style implementors in supporting right-to-left mode. πΈ
See also QApplication::reverseLayout().
π SEE ALSO π
π COPYRIGHT π
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the license file included in the distribution for a complete license statement.
π AUTHOR π
Generated automatically from the source code.
π BUGS π
okay so bestie, found a bug in Qt? π do not just suffer in silence β report it exactly like they say over at http://doc.trolltech.com/bughowto.html π good bug reports are literally what helps them help you, and honestly? thank you in advance, you're doing the lord's work π«Ά
heads up tho π the definitive Qt documentation lives in HTML format, no cap. it's chilling at $QTDIR/doc/html and you can read it with Qt Assistant or just, y'know, a web browser π this man page? it's a lil convenience for the man-page girlies out there β this format is not officially supported by Trolltech π
(yes the HTML is the main character, we're just the vibe)
and if you spot errors in this manual page specifically π report them to:
qt-bugs@trolltech.com
but pls pls pls include both of these so they can actually find it π:
- the name of the manual page β
qstyle.3qt - the Qt version β
3.3.8
fr fr, a report without the page name and version is giving "lost in the group chat with no context" π give them the receipts and everyone eats π₯
that's a wrap on this whole page, bestie!! πβ¨ QStyle is so much and you read all of it, iconic behavior honestly π this one came from Trolltech AS, dated 2 February 2007, and the page is QStyle(3qt) β go forth and style responsibly ππ¦πΈ
π¦ where this page comes from
- fedora 43: qt3-devel-docs 3.3.8b-102.fc43 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- fedora 44: qt3-devel-docs 3.3.8b-103.fc44 Β· QPL-1.0 OR GPL-2.0-only OR GPL-3.0-only
- Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms