Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions | ![]() |
The QStyle class specifies the look and feel of a GUI. More...
#include <QStyle>
Inherits QObject.
Inherited by QCommonStyle.
The QStyle class specifies the look and feel of a GUI.
A large number of GUI elements are common to many widgets. The QStyle class allows the look of these elements to be modified across all widgets that use the QStyle functions. It also provides "feel" options for widgets.
Although it is not possible to completely enumerate the look of graphical elements and the feel of widgets in a GUI, QStyle provides a considerable amount of control and customisability.
In Qt 1.x the look and feel option for widgets was specified by a single value: the Qt::GUIStyle. Starting with Qt 2.0, this notion was expanded to allow the look to be specified by virtual drawing functions.
Derived classes may reimplement some or all of the drawing functions to modify the look of all widgets that use those functions.
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. 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 the 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.
In Qt versions prior to 3.0, if you wanted a low level route into changing the appearance of a widget, you had to reimplement polish(). With 3.0 and later, 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.
In Qt 4.0, the majority of the information about what is to be drawn and how it should be drawn, is specified by a QStyleOption structure. The widget parameter that was mandatory in Qt 3.0, is now optional, but it has been kept for developers who may want it. Developers who use the widget pointer must be careful and use should use qt_cast() to get the correct widget as there are no guarantees about what class the widget will be.
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.
This enum represents a ComplexControl. ComplexControls have different behavior depending upon where the user clicks on them or which keys are pressed.
QStyle::CC_SpinBox | |
QStyle::CC_ComboBox | |
QStyle::CC_ScrollBar | |
QStyle::CC_Slider | |
QStyle::CC_ToolButton | |
QStyle::CC_TitleBar | |
QStyle::CC_ListView |
QStyle::CC_CustomBase | base value for custom ControlElements. Custom values must be greater than this value. |
See also SubControl and drawComplexControl().
This enum represents a ContentsType. It is used to calculate sizes for the contents of various widgets.
QStyle::CT_CheckBox | |
QStyle::CT_ComboBox | |
QStyle::CT_DialogButtons | |
QStyle::CT_DockWindow | |
QStyle::CT_Header | |
QStyle::CT_LineEdit | |
QStyle::CT_Menu | |
QStyle::CT_Menu | |
QStyle::CT_MenuBar | |
QStyle::CT_MenuBarItem | |
QStyle::CT_MenuItem | |
QStyle::CT_ProgressBar | |
QStyle::CT_PushButton | |
QStyle::CT_RadioButton | |
QStyle::CT_SizeGrip | |
QStyle::CT_Slider | |
QStyle::CT_SpinBox | |
QStyle::CT_Splitter | |
QStyle::CT_TabBarTab | |
QStyle::CT_TabWidget | |
QStyle::CT_ToolButton | |
QStyle::CT_ToolBarButton |
QStyle::CT_CustomBase | base value for custom ControlElements. Custom values must be greater than this value. |
See also sizeFromContents().
This enum represents a ControlElement. A ControlElement is part of a widget that performs some action or displays information to the user.
QStyle::CE_PushButton | the bevel and default indicator of a QPushButton. |
QStyle::CE_PushButtonLabel | the label (iconset with text or pixmap) of a QPushButton. |
QStyle::CE_CheckBox | the indicator of a QCheckBox. |
QStyle::CE_CheckBoxLabel | the label (text or pixmap) of a QCheckBox. |
QStyle::CE_RadioButton | the indicator of a QRadioButton. |
QStyle::CE_RadioButtonLabel | the label (text or pixmap) of a QRadioButton. |
QStyle::CE_TabBarTab | the tab within a QTabBar (a QTab). |
QStyle::CE_TabBarLabel | the label within a QTab. |
QStyle::CE_ProgressBarGroove | the groove where the progress indicator is drawn in a QProgressBar. |
QStyle::CE_ProgressBarContents | the progress indicator of a QProgressBar. |
QStyle::CE_ProgressBarLabel | the text label of a QProgressBar. |
QStyle::CE_ToolButtonLabel | a tool button's label. |
QStyle::CE_ToolBarButton |
QStyle::CE_MenuBarItem | a menu item in a QMenuBar. |
QStyle::CE_MenuBarEmptyArea | the empty area of a QMenuBar. |
QStyle::CE_MenuItem | a menu item in a QMenu. |
QStyle::CE_MenuScroller | scrolling areas in a QMenu when the style supports scrolling. |
QStyle::CE_MenuTearoff | a menu item representing the tear off section of a QMenu. |
QStyle::CE_MenuEmptyArea | the area in a menu without menu items. |
QStyle::CE_MenuVMargin | the vertical extra space on the top/bottom of a menu. |
QStyle::CE_MenuHMargin | the horizontal extra space on the left/right of a menu. |
QStyle::CE_DockWindowEmptyArea | the empty area of a QDockWindow. |
QStyle::CE_ToolBoxTab | the toolbox's tab area. |
QStyle::CE_HeaderLabel | the header's label. |
QStyle::CE_CustomBase | base value for custom ControlElements. Custom values must be greater than this value. |
See also drawControl().
This enum represents a PixelMetric. A PixelMetric is a style dependent size represented as a single pixel value.
QStyle::PM_ButtonMargin | amount of whitespace between push button 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, usually 2. |
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 MDI 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 -1 disables 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 horizontal scrollbar's 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 horizontal 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_MenuBarHMargin | spacing between menubar items and top/bottom of bar. |
QStyle::PM_MenuBarVMargin | spacing between menubar items and left/right of bar. |
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_TabBarScrollButtonWidth | |
QStyle::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_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_MenuFrameWidth | border width (applied on all sides) for a QMenu. |
QStyle::PM_MenuHMargin | additional border (used on left and right) for a QMenu. |
QStyle::PM_MenuVMargin | additional border (used for bottom and top) for a QMenu. |
QStyle::PM_MenuScrollerHeight | height of the scroller area in a QMenu. |
QStyle::PM_MenuScrollerHeight | height of the scroller area in a QMenu. |
QStyle::PM_MenuTearoffHeight | height of a tear off area in a QMenu. |
QStyle::PM_MenuDesktopFrameWidth |
QStyle::PM_CheckListButtonSize | area (width/height) of the checkbox/radiobutton in a QCheckListItem |
QStyle::PM_CheckListControllerSize | area (width/height) of the controller in a QCheckListItem |
QStyle::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_HeaderMarkSize | |
QStyle::PM_HeaderGripMargin | |
QStyle::PM_HeaderMargin | |
QStyle::PM_SpinBoxSliderHeight | The height of the optional spin box slider. |
QStyle::PM_CustomBase | base value for custom ControlElements. Custom values must be greater than this value. |
QStyle::PM_DefaultToplevelMargin | |
QStyle::PM_DefaultChildMargin | |
QStyle::PM_DefaultLayoutSpacing |
See also pixelMetric().
This enum represents the effects performed on a pixmap to achieve a GUI style's perferred way of representing the image in different states.
QStyle::PT_Disabled | a disabled pixmap (drawn on disabled widgets). |
QStyle::PT_Active | an active pixmap (drawn on active toolbuttons/menuitems). |
QStyle::PT_CustomBase | base value for custom PixmapTypes. Custom values must be greater than this value. |
See also stylePixmap().
This enum represents a style's PrimitiveElements. A PrimitiveElement is a common GUI element, such as a checkbox indicator or button bevel.
QStyle::PE_ButtonCommand | button used to initiate an action, for example, a QPushButton. |
QStyle::PE_ButtonDefault | this button is the default button, e.g. in a dialog. |
QStyle::PE_ButtonBevel | generic button bevel. |
QStyle::PE_ButtonTool | tool button, for example, a QToolButton. |
QStyle::PE_ButtonDropDown | drop down button, for example, a tool button that displays a popup menu, for example, QMenu. |
QStyle::PE_FocusRect | generic focus indicator. |
QStyle::PE_ArrowUp | up arrow. |
QStyle::PE_ArrowDown | down arrow. |
QStyle::PE_ArrowRight | right arrow. |
QStyle::PE_ArrowLeft | left arrow. |
QStyle::PE_SpinBoxUp | up symbol for a spin widget, for example a QSpinBox. |
QStyle::PE_SpinBoxDown | down symbol for a spin widget. |
QStyle::PE_SpinBoxPlus | increase symbol for a spin widget. |
QStyle::PE_SpinBoxMinus | decrease symbol for a spin widget. |
QStyle::PE_Indicator | on/off indicator, for example, a QCheckBox. |
QStyle::PE_IndicatorMask | bitmap mask for an indicator. |
QStyle::PE_ExclusiveIndicator | exclusive on/off indicator, for example, a QRadioButton. |
QStyle::PE_ExclusiveIndicatorMask | bitmap mask for an exclusive indicator. |
QStyle::PE_DockWindowHandle | tear off handle for dock windows and toolbars, for example QDockWindows and QToolBars. |
QStyle::PE_DockWindowSeparator | item separator for dock window and toolbar contents. |
QStyle::PE_DockWindowResizeHandle | resize handle for dock windows. |
QStyle::PE_Splitter | splitter handle; see also QSplitter. |
QStyle::PE_Panel | generic panel frame; see also QFrame. |
QStyle::PE_PanelPopup | panel frame for popup windows/menus; see also QMenu. |
QStyle::PE_PanelMenuBar | panel frame for menu bars. |
QStyle::PE_PanelDockWindow | panel frame for dock windows and toolbars. |
QStyle::PE_PanelTabWidget | panel frame for tab widgets. |
QStyle::PE_PanelLineEdit | panel frame for line edits. |
QStyle::PE_PanelGroupBox | panel frame for group boxes. |
QStyle::PE_TabBarBase | area below tabs in a tab widget, for example, QTab. |
QStyle::PE_MenuFrame | frame displayed in a QMenu |
QStyle::PE_MenuBarFrame | frame displayed in a QMenuBar |
QStyle::PE_HeaderSection | section of a list or table header; see also QHeader. |
QStyle::PE_HeaderArrow | arrow used to indicate sorting on a list or table header |
QStyle::PE_StatusBarSection | section of a status bar; see also QStatusBar. |
QStyle::PE_GroupBoxFrame | frame around a group box; see also QGroupBox. |
QStyle::PE_WindowFrame | frame around a MDI window or a docking window. |
QStyle::PE_Separator | generic separator. |
QStyle::PE_SizeGrip | window resize handle; see also QSizeGrip. |
QStyle::PE_CheckMark | generic check mark; see also QCheckBox. |
QStyle::PE_ScrollBarAddLine | scrollbar line increase indicator. (i.e. scroll down); see also QScrollBar. |
QStyle::PE_ScrollBarSubLine | scrollbar line decrease indicator (i.e. scroll up). |
QStyle::PE_ScrollBarAddPage | scolllbar page increase indicator (i.e. page down). |
QStyle::PE_ScrollBarSubPage | scrollbar page decrease indicator (i.e. page up). |
QStyle::PE_ScrollBarSlider | scrollbar slider. |
QStyle::PE_ScrollBarFirst | scrollbar first line indicator (i.e. home). |
QStyle::PE_ScrollBarLast | scrollbar last line indicator (i.e. end). |
QStyle::PE_ProgressBarChunk | section of a progress bar indicator; see also QProgressBar. |
QStyle::PE_CheckListController | controller part of a listview item. |
QStyle::PE_CheckListIndicator | checkbox part of a listview item. |
QStyle::PE_CheckListExclusiveIndicator | radiobutton part of a listview item. |
QStyle::PE_RubberBand | rubber band used in such things as iconview. |
QStyle::PE_TreeBranch | lines used to represent the branch of a tree in a tree view. |
QStyle::PE_SpinBoxSlider | The optional slider part of a spin box. |
QStyle::PE_CustomBase | 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().
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.
QStyle::Style_Active | |
QStyle::Style_AutoRaise | |
QStyle::Style_Bottom | |
QStyle::Style_ButtonDefault | |
QStyle::Style_Children | |
QStyle::Style_Default | |
QStyle::Style_Down | |
QStyle::Style_Editing | |
QStyle::Style_Enabled | |
QStyle::Style_FocusAtBorder | |
QStyle::Style_HasFocus | |
QStyle::Style_HasFocus | |
QStyle::Style_Horizontal | |
QStyle::Style_Item | |
QStyle::Style_MouseOver | |
QStyle::Style_NoChange | |
QStyle::Style_Off | |
QStyle::Style_On | |
QStyle::Style_Open | |
QStyle::Style_Raised | |
QStyle::Style_Rectangle | |
QStyle::Style_Selected | |
QStyle::Style_Sibling | |
QStyle::Style_Sunken | |
QStyle::Style_Top | |
QStyle::Style_Up |
See also drawPrimitive().
This enum represents a StyleHint. A StyleHint is a general look and/or feel hint.
QStyle::SH_EtchDisabledText | disabled text is "etched" as it is on Windows. |
QStyle::SH_GUIStyle | the GUI style to use. |
QStyle::SH_ScrollBar_BackgroundRole | the background role for a QScrollBar. |
QStyle::SH_ScrollBar_MiddleClickAbsolutePosition | a boolean value. If true, middle clicking on a scrollbar causes the slider to jump to that position. If false, middle clicking is ignored. |
QStyle::SH_ScrollBar_LeftClickAbsolutePosition | a boolean value. If true, left clicking on a scrollbar causes the slider to jump to that position. If false, left clicking will behave as appropriate for each control. |
QStyle::SH_ScrollBar_ScrollWhenPointerLeavesControl | a boolean value. If true, when clicking a scrollbar SubControl, holding the mouse button down and moving the pointer outside the SubControl, the scrollbar continues to scroll. If false, the scollbar stops scrolling when the pointer leaves the SubControl. |
QStyle::SH_TabBar_Alignment | the alignment for tabs in a QTabWidget. Possible values are Qt::AlignLeft, Qt::AlignCenter and Qt::AlignRight. |
QStyle::SH_Header_ArrowAlignment | the placement of the sorting indicator may appear in list or table headers. Possible values are Qt::Left or Qt::Right. |
QStyle::SH_Slider_SnapToValue | sliders snap to values while moving, as they do on Windows. |
QStyle::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::Alignment -- text label alignment in progress dialogs; Center on windows, Auto|VCenter otherwise. |
QStyle::SH_PrintDialog_RightAlignButtons | right align buttons in the print dialog, as done on Windows. |
QStyle::SH_MainWindow_SpaceBelowMenuBar | 1 or 2 pixel space between the menubar and the dockarea, as done on 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, as done on Windows. |
QStyle::SH_Menu_AllowActiveAndDisabled | allows disabled menu items to be active. |
QStyle::SH_Menu_SpaceActivatesItem | pressing the space bar activates the item, as done on Motif. |
QStyle::SH_Menu_SubMenuPopupDelay | the number of milliseconds to wait before opening a submenu; 256 on windows, 96 on Motif. |
QStyle::SH_Menu_Scrollable | whether popupmenu's must support scrolling. |
QStyle::SH_Menu_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_Menu_MouseTracking | mouse tracking in popup menus. |
QStyle::SH_MenuBar_MouseTracking | mouse tracking in menubars. |
QStyle::SH_Menu_FillScreenWithScroll | whether scrolling popups should fill the screen as they are scrolled. |
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 title bar has no border. |
QStyle::SH_ScrollBar_StopMouseOverSlider | stops auto-repeat when the slider reaches the mouse position. |
QStyle::SH_BlinkCursorWhenTextSelected | whether cursor should blink when text is selected. |
QStyle::SH_RichText_FullWidthSelection | whether richtext selections should extend to 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 button gets the default status in a dialog's button widget. |
QStyle::SH_ToolButton_Uses3D | indicates whether QToolButtons should use a 3D frame when the mouse is over them |
QStyle::SH_ToolBox_SelectedPageTitleBold | Boldness of the selected page title in a QToolBox. |
QStyle::SH_LineEdit_PasswordCharacter | The QChar Unicode character to be used for passwords. |
QStyle::SH_Table_GridLineColor |
QStyle::SH_UnderlineShortcut | whether shortcuts are underlined. |
QStyle::SH_SpinBox_AnimateButton | animate a click when up or down is pressed in a spin box. |
QStyle::SH_SpinBox_KeyPressAutoRepeatRate | auto-repeat interval for spinbox key presses. |
QStyle::SH_SpinBox_ClickAutoRepeatRate | auto-repeat interval for spinbox mouse clicks. |
QStyle::SH_TipLabel_Opacity | An integer indicating the opacity for the tip label, 0 is completely transparent, 255 is completely opaque. |
QStyle::SH_CustomBase | base value for custom ControlElements. Custom values must be greater than this value. |
See also styleHint().
This enum represents a StylePixmap. A StylePixmap is a pixmap that can follow some existing GUI style or guideline.
QStyle::SP_TitleBarMinButton | minimize button on title bars. For example, in a QWorkspace. |
QStyle::SP_TitleBarMaxButton | maximize button on title bars. |
QStyle::SP_TitleBarCloseButton | close button on title bars. |
QStyle::SP_TitleBarNormalButton | normal (restore) button on title bars. |
QStyle::SP_TitleBarShadeButton | shade button on title bars. |
QStyle::SP_TitleBarUnshadeButton | unshade button on title bars. |
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_DesktopIcon | |
QStyle::SP_TrashIcon | |
QStyle::SP_ComputerIcon | |
QStyle::SP_DriveFDIcon | |
QStyle::SP_DriveHDIcon | |
QStyle::SP_DriveCDIcon | |
QStyle::SP_DriveDVDIcon | |
QStyle::SP_DriveNetIcon | |
QStyle::SP_DirOpenIcon | |
QStyle::SP_DirClosedIcon | |
QStyle::SP_DirLinkIcon | |
QStyle::SP_FileIcon | |
QStyle::SP_FileLinkIcon |
QStyle::SP_DockWindowCloseButton | close button on dock windows; see also QDockWindow. |
QStyle::SP_CustomBase | base value for custom ControlElements. Custom values must be greater than this value. |
See also stylePixmap().
This enum represents a SubControl within a ComplexControl.
QStyle::SC_None | special value that matches no other SubControl. |
QStyle::SC_ScrollBarAddLine | scrollbar add line (i.e. down/right arrow); see also QScrollbar. |
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 sub-control which contains the area in which the slider handle may move. |
QStyle::SC_SpinBoxUp | spinwidget up/increase; see also QSpinBox. |
QStyle::SC_SpinBoxDown | spinwidget down/decrease. |
QStyle::SC_SpinBoxFrame | spinwidget frame. |
QStyle::SC_SpinBoxEditField | spinwidget edit field. |
QStyle::SC_SpinBoxButtonField | spinwidget button field. |
QStyle::SC_SpinBoxSlider | spinwidget optional slider. |
QStyle::SC_ComboBoxEditField | combobox edit field; see also QComboBox. |
QStyle::SC_ComboBoxArrow | combobox arrow |
QStyle::SC_ComboBoxFrame | combobox frame |
QStyle::SC_ComboBoxListBoxPopup | combobox list box |
QStyle::SC_SliderGroove | special sub-control 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 also QToolbutton. |
QStyle::SC_ToolButtonMenu | sub-control for opening a popup menu in a tool button; see also Q3PopupMenu. |
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_ListViewExpand | expand item (i.e. show/hide child items). |
QStyle::SC_All | special value that matches all SubControls. |
See also ComplexControl.
This enum represents a sub-area of a widget. Style implementations use these areas to draw the different parts of a widget.
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 the button row). |
QStyle::SR_ToolBoxTabContents | area for a toolbox tab's icon and label |
QStyle::SR_CustomBase | base value for custom ControlElements. Custom values must be greater than this value. |
QStyle::SR_ToolBarButtonContents | |
QStyle::SR_ToolBarButtonMenu |
See also subRect().
Constructs a QStyle.
Destroys the style and frees all allocated resources.
Draws the ComplexControl cc using the painter p with the style options specified by opt.
The widget argument is optional and may contain a widget to aid in drawing cc.
The opt parameter is a pointer to a QStyleOptionComplex structure that can be qt_cast'ed to the correct structure. Note that the rect member of opt 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().
Here is a table listing the elements and what they can be cast to, along with an explaination of the flags.
Complex Control | Option Cast | Style Flags | Notes |
---|---|---|---|
CC_SpinBox | (const QStyleOptionSpinBox *) | Style_Enabled | Set if the spinwidget is enabled. |
Style_HasFocus | Set if the spinwidget has input focus. | ||
CC_ComboBox | (const QStyleOptionComboBox *) | Style_Enabled | Set if the combobox is enabled. |
Style_HasFocus | Set if the combobox has input focus. | ||
CC_ScrollBar | (const QStyleOptionSlider *) | Style_Enabled | Set if the scrollbar is enabled. |
Style_HasFocus | Set if the scrollbar has input focus. | ||
CC_Slider | (const QStyleOptionSlider *) | Style_Enabled | Set if the slider is enabled. |
Style_HasFocus | Set if the slider has input focus. | ||
CC_ToolButton | (const QStyleOptionToolButton *) | Style_Enabled | Set if the toolbutton is enabled. |
Style_HasFocus | Set if the toolbutton has input focus. | ||
Style_Down | Set if the toolbutton is down (i.e. a mouse button or the space bar is pressed). | ||
Style_On | Set if the toolbutton is a toggle button and is toggled on. | ||
Style_AutoRaise | Set if the toolbutton has auto-raise enabled. | ||
Style_Raised | Set if the button is not down, not on, and doesn't contain the mouse when auto-raise is enabled. | ||
CC_TitleBar | (const QStyleOptionTitleBar *) | Style_Enabled | Set if the title bar is enabled. |
CC_ListView | (const QStyleOptionListView *) | Style_Enabled | Set if the listview is enabled. |
See also ComplexControl, SubControl, and QStyleOptionComplex.
Draw a bitmask for the ComplexControl cc using the painter p with the style options specified by opt. See drawComplexControl() for an explanation of the use of the widget and opt arguments.
The rect int the QStyleOptionComplex opt 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().
See also drawComplexControl(), ComplexControl, and QStyleOptionComplex.
Draws the ControlElement element with painter p with the style options specified by opt.
The widget argument is optional and may contain a widget that may aid in drawing the control.
The opt parameter can be qt_cast()'ed to the correct sub-class of the QStyleOption.
What follows is a table of the elements and the QStyleOption structure they can cast to. The flags stored in the QStyleOption state variable are also listed. If a ControlElement is not listed here, then it uses the default QStyleOption.
ControlElement | Option Cast | Style Flags | Notes |
---|---|---|---|
CE_MenuItem and CE_MenuBarItem | const QStyleOptionMenuItem | Style_Active | The menu item is the current item. |
Style_Enabled | The item is enabled. | ||
Style_Down | Set if the menu item is down (i.e., if the mouse button or the space bar is pressed). | ||
Style_HasFocus | Set if the menubar has input focus. | ||
CE_PushButton and CE_PushButtonLabel | const QStyleOptionButton | Style_Enabled | Set if the button is enabled. |
Style_HasFocus | Set if the button has input focus. | ||
Style_Raised | Set if the button is not down, not on and not flat. | ||
Style_On | Set if the button is a toggle button and is toggled on. | ||
Style_Down | Set if the button is down (i.e., the mouse button or the space bar is pressed on the button). | ||
Style_ButtonDefault | Set if the button is a default button. | ||
CE_RadioButton, CE_RadioButtonLabel, CE_CheckBox, and CE_CheckBoxLabel | const QStyleOptionButton | Style_Enabled | Set if the button is enabled. |
Style_HasFocus | Set if the button has input focus. | ||
Style_On | Set if the button is checked. | ||
Style_Off | Set if the button is not checked. | ||
Style_NoChange | Set if the button is in the NoChange state. | ||
Style_Down | Set if the button is down (i.e., the mouse button or the space bar is pressed on the button). | ||
CE_ProgressBarContents, CE_ProgressBarLabel, CE_ProgressBarGroove | const QStyleOptionProgressBar | Style_Enabled | Set if the progressbar is enabled. |
Style_HasFocus | Set if the progressbar has input focus. | ||
CE_HeaderLabel | const QStyleOptionHeader | ||
CE_ToolButtonLabel | const QStyleOptionToolButton | Style_Enabled | Set if the toolbutton is enabled. |
Style_HasFocus | Set if the toolbutton has input focus. | ||
Style_Down | Set if the toolbutton is down (i.e., a mouse button or the space bar is pressed). | ||
Style_On | Set if the toolbutton is a toggle button and is toggled on. | ||
Style_AutoRaise | Set if the toolbutton has auto-raise enabled. | ||
Style_MouseOver | Set if the mouse pointer is over the toolbutton. | ||
Style_Raised | Set if the button is not down and is not on. | ||
CE_ToolBoxTab | const QStyleOptionToolBox | Style_Selected | The tab is the currently selected tab. |
See also ControlElement, StyleFlags, and QStyleOption.
Draw a bitmask for the ControlElement element using the painter p with the style options specified by opt. See drawControl() for an explanation of the use of opt and widget.
Draws the text in rectangle r using painter p and palette pal. 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::Alignment).
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Draws the pixmap in rectangle r using painter p and the palette pal.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Draws the pixmap in rectangle r using painter p and palette pal.
Draw the primitive option pe with painter p using the style options specified by opt.
The w argument is optional and may contain a widget that may aid in drawing the primitive.
The opt parameter can be qt_cast()'ed to the correct sub-class of the QStyleOption.
What follows is a table of the elements and the QStyleOption structure they can be cast to. The flags stored in the QStyleOption state variable are also listed. If a PrimitiveElement is not listed here, then it uses the default QStyleOption.
The QStyleOption is the the following for the following types of PrimitiveElements.
PrimitiveElement | Option Cast | Style Flags | Notes |
---|---|---|---|
PE_FocusRect | (const QStyleOptionFocusRect *) | Style_FocusAtBorder | Whether the focus is is at the border or inside the widget. |
PE_Indicator | (const QStyleOptionButton *) | Sytle_NoChange | Indicates a "tri-state" checkbox. |
Style_On | Indicates the indicator is checked. | ||
PE_ExclusiveIndicator | (const QStyleOptionButton *) | Style_On | Indicates that a radiobutton is selected. |
PE_CheckListExclusiveIndicator and PE_CheckListIndicator | (const QStyleOptionListView *) | Style_On | Indicates whether or not the controller is selected. |
Style_NoChange | Indicates a "tri-state" controller. | ||
Style_Enable | Indicates the controller is enabled. | ||
PE_TreeBranch | (const QStyleOption *) | Style_Down | Indicates that the Tree Branch is pressed |
Style_Open | Indicates that the tree branch is expanded. | ||
PE_HeaderArrow | (const QStyleOptionHeader *) | Style_Up | Indicates that the arrow should be drawn up; otherwise it should be down. |
PE_HeaderSection | (const QStyleOptionHeader *) | Style_Sunken | Indicates that the section is pressed. |
Style_Up | Indicates that the sort indicator should be pointing up. | ||
Style_Off | Indicates that the the section is not selected. | ||
PE_PanelGroupBox, PE_Panel, PE_PanelLineEdit, PE_PanelPopup, and PE_PanelDockWindow | (const QStyleOptionFrame *) | Style_Sunken | Indicates that the Frame should be sunken. |
PE_DockWindowHandle | (const QStyleOptionDockWindow *) | Style_Horizontal | Indicates that the window handle is horizontal instead of vertical. |
PE_DockWindowSeparator | (const QStyleOption *) | Style_Horizontal | Indicates that the separator is horizontal instead of vertical. |
PE_SpinBoxPlus, PE_SpinBoxMinus, PE_SpinBoxUp, PE_SpinBoxDown, and PE_SpinBoxSlider | (const QStyleOptionSpinBox *) | Style_Sunken | Indicates that the button is pressed. |
See also PrimitiveElement, StyleFlags, and QStyleOption.
Returns the appropriate area (see below) within rectangle r in which to draw text using the font metrics fm. 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::Alignment). The enabled bool indicates 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 Qt::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).
This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Returns the appropriate area within rectangle r in which to draw the pixmap and text using the painter p. The flags determine the pixmap's alignment.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Returns the appropriate area within rectangle r in which to draw the pixmap. The flags determine the pixmap's alignment.
Warning: This function will be replaced in Qt 4.0
The functionality will be replaced by a new pixelMetric() that is not dependent on the widget argument.
Returns the pixel metric for the given 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. See the table below for the appropriate widget casts:
PixelMetric | Widget Cast |
---|---|
PM_SliderControlThickness | (const QSlider *) |
PM_SliderLength | (const QSlider *) |
PM_SliderTickmarkOffset | (const QSlider *) |
PM_SliderSpaceAvailable | (const QSlider *) |
PM_TabBarTabOverlap | (const QTabBar *) |
PM_TabBarTabHSpace | (const QTabBar *) |
PM_TabBarTabVSpace | (const QTabBar *) |
PM_TabBarBaseHeight | (const QTabBar *) |
PM_TabBarBaseOverlap | (const QTabBar *) |
Initializes the appearance of widget w.
This function is called for every widget at some point after it has been fully created but just before it is shown for 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! Reimplementing this function gives you a back-door through which you can change the appearance of a widget. With Qt 4.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.
See also unPolish().
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Late initialization of the QApplication object app.
See also unPolish().
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 pal according to these requirements.
See also QPalette and QApplication::setPalette().
Converts logical_val to a pixel position. min maps to 0, max maps to span and other values are distributed evenly in-between.
This function can handle the entire integer range without overflow, providing span is <= 4096.
By default, this function assumes that the maximum value is on the right for horizontal items and on the bottom for vertical items. Set upsideDown to true to reverse this behavior.
See also valueFromPosition().
Returns the SubControl in the ComplexControl cc with the style options specified by opt at the point pos. The opt argument is a pointer to a QStyleOptionComplex structure or one of its subclasses. The structure can be cast to the appropriate type based on the value of cc. The widget argument is optional and can contain additional information for the functions. See drawComplexControl() for an explanation of the widget and opt arguments.
Note that pos is passed in screen coordinates. When using querySubControlMetrics() to check for hits and misses, use visualRect() to change the logical coordinates into screen coordinates.
See also drawComplexControl(), ComplexControl, SubControl, querySubControlMetrics(), and QStyleOptionComplex.
Returns the rect for the SubControl sc in the ComplexControl cc, with the style options specified by opt in logical coordinates.
The opt argument is a pointer to a QStyleOptionComplex or one of its subclasses. The structure can be cast to the appropriate type based on the value of cc. The widget is optional and can contain additional information for the function. See drawComplexControl() for an explanation of the widget and opt arguments.
See also drawComplexControl(), ComplexControl, SubControl, and QStyleOptionComplex.
Returns the size of styled object described in opt based on the contents size contentsSize. The font metrics in fm can aid in determining the size.
The opt argument is a pointer to a QStyleOption or one of its subclasses. The opt can be cast to the appropriate type based on the value of ct. The widget w is optional argument and can contain extra information used for calculating the size. See the table below for the appropriate opt usage:
ContentsType | Option Cast |
---|---|
CT_PushButton | (const QStyleOptionButton *) |
CT_CheckBox | (const QStyleOptionButton *) |
CT_RadioButton | (const QStyleOptionButton *) |
CT_ToolButton | (const QStyleOptionToolButton *) |
CT_ComboBox | (const QStyleOptionComboBox *) |
CT_Splitter | (const QStyleOption *) |
CT_DockWindow | (const QStyleOptionDockWindow *) |
CT_ProgressBar | (const QStyleOptionProgressBar *) |
CT_MenuItem | (const QStyleOptionMenuItem *) |
See also ContentsType and QStyleOption.
Warning: This function will be replaced in Qt 4.0
The functionality will be replaced by a new styleHint() that is not dependent on the widget argument nor on opt.
Returns the style hint stylehint for widget. Currently, widget, opt, and returnData are unused; they're included to allow for future enhancements.
For an explanation of the return value see StyleHint.
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:
StylePixmap | Widget Cast |
---|---|
SP_TitleBarMinButton | (const QWidget *) |
SP_TitleBarMaxButton | (const QWidget *) |
SP_TitleBarCloseButton | (const QWidget *) |
SP_TitleBarNormalButton | (const QWidget *) |
SP_TitleBarShadeButton | (const QWidget *) |
SP_TitleBarUnshadeButton | (const QWidget *) |
SP_DockWindowCloseButton | (const QDockWindow *) |
See also StylePixmap.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Returns a pixmap styled to conform to pixmaptype description out of pixmap, and taking into account the palette specified by pal.
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.
Not all types of pixmaps will change from their input in which case the result will simply be the pixmap passed in.
Returns the sub-area subrect as described in opt in logical coordinates.
The widget argument is optional and may contain a widget that may aid determining the subRect.
The QStyleOption can be qt_cast()'d to the appropriate type based on the value of subrect. See the table below for the appropriate widget casts:
SubRect | Widget Cast |
---|---|
SR_PushButtonContents | (const QStyleOptionButton *) |
SR_PushButtonFocusRect | (const QStyleOptionButton *) |
SR_CheckBoxIndicator | (const QStyleOptionButton *) |
SR_CheckBoxContents | (const QStyleOptionButton *) |
SR_CheckBoxFocusRect | (const QStyleOptionButton *) |
SR_RadioButtonIndicator | (const QStyleOptionButton *) |
SR_RadioButtonContents | (const QStyleOptionButton *) |
SR_RadioButtonFocusRect | (const QStyleOptionButton *) |
SR_ComboBoxFocusRect | (const QStyleOptionComboBox *) |
SR_DockWindowHandleRect | (const QStyleOptionDockWindow *) |
SR_ProgressBarGroove | (const QStyleOptionProgressBar *) |
SR_ProgressBarContents | (const QStyleOptionProgressBar *) |
SR_ProgressBarLabel | (const QStyleOptionProgressBar *) |
See also SubRect and QStyleOption.
Undoes the initialization of widget w'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.
See also polish().
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Undoes the polish of application app.
See also polish().
Converts the pixel position pos to a value. 0 maps to min, span maps to max and other values are distributed evenly in-between.
This function can handle the entire integer range without overflow.
By default, this function assumes that the maximum value is on the right for horizontal items and on the bottom for vertical items. Set upsideDown to true to reverse this behavior.
See also positionFromValue().
Returns the logical point 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().
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Returns the logical point in screen coordinates. The bounding rectangle is used to perform the translation. This function is provided to aid style implementors in supporting right-to-left mode.
See also QApplication::reverseLayout().
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().
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().
Copyright © 2004 Trolltech. | Trademarks | Qt 4.0.0-tp1 |