CopperSpice API
1.9.2
|
Abstract base class that encapsulates the look and feel of a GUI. More...
Public Typedefs | |
using | State = QFlags< StateFlag > |
using | SubControls = QFlags< SubControl > |
Public Types | |
enum | ComplexControl |
enum | ContentsType |
enum | ControlElement |
enum | PixelMetric |
enum | PrimitiveElement |
enum | RequestSoftwareInputPanel |
enum | StandardPixmap |
enum | StateFlag |
enum | StyleHint |
enum | SubControl |
enum | SubElement |
Public Methods | |
QStyle () | |
virtual | ~QStyle () |
int | combinedLayoutSpacing (QSizePolicy::ControlTypes controls1, QSizePolicy::ControlTypes controls2, Qt::Orientation orientation, QStyleOption *option=nullptr, QWidget *widget=nullptr) const |
virtual void | drawComplexControl (ComplexControl control, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget=nullptr) const = 0 |
virtual void | drawControl (ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget=nullptr) const = 0 |
virtual void | drawItemPixmap (QPainter *painter, const QRect &rect, int alignment, const QPixmap &pixmap) const |
virtual void | drawItemText (QPainter *painter, const QRect &rect, int alignment, const QPalette &palette, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole) const |
virtual void | drawPrimitive (PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget=nullptr) const = 0 |
virtual QPixmap | generatedIconPixmap (QIcon::Mode iconMode, const QPixmap &pixmap, const QStyleOption *option) const = 0 |
virtual SubControl | hitTestComplexControl (ComplexControl control, const QStyleOptionComplex *option, const QPoint &position, const QWidget *widget=nullptr) const = 0 |
virtual QRect | itemPixmapRect (const QRect &rect, int alignment, const QPixmap &pixmap) const |
virtual QRect | itemTextRect (const QFontMetrics &metrics, const QRect &rect, int alignment, bool enabled, const QString &text) const |
virtual int | layoutSpacing (QSizePolicy::ControlType control1, QSizePolicy::ControlType control2, Qt::Orientation orientation, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const = 0 |
virtual int | pixelMetric (PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const = 0 |
virtual void | polish (QApplication *application) |
virtual void | polish (QPalette &palette) |
virtual void | polish (QWidget *widget) |
const QStyle * | proxy () const |
virtual QSize | sizeFromContents (ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget=nullptr) const = 0 |
virtual QIcon | standardIcon (StandardPixmap standardIcon, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const = 0 |
virtual QPalette | standardPalette () const |
virtual QPixmap | standardPixmap (StandardPixmap standardPixmap, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const = 0 |
virtual int | styleHint (StyleHint styleHint, const QStyleOption *option=nullptr, const QWidget *widget=nullptr, QStyleHintReturn *styleHintReturn=nullptr) const = 0 |
virtual QRect | subControlRect (ComplexControl control, const QStyleOptionComplex *option, SubControl subControl, const QWidget *widget=nullptr) const = 0 |
virtual QRect | subElementRect (SubElement subElement, const QStyleOption *option, const QWidget *widget=nullptr) const = 0 |
virtual void | unpolish (QApplication *application) |
virtual void | unpolish (QWidget *widget) |
Public Methods inherited from QObject | |
QObject (QObject *parent=nullptr) | |
~QObject () | |
bool | blockSignals (bool block) |
const QList< QObject * > & | children () const |
bool | connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
bool | connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
bool | disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const |
bool | disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const |
bool | disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QString > | dynamicPropertyNames () const |
virtual bool | event (QEvent *event) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
template<typename T > | |
T | findChild (const QString &childName=QString ()) const |
template<class T > | |
QList< T > | findChildren (const QRegularExpression ®Exp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
template<class T > | |
QList< T > | findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
bool | inherits (const QString &className) const |
void | installEventFilter (QObject *filterObj) |
bool | isWidgetType () const |
bool | isWindowType () const |
void | killTimer (int id) |
const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const |
QObject * | parent () const |
template<class T = QVariant> | |
T | property (const QString &name) const |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const QString &name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer) |
QThread * | thread () const |
Static Public Methods | |
static QRect | alignedRect (Qt::LayoutDirection direction, Qt::Alignment alignment, const QSize &size, const QRect &rect) |
static int | sliderPositionFromValue (int min, int max, int logicalValue, int span, bool upsideDown=false) |
static int | sliderValueFromPosition (int min, int max, int position, int span, bool upsideDown=false) |
static Qt::Alignment | visualAlignment (Qt::LayoutDirection direction, Qt::Alignment alignment) |
static QPoint | visualPos (Qt::LayoutDirection direction, const QRect &boundingRect, const QPoint &logicalPosition) |
static QRect | visualRect (Qt::LayoutDirection direction, const QRect &boundingRect, const QRect &logicalRect) |
Static Public Methods inherited from QObject | |
static bool | connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ()) |
static bool | connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn > | |
static bool | connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T > | |
static bool | connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod) |
static bool | disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod) |
static bool | disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod) |
static bool | disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...)) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod) |
static QMetaObject & | staticMetaObject () |
static QString | tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >()) |
Friends | |
class | QApplication |
class | QProxyStyle |
class | QWidget |
Additional Inherited Members | |
Public Signals inherited from QObject | |
void | destroyed (QObject *obj=nullptr) |
void | objectNameChanged (const QString &objectName) |
Public Slots inherited from QObject | |
void | deleteLater () |
Protected Methods inherited from QObject | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signalMethod) const |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signalMethod) const |
bool | isSignalConnected (const QMetaMethod &signalMethod) const |
int | receivers (const QString &signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Properties inherited from QObject | |
objectName | |
Related Functions inherited from QObject | |
T | qobject_cast (QObject *object) |
QObjectList | |
The QStyle class is an abstract base class that encapsulates the look and feel of a GUI.
CopperSpice contains a set of QStyle subclasses which emulate the styles of the different platforms such as QWindowsStyle, QFusionStyle, QMacStyle, etc. By default these styles are built into CsGui. Styles can also be made available as plugins.
The built in widgets use QStyle to perform nearly all of their drawing, ensuring they look exactly like the equivalent native widgets. The diagram shows a QComboBox in nine different styles.
The style of the entire application can be set using the QApplication::setStyle() function. It can also be specified by the user of the application, using the -style
command-line option:
If no style is specified, CopperSpice will choose the most appropriate style for the user's platform or desktop environment. A style can also be set on an individual widget using the QWidget::setStyle() method.
If you are developing custom widgets and want them to look good on all platforms, you can use QStyle functions to perform parts of the widget drawing, such as drawItemText(), drawItemPixmap(), drawPrimitive(), drawControl(), and drawComplexControl().
Most QStyle draw functions take four arguments:
For example, if you want to draw a focus rectangle on your widget, you can write:
QStyle gets all the information it needs to render the graphical element from QStyleOption. The widget is passed as the last argument in case the style needs it to perform special effects (such as animated default buttons on Mac OS X), but it is not mandatory. In fact, you can use QStyle to draw on any paint device, not just widgets, by setting the QPainter properly.
QStyleOption has various subclasses for the various types of graphical elements that can be drawn. For example, PE_FrameFocusRect expects a QStyleOptionFocusRect argument.
To ensure that drawing operations are as fast as possible, QStyleOption and its subclasses have public data members. See the QStyleOption class documentation for details on how to use it.
For convenience CopperSpice provides the QStylePainter class, which combines a QStyle, a QPainter, and a QWidget. This makes it possible to write the following.
instead of
You can create a custom look and feel for your application by creating a custom style. There are two approaches to creating a custom style. In the static approach, you either choose an existing QStyle class, subclass it, and reimplement virtual functions to provide the custom behavior, or you create an entire QStyle class from scratch. In the dynamic approach, you modify the behavior of your system style at runtime. The static approach is described below. The dynamic approach is described in QProxyStyle.
The first step in the static approach is to pick one of the styles provided by CopperSpice from which you will build your custom style. Your choice of QStyle class will depend on which style resembles your desired style the most. The most general class that you can use as a base is QCommonStyle (not QStyle). This is because CopperSpice requires its styles to be QCommonStyles.
Depending on which parts of the base style you want to change, you must reimplement the functions that are used to draw those parts of the interface. To illustrate this, we will modify the look of the spin box arrows drawn by QWindowsStyle. The arrows are primitive elements that are drawn by the drawPrimitive() function, so we need to reimplement that function. We need the following class declaration:
To draw its up and down arrows, QSpinBox uses the PE_IndicatorSpinUp and PE_IndicatorSpinDown primitive elements. Here is how to reimplement the drawPrimitive() function to draw them differently:
Notice that we do not use the widget
argument, except to pass it on to the QWindowStyle::drawPrimitive() function. As mentioned earlier, the information about what is to be drawn and how it should be drawn is specified by a QStyleOption object, so there is no need to ask the widget.
If you need to use the widget
argument to obtain additional information, be careful to ensure that it is not 0 and that it is of the correct type before using it.
When implementing a custom style, you can not assume that the widget is a QSpinBox just because the enum value is called PE_IndicatorSpinUp or PE_IndicatorSpinDown.
There are several ways of using a custom style. The simplest way is to pass the custom style to the QApplication::setStyle() static function before creating the QApplication object.
You can call QApplication::setStyle() at any time, however by calling it before the constructor, you ensure the user's preference, set using the -style
command-line option, is respected.
A style may be implemented as a plugin. Styles created as plugins are loaded as shared objects at runtime. Refer to Creating Plugins for more information on creating a plugin.
Style plugins should be located in the plugins/styles
directory. To use your new style with an existing application, start the application with the following argument:
Languages written from right to left (such as Arabic and Hebrew) usually also mirror the whole layout of widgets, and require the light to come from the screen's top-right corner instead of top-left.
If you create a custom style, you should take special care when drawing asymmetric elements to make sure that they also look correct in a mirrored layout. An easy way to test your styles is to run applications with the -reverse
command-line option or to call QApplication::setLayoutDirection() in your main()
function.
Here are some things to keep in mind when making a style work well in a right-to-left environment:
The painting of items in views is performed by a delegate. the CopperSpice default delegate, QStyledItemDelegate, is also used for calculating bounding rectangles of items, and their sub-elements for the various kind of item data roles QStyledItemDelegate supports. See the QStyledItemDelegate class description to find out which datatypes and roles are supported. You can read more about item data roles in model-view-architecture-c "Model/View Architecture".
When QStyledItemDelegate paints its items, it draws CE_ItemViewItem, and calculates their size with CT_ItemViewItem. Note also that it uses SE_ItemViewItemText to set the size of editors. When implementing a style to customize drawing of item views, you need to check the implementation of QCommonStyle (and any other subclasses from which your style inherits). This way, you find out which and how other style elements are painted, and you can then reimplement the painting of elements that should be drawn differently.
We include a small example where we customize the drawing of item backgrounds.
The primitive element PE_PanelItemViewItem is responsible for painting the background of items, and is called from QCommonStyle's implementation of CE_ItemViewItem.
To add support for drawing of new datatypes and item data roles, it is necessary to create a custom delegate. But if you only need to support the datatypes implemented by the default delegate, a custom style does not need an accompanying delegate. The QStyledItemDelegate class description gives more information on custom delegates.
The drawing of item view headers is also done by the style, giving control over size of header items and row and column sizes.
Typedef for QFlags<StateFlag> which contains an OR combination of StateFlag values.
Refer to QStyle::StateFlag for the enum documentation.
Typedef for QFlags<SubControl> which contains an OR combination of SubControl values.
Refer to QStyle::SubControl for the enum documentation..
This enum describes the available complex controls. Complex controls have different behavior depending upon where the user clicks on them or which keys are pressed.
Constant | Value | Description |
---|---|---|
QStyle::CC_SpinBox | 0 | Spinbox, like QSpinBox. |
QStyle::CC_ComboBox | 1 | Combobox, like QComboBox. |
QStyle::CC_ScrollBar | 2 | Scroll bar, like QScrollBar. |
QStyle::CC_Slider | 3 | Slider, like QSlider. |
QStyle::CC_ToolButton | 4 | Tool button, like QToolButton. |
QStyle::CC_TitleBar | 5 | Title bar, like those used in QMdiSubWindow. |
QStyle::CC_Dial | 6 | Dial, like QDial. |
QStyle::CC_GroupBox | 7 | Group box, like QGroupBox. |
QStyle::CC_MdiControls | 8 | The minimize, close, and normal button in the menubar for a maximized MDI subwindow. |
QStyle::CC_CustomBase | 0xf0000000 | Base value for custom complex controls. Custom values must be greater than this value. |
enum QStyle::ContentsType |
This enum describes the available contents types. These are used to calculate sizes for the contents of various widgets.
Constant | Value | Description |
---|---|---|
QStyle::CT_CheckBox | 0 | Check box, like QCheckBox |
QStyle::CT_ComboBox | 1 | Combobox, like QComboBox |
QStyle::CT_GroupBox | 2 | Group box, like QGroupBox |
QStyle::CT_HeaderSection | 3 | Header section, like QHeaderView |
QStyle::CT_ItemViewItem | 4 | An item inside an item view |
QStyle::CT_LineEdit | 5 | Line edit, like QLineEdit |
QStyle::CT_MdiControls | 6 | The minimize, normal, and close button in the menu bar for a maximized MDI subwindow |
QStyle::CT_Menu | 7 | Menu, like QMenu |
QStyle::CT_MenuBar | 8 | Menu bar, like QMenuBar |
QStyle::CT_MenuBarItem | 9 | Menu bar item, like the buttons in a QMenuBar |
QStyle::CT_MenuItem | 10 | Menu item, like QMenuItem |
QStyle::CT_ProgressBar | 11 | Progress bar, like QProgressBar |
QStyle::CT_PushButton | 12 | Push button, like QPushButton |
QStyle::CT_RadioButton | 13 | Radio button, like QRadioButton |
QStyle::CT_ScrollBar | 14 | Scroll bar, like QScrollBar. |
QStyle::CT_SizeGrip | 15 | Size grip, like QSizeGrip. |
QStyle::CT_Slider | 16 | Slider, like QSlider. |
QStyle::CT_SpinBox | 17 | Spin box, like QSpinBox. |
QStyle::CT_Splitter | 18 | Splitter, like QSplitter. |
QStyle::CT_TabBarTab | 19 | Tab on a tab bar, like QTabBar. |
QStyle::CT_TabWidget | 20 | Tab widget, like QTabWidget. |
QStyle::CT_ToolButton | 21 | Tool button, like QToolButton. |
QStyle::CT_CustomBase | 0xf0000000 | Base value for custom contents types. Custom values must be greater than this value. |
This enum represents a control element. A control element is a part of a widget that performs some action or displays information to the user.
Constant | Value | Description |
---|---|---|
QStyle::CE_CheckBox | 0 | QCheckBox, draws a PE_IndicatorCheckBox, CE_CheckBoxLabel, and PE_FrameFocusRect. |
QStyle::CE_CheckBoxLabel | 1 | Label (text or pixmap) of a QCheckBox. |
QStyle::CE_ColumnViewGrip | 2 | |
QStyle::CE_ComboBoxLabel | 3 | Label of a non-editable QComboBox. |
QStyle::CE_DockWidgetTitle | 4 | Dock window title. |
QStyle::CE_FocusFrame | 5 | Focus frame that is style controlled. |
QStyle::CE_Header | 6 | Header |
QStyle::CE_HeaderEmptyArea | 7 | Area of a header view where there are no header sections. |
QStyle::CE_HeaderLabel | 8 | Header label. |
QStyle::CE_HeaderSection | 9 | Header section. |
QStyle::CE_ItemViewItem | 10 | Item inside an item view. |
QStyle::CE_MenuBarItem | 11 | Menu item in a QMenuBar. |
QStyle::CE_MenuBarEmptyArea | 12 | Empty area of a QMenuBar. |
QStyle::CE_MenuEmptyArea | 13 | Area in a menu without menu items. |
QStyle::CE_MenuHMargin | 14 | Horizontal extra space on the left/right of a menu. |
QStyle::CE_MenuItem | 15 | Menu item in a QMenu. |
QStyle::CE_MenuTearoff | 16 | Menu item representing the tear off section of a QMenu. |
QStyle::CE_MenuScroller | 17 | Scrolling areas in a QMenu when the style supports scrolling. |
QStyle::CE_MenuVMargin | 18 | The vertical extra space on the top/bottom of a menu. |
QStyle::CE_ProgressBar | 19 | QProgressBar, draws CE_ProgressBarGroove,CE_ProgressBarContents and CE_ProgressBarLabel. |
QStyle::CE_ProgressBarGroove | 20 | Groove for the progress indicator in a QProgressBar. |
QStyle::CE_ProgressBarContents | 21 | Progress indicator of a QProgressBar. |
QStyle::CE_ProgressBarLabel | 22 | Text label of a QProgressBar. |
QStyle::CE_PushButton | 23 | QPushButton, draws CE_PushButtonBevel,CE_PushButtonLabel and PE_FrameFocusRect. |
QStyle::CE_PushButtonBevel | 24 | The bevel and default indicator of a QPushButton. |
QStyle::CE_PushButtonLabel | 25 | Label (icon with text or pixmap) of a QPushButton. |
QStyle::CE_RadioButton | 26 | QRadioButton, draws a PE_IndicatorRadioButton, a CE_RadioButtonLabel, and a PE_FrameFocusRect |
QStyle::CE_RadioButtonLabel | 27 | Label (text or pixmap) of a QRadioButton. |
QStyle::CE_RubberBand | 28 | Rubber band used in for example an icon view. |
QStyle::CE_ScrollBarAddLine | 29 | Scroll bar line increase indicator (scroll down), refer to QScrollBar. |
QStyle::CE_ScrollBarAddPage | 30 | Scroll bar page increase indicator (page down). |
QStyle::CE_ScrollBarFirst | 31 | Scroll bar first line indicator (home). |
QStyle::CE_ScrollBarLast | 32 | Scroll bar last line indicator (end). |
QStyle::CE_ScrollBarSlider | 33 | Scroll bar slider. |
QStyle::CE_ScrollBarSubLine | 34 | Scroll bar line decrease indicator (scroll up). |
QStyle::CE_ScrollBarSubPage | 35 | Scroll bar page decrease indicator (page up). |
QStyle::CE_ShapedFrame | 36 | Frame with the shape specified in the QStyleOptionFrame, refer to QFrame. |
QStyle::CE_SizeGrip | 37 | Window resize handle, refer to QSizeGrip. |
QStyle::CE_Splitter | 38 | Splitter handle, refer to QSplitter. |
QStyle::CE_TabBarTab | 39 | Tab and label within a QTabBar. |
QStyle::CE_TabBarTabShape | 40 | Tab shape within a tab bar. |
QStyle::CE_TabBarTabLabel | 41 | Label within a tab. |
QStyle::CE_ToolBar | 42 | Toolbar like QToolBar. |
QStyle::CE_ToolBoxTab | 43 | Toolbox tab and label within a QToolBox. |
QStyle::CE_ToolBoxTabShape | 44 | Toolbox tab shape. |
QStyle::CE_ToolBoxTabLabel | 45 | Toolbox tab label. |
QStyle::CE_ToolButtonLabel | 46 | Tool button's label. |
QStyle::CE_CustomBase | 0xf0000000 | Base value for custom control elements, custom values must be greater than this value. |
enum QStyle::PixelMetric |
This enum describes the various available pixel metrics. A pixel metric is a style dependent size represented by a single pixel value.
Constant | Value | Description |
---|---|---|
QStyle::PM_ButtonMargin | 0 | Amount of whitespace between push button labels and the frame. |
QStyle::PM_DockWidgetTitleBarButtonMargin | 76 | Amount of whitespace between dock widget's title bar button labels and the frame. |
QStyle::PM_ButtonDefaultIndicator | 1 | Width of the default-button indicator frame. |
QStyle::PM_MenuButtonIndicator | 2 | Width of the menu button indicator proportional to the widget height. |
QStyle::PM_ButtonShiftHorizontal | 3 | Horizontal contents shift of a button when the button is down. |
QStyle::PM_ButtonShiftVertical | 4 | Vertical contents shift of a button when the button is down. |
QStyle::PM_DefaultFrameWidth | 5 | Default frame width (usually 2). |
QStyle::PM_SpinBoxFrameWidth | 6 | Frame width of a spin box, defaults to PM_DefaultFrameWidth. |
QStyle::PM_ComboBoxFrameWidth | 7 | Frame width of a combo box, defaults to PM_DefaultFrameWidth. |
QStyle::PM_MdiSubWindowFrameWidth | 44 | Frame width of an MDI window. |
QStyle::PM_MdiSubWindowMinimizedWidth | 45 | Width of a minimized MDI window. |
QStyle::PM_LayoutLeftMargin | 78 | Default left margin for a QLayout. |
QStyle::PM_LayoutTopMargin | 79 | Default top margin for a QLayout. |
QStyle::PM_LayoutRightMargin | 80 | Default right margin for a QLayout. |
QStyle::PM_LayoutBottomMargin | 81 | Default bottom margin for a QLayout. |
QStyle::PM_LayoutHorizontalSpacing | 82 | Default horizontal spacing for a QLayout. |
QStyle::PM_LayoutVerticalSpacing | 83 | Default vertical spacing for a QLayout. |
QStyle::PM_MaximumDragDistance | 8 | Maximum distance between the mouse and a scrollbar when dragging |
QStyle::PM_ScrollBarExtent | 9 | Width of a vertical scroll bar and the height of a horizontal scroll bar. |
QStyle::PM_ScrollBarSliderMin | 10 | Minimum height or width of a vertical or horizontal scroll bar slider. |
QStyle::PM_SliderThickness | 11 | Total slider thickness. |
QStyle::PM_SliderControlThickness | 12 | Thickness of the slider handle. |
QStyle::PM_SliderLength | 13 | Length of the slider. |
QStyle::PM_SliderTickmarkOffset | 14 | Offset between the tickmarks and the slider. |
QStyle::PM_SliderSpaceAvailable | 15 | Available space for the slider to move. |
QStyle::PM_DockWidgetSeparatorExtent | 16 | Width or height of a separator in a horizontal or vertical dock window |
QStyle::PM_DockWidgetHandleExtent | 17 | Width or height of the handle in a horizontal or vertical dock window |
QStyle::PM_DockWidgetFrameWidth | 18 | Frame width of a dock window. |
QStyle::PM_DockWidgetTitleMargin | 73 | Margin of the dock window title. |
QStyle::PM_MenuBarPanelWidth | 33 | Frame width of a menu bar, defaults to PM_DefaultFrameWidth. |
QStyle::PM_MenuBarItemSpacing | 34 | Spacing between menu bar items. |
QStyle::PM_MenuBarHMargin | 36 | Spacing between menu bar items and left/right of bar. |
QStyle::PM_MenuBarVMargin | 35 | Spacing between menu bar items and top/bottom of bar. |
QStyle::PM_ToolBarFrameWidth | 52 | Width of the frame around toolbars. |
QStyle::PM_ToolBarHandleExtent | 53 | Width or height of a toolbar handle in a horizontal or vertical toolbar |
QStyle::PM_ToolBarItemSpacing | 54 | Spacing between toolbar items. |
QStyle::PM_ToolBarItemMargin | 55 | Spacing between the toolbar frame and the items. |
QStyle::PM_ToolBarSeparatorExtent | 56 | Width or height of a toolbar separator in a horizontal or vertical toolbar |
QStyle::PM_ToolBarExtensionExtent | 57 | Width or height of a toolbar extension button in a horizontal or vertical toolbar |
QStyle::PM_TabBarTabOverlap | 19 | Number of pixels the tabs should overlap. Only used in styles, not inside of QTabBar |
QStyle::PM_TabBarTabHSpace | 20 | Extra space added to the tab width. |
QStyle::PM_TabBarTabVSpace | 21 | Extra space added to the tab height. |
QStyle::PM_TabBarBaseHeight | 22 | Height of the area between the tab bar and the tab pages. |
QStyle::PM_TabBarBaseOverlap | 23 | Number of pixels the tab bar overlaps the tab bar base. |
QStyle::PM_TabBarScrollButtonWidth | 51 | |
QStyle::PM_TabBarTabShiftHorizontal | 49 | Horizontal pixel shift when a tab is selected. |
QStyle::PM_TabBarTabShiftVertical | 50 | Vertical pixel shift when a tab is selected. |
QStyle::PM_ProgressBarChunkWidth | 24 | Width of a chunk in a progress bar indicator. |
QStyle::PM_SplitterWidth | 25 | Width of a splitter. |
QStyle::PM_TitleBarHeight | 26 | Height of the title bar. |
QStyle::PM_IndicatorWidth | 37 | Width of a check box indicator. |
QStyle::PM_IndicatorHeight | 38 | Height of a checkbox indicator. |
QStyle::PM_ExclusiveIndicatorWidth | 39 | Width of a radio button indicator. |
QStyle::PM_ExclusiveIndicatorHeight | 40 | Height of a radio button indicator |
QStyle::PM_DialogButtonsSeparator | 41 | Distance between buttons in a dialog buttons widget |
QStyle::PM_DialogButtonsButtonWidth | 42 | Minimum width of a button in a dialog buttons widget |
QStyle::PM_DialogButtonsButtonHeight | 43 | Minimum height of a button in a dialog buttons widget |
QStyle::PM_MenuPanelWidth | 30 | Border width (applied on all sides) for a QMenu. |
QStyle::PM_MenuHMargin | 28 | Additional border (used on left and right) for a QMenu. |
QStyle::PM_MenuVMargin | 29 | Additional border (used for bottom and top) for a QMenu. |
QStyle::PM_MenuScrollerHeight | 27 | Height of the scroller area in a QMenu. |
QStyle::PM_MenuTearoffHeight | 31 | Height of a tear off area in a QMenu. |
QStyle::PM_MenuDesktopFrameWidth | 32 | Frame width for the menu on the desktop. |
QStyle::PM_HeaderMarkSize | 47 | Size of the sort indicator in a header. |
QStyle::PM_HeaderGripMargin | 48 | Size of the resize grip in a header. |
QStyle::PM_HeaderMargin | 46 | The size of the margin between the sort indicator and the text. |
QStyle::PM_SpinBoxSliderHeight | 58 | Height of the optional spin box slider. |
QStyle::PM_ToolBarIconSize | 62 | Default toolbar icon size |
QStyle::PM_SmallIconSize | 65 | Default small icon size |
QStyle::PM_LargeIconSize | 66 | Default large icon size |
QStyle::PM_FocusFrameHMargin | 68 | Horizontal margin that the focus frame will outset the widget by. |
QStyle::PM_FocusFrameVMargin | 67 | Vertical margin that the focus frame will outset the widget by. |
QStyle::PM_IconViewIconSize | 64 | Default size for icons in an icon view. |
QStyle::PM_ListViewIconSize | 63 | Default size for icons in a list view. |
QStyle::PM_ToolTipLabelFrameWidth | 69 | Frame width for a tool tip label. |
QStyle::PM_CheckBoxLabelSpacing | 70 | Spacing between a check box indicator and its label. |
QStyle::PM_RadioButtonLabelSpacing | 77 | Spacing between a radio button indicator and its label. |
QStyle::PM_TabBarIconSize | 71 | Default icon size for a tab bar. |
QStyle::PM_SizeGripSize | 72 | Size of a size grip. |
QStyle::PM_MessageBoxIconSize | 74 | Size of the standard icons in a message box |
QStyle::PM_ButtonIconSize | 75 | Default size of button icons |
QStyle::PM_TextCursorWidth | 85 | Width of the cursor in a line edit or text edit |
QStyle::PM_TabBar_ScrollButtonOverlap | 84 | The distance between the left and right buttons in a tab bar. |
QStyle::PM_TabCloseIndicatorWidth | 86 | The default width of a close button on a tab in a tab bar |
QStyle::PM_TabCloseIndicatorHeight | 87 | The default height of a close button on a tab in a tab bar |
QStyle::PM_ScrollView_ScrollBarSpacing | 88 | Distance between frame and scrollbar with SH_ScrollView_FrameOnlyAroundContents set |
QStyle::PM_ScrollView_ScrollBarOverlap | 89 | Overlap between scroll bars and scroll content |
QStyle::PM_SubMenuOverlap | 90 | Horizontal overlap between a submenu and its parent |
QStyle::PM_TreeViewIndentation | 91 | Indentation of items in a tree view |
QStyle::PM_HeaderDefaultSectionSizeHorizontal | 92 | Default size of sections in a horizontal header |
QStyle::PM_HeaderDefaultSectionSizeVertical | 93 | Default size of sections in a vertical header |
QStyle::PM_CustomBase | 0xf0000000 | Base value for custom pixel metrics. Custom values must be greater than this value. |
The following values are obsolete:
Constant | Value | Description |
---|---|---|
QStyle::PM_MDIFrameWidth | 44 | Replace with PM_MdiSubWindowFrameWidth |
QStyle::PM_MDIMinimizedWidth | 45 | Replace with PM_MdiSubWindowMinimizedWidth |
QStyle::PM_DefaultTopLevelMargin | 59 | Use PM_LayoutLeftMargin, PM_LayoutTopMargin, PM_LayoutRightMargin, and PM_LayoutBottomMargin |
QStyle::PM_DefaultChildMargin | 60 | Use PM_LayoutLeftMargin, PM_LayoutTopMargin, PM_LayoutRightMargin, and PM_LayoutBottomMargin |
QStyle::PM_DefaultLayoutSpacing | 61 | Use PM_LayoutHorizontalSpacing and PM_LayoutVerticalSpacing |
This enum describes the various primitive elements. A primitive element is a common GUI element, such as a checkbox indicator or button bevel.
Constant | Value | Description |
---|---|---|
QStyle::PE_Frame | 0 | Generic frame |
QStyle::PE_FrameDefaultButton | 1 | Frame around a default button, for example in a dialog. |
QStyle::PE_FrameDockWidget | 2 | Panel frame for dock windows and toolbars. |
QStyle::PE_FrameFocusRect | 3 | Generic focus indicator. |
QStyle::PE_FrameGroupBox | 4 | Panel frame around group boxes. |
QStyle::PE_FrameLineEdit | 5 | Panel frame for line edits. |
QStyle::PE_FrameMenu | 6 | Frame for popup windows/menus, refer to QMenu. |
QStyle::PE_FrameStatusBarItem | 7 | Frame for an item of a status bar, refer to QStatusBar. |
QStyle::PE_FrameTabWidget | 8 | Frame for tab widgets. |
QStyle::PE_FrameWindow | 9 | Frame around a MDI window or a docking window. |
QStyle::PE_FrameButtonBevel | 10 | Panel frame for a button bevel. |
QStyle::PE_FrameButtonTool | 11 | Panel frame for a tool button. |
QStyle::PE_PanelButtonCommand | 13 | Button used to initiate an action, for example, a QPushButton. |
QStyle::PE_PanelButtonBevel | 14 | Generic panel with a button bevel. |
QStyle::PE_PanelButtonTool | 15 | Panel for a Tool button, used with QToolButton. |
QStyle::PE_PanelLineEdit | 18 | Panel for a QLineEdit. |
QStyle::PE_IndicatorButtonDropDown | 24 | Indicator for a drop down button, for example, a tool button that displays a menu. |
QStyle::PE_IndicatorArrowDown | 19 | Generic Down arrow. |
QStyle::PE_IndicatorArrowLeft | 20 | Generic Left arrow. |
QStyle::PE_IndicatorArrowRight | 21 | Generic Right arrow. |
QStyle::PE_IndicatorArrowUp | 22 | Generic Up arrow. |
QStyle::PE_IndicatorSpinUp | 35 | Up symbol for a spin widget, for example a QSpinBox. |
QStyle::PE_IndicatorSpinDown | 32 | Down symbol for a spin widget. |
QStyle::PE_IndicatorSpinPlus | 34 | Increase symbol for a spin widget. |
QStyle::PE_IndicatorSpinMinus | 33 | Decrease symbol for a spin widget. |
QStyle::PE_IndicatorViewItemCheck | Obsolete | Use QStyle::PE_IndicatorItemViewItemCheck |
QStyle::PE_IndicatorItemViewItemCheck | 25 | On/off indicator for a view item. |
QStyle::PE_IndicatorCheckBox | 26 | On/off indicator, for example, a QCheckBox. |
QStyle::PE_IndicatorRadioButton | 31 | Exclusive on/off indicator, for example, a QRadioButton. |
QStyle::PE_IndicatorDockWidgetResizeHandle | 27 | Resize handle for dock windows. |
QStyle::PE_PanelMenuBar | 16 | Panel for menu bars. |
QStyle::PE_PanelScrollAreaCorner | 40 | Panel at the bottom-right (or bottom-left) corner of a scroll area. |
QStyle::PE_IndicatorHeaderArrow | 28 | Arrow used to indicate sorting on a list or table header. |
QStyle::PE_IndicatorMenuCheckMark | 29 | Check mark used in a menu. |
QStyle::PE_IndicatorProgressChunk | 30 | Section of a progress bar indicator, refer to QProgressBar. |
QStyle::PE_IndicatorBranch | 23 | Lines used to represent the branch of a tree in a tree view. |
QStyle::PE_IndicatorToolBarHandle | 36 | The handle of a toolbar. |
QStyle::PE_IndicatorToolBarSeparator | 37 | The separator in a toolbar. |
QStyle::PE_PanelToolBar | 17 | The panel for a toolbar. |
QStyle::PE_PanelTipLabel | 38 | The panel for a tip label. |
QStyle::PE_FrameTabBarBase | 12 | The frame that is drawn for a tab bar, usually drawn for a tab bar that is not part of a tab widget. |
QStyle::PE_IndicatorTabTear | 39 | Indicates a tab is partially out of the visible tab bar |
QStyle::PE_IndicatorColumnViewArrow | 42 | An arrow in a QColumnView. |
QStyle::PE_Widget | 41 | A plain QWidget. |
QStyle::PE_IndicatorItemViewItemDrop | 43 | An indicator that is drawn to show where an item in an item view is about to be dropped during a drag-and-drop operation in an item view. |
QStyle::PE_PanelItemViewItem | 44 | The background for an item in an item view. |
QStyle::PE_PanelItemViewRow | 45 | The background of a row in an item view. |
QStyle::PE_PanelStatusBar | 46 | The panel for a status bar. |
QStyle::PE_IndicatorTabClose | 47 | The close button on a tab bar. |
QStyle::PE_PanelMenu | 48 | The panel for a menu. |
QStyle::PE_CustomBase | 0xf000000 | Base value for custom primitive elements. All values above this are reserved for custom use. Custom values must be greater than this value. |
This enum describes under what circumstances a software input panel will be requested by input capable widgets.
Constant | Value | Description |
---|---|---|
QStyle::RSIP_OnMouseClickAndAlreadyFocused | 0 | Requests an input panel if the user clicks on the widget, but only if it is already focused. |
QStyle::RSIP_OnMouseClick | 1 | Requests an input panel if the user clicks on the widget. |
This enum describes the available standard pixmaps. A standard pixmap is a pixmap that can follow some existing GUI style or guideline.
Constant | Value | Description |
---|---|---|
QStyle::SP_TitleBarMinButton | 0 | Minimize button on title bars (refer to QMdiSubWindow). |
QStyle::SP_TitleBarMenuButton | 1 | Menu button on a title bar. |
QStyle::SP_TitleBarMaxButton | 2 | Maximize button on title bars. |
QStyle::SP_TitleBarCloseButton | 3 | Close button on title bars. |
QStyle::SP_TitleBarNormalButton | 4 | Normal (restore) button on title bars. |
QStyle::SP_TitleBarShadeButton | 5 | Shade button on title bars. |
QStyle::SP_TitleBarUnshadeButton | 6 | Unshade button on title bars. |
QStyle::SP_TitleBarContextHelpButton | 7 | Context help button on title bars |
QStyle::SP_MessageBoxInformation | 9 | Information icon |
QStyle::SP_MessageBoxWarning | 10 | Warning icon |
QStyle::SP_MessageBoxCritical | 11 | Critical icon |
QStyle::SP_MessageBoxQuestion | 12 | Question icon |
QStyle::SP_DesktopIcon | 13 | Desktop icon |
QStyle::SP_TrashIcon | 14 | Trash icon |
QStyle::SP_ComputerIcon | 15 | My Computer icon |
QStyle::SP_DriveFDIcon | 16 | Floppy icon |
QStyle::SP_DriveHDIcon | 17 | Hard drive icon |
QStyle::SP_DriveCDIcon | 18 | CD icon |
QStyle::SP_DriveDVDIcon | 19 | DVD icon |
QStyle::SP_DriveNetIcon | 20 | Network icon |
QStyle::SP_DirHomeIcon | 56 | Home director icon |
QStyle::SP_DirHomeIcon | 56 | Home directory icon |
QStyle::SP_DirOpenIcon | 21 | Open directory icon |
QStyle::SP_DirClosedIcon | 22 | Closed directory icon |
QStyle::SP_DirIcon | 38 | Directory icon |
QStyle::SP_DirLinkIcon | 23 | Link to directory icon |
QStyle::SP_DirLinkOpenIcon | 24 | Link to open directory icon |
QStyle::SP_FileIcon | 25 | File icon |
QStyle::SP_FileLinkIcon | 26 | Link to file icon |
QStyle::SP_FileDialogStart | 29 | Start icon in a file dialog. |
QStyle::SP_FileDialogEnd | 30 | End icon in a file dialog. |
QStyle::SP_FileDialogToParent | 31 | Parent directory icon in a file dialog. |
QStyle::SP_FileDialogNewFolder | 32 | Create new folder icon in a file dialog. |
QStyle::SP_FileDialogDetailedView | 33 | Detailed view icon in a file dialog. |
QStyle::SP_FileDialogInfoView | 34 | File info icon in a file dialog. |
QStyle::SP_FileDialogContentsView | 35 | Contents view icon in a file dialog. |
QStyle::SP_FileDialogListView | 36 | List view icon in a file dialog. |
QStyle::SP_FileDialogBack | 37 | Back arrow in a file dialog. |
QStyle::SP_DockWidgetCloseButton | 8 | Close button on dock windows (refer to QDockWidget) |
QStyle::SP_ToolBarHorizontalExtensionButton | 27 | Extension button for horizontal toolbars. |
QStyle::SP_ToolBarVerticalExtensionButton | 28 | Extension button for vertical toolbars. |
QStyle::SP_DialogOkButton | 39 | Icon for a standard OK button in a QDialogButtonBox. |
QStyle::SP_DialogCancelButton | 40 | Icon for a standard Cancel button in a QDialogButtonBox. |
QStyle::SP_DialogHelpButton | 41 | Icon for a standard Help button in a QDialogButtonBox. |
QStyle::SP_DialogOpenButton | 42 | Icon for a standard Open button in a QDialogButtonBox. |
QStyle::SP_DialogSaveButton | 43 | Icon for a standard Save button in a QDialogButtonBox. |
QStyle::SP_DialogCloseButton | 44 | Icon for a standard Close button in a QDialogButtonBox. |
QStyle::SP_DialogApplyButton | 45 | Icon for a standard Apply button in a QDialogButtonBox. |
QStyle::SP_DialogResetButton | 46 | Icon for a standard Reset button in a QDialogButtonBox. |
QStyle::SP_DialogDiscardButton | 47 | Icon for a standard Discard button in a QDialogButtonBox. |
QStyle::SP_DialogYesButton | 48 | Icon for a standard Yes button in a QDialogButtonBox. |
QStyle::SP_DialogNoButton | 49 | Icon for a standard No button in a QDialogButtonBox. |
QStyle::SP_ArrowUp | 50 | Icon arrow pointing up. |
QStyle::SP_ArrowDown | 51 | Icon arrow pointing down. |
QStyle::SP_ArrowLeft | 52 | Icon arrow pointing left. |
QStyle::SP_ArrowRight | 53 | Icon arrow pointing right. |
QStyle::SP_ArrowBack | 54 | Equivalent to SP_ArrowLeft when the current layout direction is Qt::LeftToRight, otherwise SP_ArrowRight. |
QStyle::SP_ArrowForward | 55 | Equivalent to SP_ArrowRight when the current layout direction is Qt::LeftToRight, otherwise SP_ArrowLeft. |
QStyle::SP_CommandLink | 57 | Icon used to indicate a Vista style command link glyph |
QStyle::SP_VistaShield | 58 | Icon used to indicate UAC prompts on Windows Vista. Returns null pixmap or icon on all other platforms |
QStyle::SP_BrowserReload | 59 | Icon indicating that the current page should be reloaded. |
QStyle::SP_BrowserStop | 60 | Icon indicating that the page loading should stop. |
QStyle::SP_MediaPlay | 61 | Icon indicating that media should begin playback. |
QStyle::SP_MediaStop | 62 | Icon indicating that media should stop playback. |
QStyle::SP_MediaPause | 63 | Icon indicating that media should pause playback. |
QStyle::SP_MediaSkipForward | 64 | Icon indicating that media should skip forward. |
QStyle::SP_MediaSkipBackward | 65 | Icon indicating that media should skip backward. |
QStyle::SP_MediaSeekForward | 66 | Icon indicating that media should seek forward. |
QStyle::SP_MediaSeekBackward | 67 | Icon indicating that media should seek backward. |
QStyle::SP_MediaVolume | 68 | Icon indicating a volume control. |
QStyle::SP_MediaVolumeMuted | 69 | Icon indicating a muted volume control. |
QStyle::SP_LineEditClearButton | 70 | Icon for a standard clear button in a QLineEdit |
QStyle::SP_CustomBase | 0xf0000000 | Base value for custom standard pixmaps; custom values must be greater than this value. |
enum QStyle::StateFlag |
This enum describes flags that are used when drawing primitive elements. Not all primitives use all of these flags and the flags may mean different things to different items.
Constant | Value | Description |
---|---|---|
QStyle::State_None | 0x00000000 | Indicates widget does not have a state. |
QStyle::State_Active | 0x00010000 | Indicates the widget is active. |
QStyle::State_AutoRaise | 0x00001000 | Indicates if auto-raise appearance should be used on a tool button. |
QStyle::State_Children | 0x00080000 | Indicates if an item view branch has children. |
QStyle::State_DownArrow | 0x00000040 | Indicates if a down arrow should be visible on the widget. |
QStyle::State_Editing | 0x00400000 | Indicates if an editor is opened on the widget. |
QStyle::State_Enabled | 0x00000001 | Indicates if the widget is enabled. |
QStyle::State_HasEditFocus | 0x01000000 | Indicates if the widget currently has edit focus. |
QStyle::State_HasFocus | 0x00000100 | Indicates if the widget has focus. |
QStyle::State_Horizontal | 0x00000080 | Indicates if the widget is laid out horizontally, for example. a toolbar. |
QStyle::State_Item | 0x00100000 | Used by item views to indicate if a horizontal branch should be drawn. |
QStyle::State_KeyboardFocusChange | 0x00800000 | Indicates if the focus was changed with the keyboard, for example in a tab, backtab or shortcut. |
QStyle::State_Mini | 0x08000000 | Indicates a mini style Mac widget or button. |
QStyle::State_MouseOver | 0x00002000 | Used to indicate if the widget is under the mouse. |
QStyle::State_NoChange | 0x00000010 | Used to indicate a tri-state checkbox. |
QStyle::State_Off | 0x00000008 | Used to indicate if the widget is not checked. |
QStyle::State_On | 0x00000020 | Used to indicate if the widget is checked. |
QStyle::State_Raised | 0x00000002 | Used to indicate if a button is raised. |
QStyle::State_ReadOnly | 0x02000000 | Used to indicate if a widget is read-only. |
QStyle::State_Selected | 0x00008000 | Used to indicate if a widget is selected. |
QStyle::State_Small | 0x04000000 | Used to indicate a small style Mac widget or button. |
QStyle::State_Open | 0x00040000 | Used by item views to indicate if the tree branch is open. |
QStyle::State_Sibling | 0x00200000 | Used by item views to indicate if a vertical line needs to be drawn (for siblings). |
QStyle::State_Sunken | 0x00000004 | Used to indicate if the widget is sunken or pressed. |
QStyle::State_UpArrow | 0x00004000 | Used to indicate if an up arrow should be visible on the widget. |
enum QStyle::StyleHint |
This enum describes the available style hints. A style hint is a general look and/or feel hint.
Constant | Value | Description | |
---|---|---|---|
QStyle::SH_EtchDisabledText | 0 | Disabled text is "etched" as it is on Windows. | |
QStyle::SH_DitherDisabledText | 1 | Disabled text is dithered. | |
QStyle::SH_ScrollBar_ContextMenu | 62 | Whether or not a scroll bar has a context menu. | |
QStyle::SH_ScrollBar_MiddleClickAbsolutePosition | 2 | Boolean value. If true, middle clicking on a scroll bar causes the slider to jump to that position. If false, middle clicking is ignored. | |
QStyle::SH_ScrollBar_LeftClickAbsolutePosition | 39 | Boolean value. If true, left clicking on a scroll bar causes the slider to jump to that position. If false, left clicking will behave as appropriate for each control. | |
QStyle::SH_ScrollBar_ScrollWhenPointerLeavesControl | 3 | Boolean value. If true, when clicking a scroll bar SubControl, holding the mouse button down and moving the pointer outside the SubControl, the scroll bar continues to scroll. If false, the scrollbar stops scrolling when the pointer leaves the SubControl. | |
QStyle::SH_ScrollBar_RollBetweenButtons | 63 | Boolean value. If true, when clicking a scroll bar button (SC_ScrollBarAddLine or SC_ScrollBarSubLine) and dragging over to the opposite button (rolling) will press the new button and release the old one. When it is false the original button is released and nothing happens (like a push button). | |
QStyle::SH_TabBar_Alignment | 5 | Alignment for tabs in a QTabWidget. Possible values are Qt::AlignLeft, Qt::AlignCenter and Qt::AlignRight. | |
QStyle::SH_Header_ArrowAlignment | 6 | Placement of the sorting indicator may appear in list or table headers. Possible values are Qt::Left or Qt::Right. | |
QStyle::SH_Slider_SnapToValue | 7 | Sliders snap to values while moving, as they do on Windows. | |
QStyle::SH_Slider_SloppyKeyEvents | 8 | Key presses handled in what is called a sloppy manner | |
QStyle::SH_ProgressDialog_CenterCancelButton | 9 | Center button on progress dialogs, otherwise right aligned. | |
QStyle::SH_ProgressDialog_TextLabelAlignment | 10 | Alignment for text labels in progress dialogs; Qt::AlignCenter on Windows, Qt::AlignVCenter otherwise. | |
QStyle::SH_PrintDialog_RightAlignButtons | 11 | Right align buttons in the print dialog, as done on Windows. | |
QStyle::SH_MainWindow_SpaceBelowMenuBar | 12 | One or two pixel space between the menu bar and the dockarea | |
QStyle::SH_FontDialog_SelectAssociatedText | 13 | 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_KeyboardSearch | 66 | Typing will search a menu for relevant items, otherwise only shortcut is considered | |
QStyle::SH_Menu_AllowActiveAndDisabled | 14 | Allows disabled menu items to be active. | |
QStyle::SH_Menu_SpaceActivatesItem | 15 | Pressing the space bar activates the item | |
QStyle::SH_Menu_SubMenuPopupDelay | 16 | Number of milliseconds to wait before opening a submenu (256 on Windows) | |
QStyle::SH_Menu_Scrollable | 30 | Should popup menus must support scrolling. | |
QStyle::SH_Menu_SloppySubMenus | 33 | Should popup menus support the user moving the mouse cursor to a submenu while crossing other items of the menu | |
QStyle::SH_Menu_SubMenuUniDirection | 106 | If the cursor has to move towards the submenu (like it is on macOS), or if the cursor can move in any direction as long as it reaches the submenu before the sloppy timeout. | |
QStyle::SH_Menu_SubMenuUniDirectionFailCount | 107 | When SH_Menu_SubMenuUniDirection is defined this enum defines the number of failed mouse moves before the sloppy submenu is discarded. This can be used to control the "strictness" of the uni direction algorithm. | |
QStyle::SH_Menu_SubMenuSloppySelectOtherActions | 108 | Should other action items be selected when the mouse moves towards a sloppy submenu. | |
QStyle::SH_Menu_SubMenuSloppyCloseTimeout | 109 | The timeout used to close sloppy submenus. | |
QStyle::SH_Menu_SubMenuResetWhenReenteringParent | 110 | When entering parent from child submenu, should the sloppy state be reset, effectively closing the child and making the current submenu active. | |
QStyle::SH_Menu_SubMenuDontStartSloppyOnLeave | 111 | Do not start sloppy timers when the mouse leaves a sub-menu. | |
QStyle::SH_ScrollView_FrameOnlyAroundContents | 17 | Should scrollviews draw their frame only around the contents or around everything | |
QStyle::SH_MenuBar_AltKeyNavigation | 18 | Navigate menu bars by pressing Alt followed by using the arrow keys | |
QStyle::SH_ComboBox_ListMouseTracking | 19 | Mouse tracking in combobox drop-down lists. | |
QStyle::SH_Menu_MouseTracking | 20 | Mouse tracking in popup menus. | |
QStyle::SH_MenuBar_MouseTracking | 21 | Mouse tracking in menu bars. | |
QStyle::SH_Menu_FillScreenWithScroll | 45 | Should scrolling popups fill the screen as they are scrolled. | |
QStyle::SH_Menu_SelectionWrap | 74 | Should popups should allow selections to wrap from the last item back to the first item | |
QStyle::SH_ItemView_ChangeHighlightOnFocus | 22 | Gray out selected items when losing focus. | |
QStyle::SH_Widget_ShareActivation | 23 | Turn on sharing activation with floating modeless dialogs. | |
QStyle::SH_TabBar_SelectMouseType | 4 | Which type of mouse event should cause a tab to be selected. | |
QStyle::SH_ListViewExpand_SelectMouseType | 40 | Which type of mouse event should cause a list view expansion to be selected. | |
QStyle::SH_TabBar_PreferNoArrows | 38 | Whether a tab bar should suggest a size to prevent scroll arrows. | |
QStyle::SH_ComboBox_Popup | 25 | Allows popups as a combobox drop-down menu. | |
QStyle::SH_Workspace_FillSpaceOnMaximize | 24 | Workspace should maximize the client area. | |
QStyle::SH_TitleBar_NoBorder | 26 | Title bar has no border. | |
QStyle::SH_ScrollBar_StopMouseOverSlider | Obsolete | Use SH_Slider_StopMouseOverSlider instead. | |
QStyle::SH_Slider_StopMouseOverSlider | 27 | Stops auto-repeat when the slider reaches the mouse position. | |
QStyle::SH_BlinkCursorWhenTextSelected | 28 | Whether cursor should blink when text is selected. | |
QStyle::SH_RichText_FullWidthSelection | 29 | Whether richtext selections should extend to the full width of the document. | |
QStyle::SH_GroupBox_TextLabelVerticalAlignment | 31 | How to vertically align a group box's text label. | |
QStyle::SH_GroupBox_TextLabelColor | 32 | How to paint a group box's text label. | |
QStyle::SH_DialogButtons_DefaultButton | 36 | Which button gets the default status in a dialog's button widget. | |
QStyle::SH_ToolBox_SelectedPageTitleBold | 37 | Boldness of the selected page title in a QToolBox. | |
QStyle::SH_LineEdit_PasswordCharacter | 35 | Unicode character to be used for passwords | |
QStyle::SH_LineEdit_PasswordMaskDelay | 104 | Determines the delay (in milliseconds) before visible characters are masked in a password edit | |
QStyle::SH_Table_GridLineColor | 34 | RGB value of the grid for a table. | |
QStyle::SH_UnderlineShortcut | 41 | Whether shortcuts are underlined. | |
QStyle::SH_SpellCheckUnderlineStyle | 72 | A QTextCharFormat::UnderlineStyle value that specifies the way misspelled words should be underlined. | |
QStyle::SH_SpinBox_AnimateButton | 42 | Animate a click when up or down is pressed in a spin box. | |
QStyle::SH_SpinBox_KeyPressAutoRepeatRate | 43 | Auto-repeat interval for spinbox key presses. | |
QStyle::SH_SpinBox_ClickAutoRepeatRate | 44 | Auto-repeat interval for spinbox mouse clicks. | |
QStyle::SH_SpinBox_ClickAutoRepeatThreshold | 84 | Auto-repeat threshold for spinbox mouse clicks. | |
QStyle::SH_ToolTipLabel_Opacity | 46 | Integer indicating the opacity for the tip label, 0 is transparent and 255 is opaque | |
QStyle::SH_DrawMenuBarSeparator | 47 | Indicates whether or not the menu bar draws separators. | |
QStyle::SH_TitleBar_ModifyNotification | 48 | Indicates if the title bar should show a '*' for windows that are modified. | |
QStyle::SH_Button_FocusPolicy | 49 | Default focus policy for buttons. | |
QStyle::SH_MessageBox_UseBorderForButtonSpacing | 50 | Boolean indicating whether to use the border of the buttons for the spacing of the button in a message box | |
QStyle::SH_MessageBox_CenterButtons | 73 | Boolean indicating whether the buttons in the message box should be centered or not | |
QStyle::SH_MessageBox_TextInteractionFlags | 70 | Boolean indicating if the text in a message box should allow user interactions | |
QStyle::SH_TitleBar_AutoRaise | 51 | Boolean indicating whether controls on a title bar should update on a mouse over | |
QStyle::SH_ToolButton_PopupDelay | 52 | Integer indicating the popup delay in milliseconds for menus attached to tool buttons. | |
QStyle::SH_FocusFrame_Mask | 53 | Mask of the focus frame. | |
QStyle::SH_RubberBand_Mask | 54 | Mask of the rubber band. | |
QStyle::SH_WindowFrame_Mask | 55 | Mask of the window frame. | |
QStyle::SH_SpinControls_DisableOnBounds | 56 | Determines if the spin controls will shown as disabled when reaching the spin range boundary. | |
QStyle::SH_Dial_BackgroundRole | 57 | Defines the style's preferred background role (as QPalette::ColorRole) for a dial widget. | |
QStyle::SH_ComboBox_LayoutDirection | 58 | Layout direction for the combo box. By default it should be the same as indicated by the QStyleOption::direction variable. | |
QStyle::SH_ItemView_EllipsisLocation | 59 | Location where ellipses should be added for item text that is too long to fit in an view item. | |
QStyle::SH_ItemView_ShowDecorationSelected | 60 | When an item in an item view is selected, also highlight the branch or other decoration. | |
QStyle::SH_ItemView_ActivateItemOnSingleClick | 61 | Emit the activated signal when the user single clicks on an item in an item in an item view. Otherwise the signal is emitted when the user double clicks on an item. | |
QStyle::SH_Slider_AbsoluteSetButtons | 64 | Which mouse buttons cause a slider to set the value to the position clicked on. | |
QStyle::SH_Slider_PageSetButtons | 65 | Which mouse buttons cause a slider to page step the value. | |
QStyle::SH_TabBar_ElideMode | 67 | Default eliding style for a tab bar. | |
QStyle::SH_DialogButtonLayout | 68 | Controls how buttons are laid out in a QDialogButtonBox, returns a QDialogButtonBox::ButtonLayout enum. | |
QStyle::SH_WizardStyle | 79 | Controls the look and feel of a QWizard. Returns a QWizard::WizardStyle enum. | |
QStyle::SH_FormLayoutWrapPolicy | 86 | Provides a default for how rows are wrapped in a QFormLayout. Returns a QFormLayout::RowWrapPolicy enum. | |
QStyle::SH_FormLayoutFieldGrowthPolicy | 89 | Provides a default for how fields can grow in a QFormLayout. Returns a QFormLayout::FieldGrowthPolicy enum. | |
QStyle::SH_FormLayoutFormAlignment | 90 | Provides a default for how a QFormLayout aligns its contents within the available space. Returns a Qt::Alignment enum. | |
QStyle::SH_FormLayoutLabelAlignment | 91 | Provides a default for how a QFormLayout aligns labels within the available space. Returns a Qt::Alignment> enum. | |
QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren | 80 | Controls whether the tree view will select the first child when it is expanded and the right arrow key is pressed. | |
QStyle::SH_ComboBox_PopupFrameStyle | 69 | Frame style used when drawing a combobox popup menu. | |
QStyle::SH_DialogButtonBox_ButtonsHaveIcons | 71 | Indicates whether or not StandardButtons in QDialogButtonBox should have icons or not. | |
QStyle::SH_ItemView_MovementWithoutUpdatingSelection | 75 | Item view is able to indicate a current item without changing the selection. | |
QStyle::SH_ToolTip_Mask | 76 | Mask of a tool tip. | |
QStyle::SH_FocusFrame_AboveWidget | 77 | FocusFrame is stacked above the widget that it is "focusing on" | |
QStyle::SH_TextControl_FocusIndicatorTextCharFormat | 78 | Specifies the text format used to highlight focused anchors in rich text documents. Format must be QTextCharFormat, returned in the variant of the QStyleHintReturnVariant return value. The QTextFormat::OutlinePen property is used for the outline and QTextFormat::BackgroundBrush for the background of the highlighted area. | |
QStyle::SH_Menu_FlashTriggeredItem | 82 | Flash triggered item. | |
QStyle::SH_Menu_FadeOutOnHide | 83 | Fade out the menu instead of hiding it immediately. | |
QStyle::SH_TabWidget_DefaultTabPosition | 87 | Default position of the tab bar in a tab widget. | |
QStyle::SH_ToolBar_Movable | 88 | Determines if the toolbar is movable by default. | |
QStyle::SH_ItemView_PaintAlternatingRowColorsForEmptyArea | 85 | Whether QTreeView paints alternating row colors for the area that does not have any items. | |
QStyle::SH_Menu_Mask | 81 | The mask for a popup menu. | |
QStyle::SH_ItemView_DrawDelegateFrame | 92 | Determines if there should be a frame for a delegate widget. | |
QStyle::SH_TabBar_CloseButtonPosition | 93 | Determines the position of the close button on a tab in a tab bar. | |
QStyle::SH_DockWidget_ButtonsHaveFrame | 94 | Determines if dockwidget buttons should have frames, default is true. | |
QStyle::SH_ToolButtonStyle | 95 | Determines the default system style for tool buttons that uses Qt::ToolButtonFollowStyle. | |
QStyle::SH_RequestSoftwareInputPanel | 96 | Determines when a software input panel should be requested by input widgets. Returns an enum of type QStyle::RequestSoftwareInputPanel. | |
QStyle::SH_ScrollBar_Transient | 97 | Determines if the style supports transient scroll bars. Transient scroll bars appear when the content is scrolled and disappear when they are no longer needed | |
QStyle::SH_Menu_SupportsSections | 98 | Determines if the style displays sections in menus or treat them as plain separators. Sections are separators with a text and icon hint | |
QStyle::SH_ToolTip_WakeUpDelay | 99 | Determines the delay before a tooltip is shown, in milliseconds | |
QStyle::SH_ToolTip_FallAsleepDelay | 100 | Determines the delay (in milliseconds) before a new wake time is needed when a tooltip is shown | |
QStyle::SH_Widget_Animate | 101 | Deprecated, use SH_Widget_Animation_Duration | |
QStyle::SH_Splitter_OpaqueResize | 102 | Determines if widgets are resized dynamically (opaquely) while interactively moving the splitter | |
QStyle::SH_ComboBox_UseNativePopup | 103 | Tries to show a native popup for a combobox | |
QStyle::SH_TabBar_ChangeCurrentDelay | 105 | Determines the delay before the current tab is changed while dragging over the tabbar, in milliseconds | |
QStyle::SH_CustomBase | 0xf0000000 | Base value for custom style hints. Custom values must be greater than this value |
enum QStyle::SubControl |
This enum describes the available sub controls. A subcontrol is a control element within a complex control (ComplexControl).
Constant | Value | Description |
---|---|---|
QStyle::SC_None | 0x00000000 | Special value that matches no other sub control. |
QStyle::SC_ScrollBarAddLine | 0x00000001 | Scroll bar add line (down/right arrow), refer to QScrollBar. |
QStyle::SC_ScrollBarSubLine | 0x00000002 | Scroll bar sub line (up/left arrow). |
QStyle::SC_ScrollBarAddPage | 0x00000004 | Scroll bar add page (page down). |
QStyle::SC_ScrollBarSubPage | 0x00000008 | Scroll bar sub page (page up). |
QStyle::SC_ScrollBarFirst | 0x00000010 | Scroll bar first line (home). |
QStyle::SC_ScrollBarLast | 0x00000020 | Scroll bar last line (end). |
QStyle::SC_ScrollBarSlider | 0x00000040 | Scroll bar slider handle. |
QStyle::SC_ScrollBarGroove | 0x00000080 | Special subcontrol which contains the area in which the slider handle may move. |
QStyle::SC_SpinBoxUp | 0x00000001 | Spin widget up/increase, refer to QSpinBox. |
QStyle::SC_SpinBoxDown | 0x00000002 | Spin widget down/decrease. |
QStyle::SC_SpinBoxFrame | 0x00000004 | Spin widget frame. |
QStyle::SC_SpinBoxEditField | 0x00000008 | Spin widget edit field. |
QStyle::SC_ComboBoxEditField | 0x00000002 | Combobox edit field, refer to QComboBox. |
QStyle::SC_ComboBoxArrow | 0x00000004 | Combobox arrow button. |
QStyle::SC_ComboBoxFrame | 0x00000001 | Combobox frame. |
QStyle::SC_ComboBoxListBoxPopup | 0x00000008 | The reference rectangle for the combobox popup. Used to calculate the position of the popup. |
QStyle::SC_SliderGroove | 0x00000001 | Special subcontrol which contains the area in which the slider handle may move. |
QStyle::SC_SliderHandle | 0x00000002 | Slider handle. |
QStyle::SC_SliderTickmarks | 0x00000004 | Slider tickmarks. |
QStyle::SC_ToolButton | 0x00000001 | Tool button (see also QToolButton). |
QStyle::SC_ToolButtonMenu | 0x00000002 | Subcontrol for opening a popup menu in a tool button. |
QStyle::SC_TitleBarSysMenu | 0x00000001 | System menu button (restore, close, etc.). |
QStyle::SC_TitleBarMinButton | 0x00000002 | Minimize button. |
QStyle::SC_TitleBarMaxButton | 0x00000004 | Maximize button. |
QStyle::SC_TitleBarCloseButton | 0x00000008 | Close button. |
QStyle::SC_TitleBarLabel | 0x00000100 | Window title label. |
QStyle::SC_TitleBarNormalButton | 0x00000010 | Normal (restore) button. |
QStyle::SC_TitleBarShadeButton | 0x00000020 | Shade button. |
QStyle::SC_TitleBarUnshadeButton | 0x00000040 | Unshade button. |
QStyle::SC_TitleBarContextHelpButton | 0x00000080 | Context Help button. |
QStyle::SC_DialHandle | 0x00000002 | The handle of the dial (what you use to control the dial). |
QStyle::SC_DialGroove | 0x00000001 | The groove for the dial. |
QStyle::SC_DialTickmarks | 0x00000004 | The tickmarks for the dial. |
QStyle::SC_GroupBoxFrame | 0x00000008 | The frame of a group box. |
QStyle::SC_GroupBoxLabel | 0x00000002 | The title of a group box. |
QStyle::SC_GroupBoxCheckBox | 0x00000001 | The optional check box of a group box. |
QStyle::SC_GroupBoxContents | 0x00000004 | Group box contents. |
QStyle::SC_MdiNormalButton | 0x00000002 | Normal button for a MDI subwindow in the menu bar. |
QStyle::SC_MdiMinButton | 0x00000001 | Minimize button for a MDI subwindow in the menu bar. |
QStyle::SC_MdiCloseButton | 0x00000004 | Close button for a MDI subwindow in the menu bar. |
QStyle::SC_All | 0xffffffff | Special value that matches all subcontrols. |
enum QStyle::SubElement |
This enum represents a sub-area of a widget. Style implementations use these areas to draw the different parts of a widget.
Constant | Value | Description |
---|---|---|
QStyle::SE_PushButtonContents | 0 | Area containing the label (icon with text or pixmap). |
QStyle::SE_PushButtonFocusRect | 1 | Area for the focus rect (usually larger than the contents rect). |
QStyle::SE_PushButtonLayoutItem | 37 | Area that counts for the parent layout. |
QStyle::SE_CheckBoxIndicator | 2 | Area for the state indicator (, check mark). |
QStyle::SE_CheckBoxContents | 3 | Area for the label (text or pixmap). |
QStyle::SE_CheckBoxFocusRect | 4 | Area for the focus indicator. |
QStyle::SE_CheckBoxClickRect | 5 | Clickable area, defaults to SE_CheckBoxFocusRect. |
QStyle::SE_CheckBoxLayoutItem | 32 | Area that counts for the parent layout. |
QStyle::SE_DateTimeEditLayoutItem | 34 | Area that counts for the parent layout. |
QStyle::SE_RadioButtonIndicator | 6 | Area for the state indicator. |
QStyle::SE_RadioButtonContents | 7 | Area for the label. |
QStyle::SE_RadioButtonFocusRect | 8 | Area for the focus indicator. |
QStyle::SE_RadioButtonClickRect | 9 | Clickable area, defaults to SE_RadioButtonFocusRect. |
QStyle::SE_RadioButtonLayoutItem | 38 | Area that counts for the parent layout. |
QStyle::SE_ComboBoxFocusRect | 10 | Area for the focus indicator. |
QStyle::SE_SliderFocusRect | 11 | Area for the focus indicator. |
QStyle::SE_SliderLayoutItem | 39 | Area that counts for the parent layout. |
QStyle::SE_SpinBoxLayoutItem | 40 | Area that counts for the parent layout. |
QStyle::SE_ProgressBarGroove | 12 | Area for the groove. |
QStyle::SE_ProgressBarContents | 13 | Area for the progress indicator. |
QStyle::SE_ProgressBarLabel | 13 | Area for the text label. |
QStyle::SE_ProgressBarLayoutItem | 36 | Area that counts for the parent layout. |
QStyle::SE_FrameContents | 27 | Area for a frame's contents. |
QStyle::SE_ShapedFrameContents | 51 | Area for a frame's contents using the shape in QStyleOptionFrame, refer to QFrame |
QStyle::SE_FrameLayoutItem | 42 | Area that counts for the parent layout. |
QStyle::SE_HeaderArrow | 17 | Area for the sort indicator for a header. |
QStyle::SE_HeaderLabel | 16 | Area for the label in a header. |
QStyle::SE_LabelLayoutItem | 35 | Area that counts for the parent layout. |
QStyle::SE_LineEditContents | 26 | Area for a line edit's contents. |
QStyle::SE_TabWidgetLeftCorner | 21 | Area for the left corner widget in a tab widget. |
QStyle::SE_TabWidgetRightCorner | 22 | Area for the right corner widget in a tab widget. |
QStyle::SE_TabWidgetTabBar | 18 | Area for the tab bar widget in a tab widget. |
QStyle::SE_TabWidgetTabContents | 20 | Area for the contents of the tab widget. |
QStyle::SE_TabWidgetTabPane | 19 | Area for the pane of a tab widget. |
QStyle::SE_TabWidgetLayoutItem | 44 | Area that counts for the parent layout. |
QStyle::SE_ToolBoxTabContents | 15 | Area for a toolbox tab's icon and label. |
QStyle::SE_ToolButtonLayoutItem | 41 | Area that counts for the parent layout. |
QStyle::SE_ItemViewItemCheckIndicator | 23 | Area for a view item's check mark. |
QStyle::SE_TabBarTearIndicator | 24 | Area for the tear indicator on a tab bar with scroll arrows. |
QStyle::SE_TreeViewDisclosureItem | 25 | Area for the actual disclosure item in a tree branch. |
QStyle::SE_GroupBoxLayoutItem | 43 | Area that counts for the parent layout. |
QStyle::SE_DockWidgetFloatButton | 29 | The float button of a dock widget. |
QStyle::SE_DockWidgetTitleBarText | 30 | The text bounds of the dock widgets title. |
QStyle::SE_DockWidgetCloseButton | 28 | The close button of a dock widget. |
QStyle::SE_DockWidgetIcon | 31 | The icon of a dock widget. |
QStyle::SE_ComboBoxLayoutItem | 33 | Area that counts for the parent layout. |
QStyle::SE_ItemViewItemDecoration | 45 | Area for a view item's decoration (icon). |
QStyle::SE_ItemViewItemText | 46 | Area for a view item's text. |
QStyle::SE_ItemViewItemFocusRect | 47 | Area for a view item's focus rect. |
QStyle::SE_TabBarTabLeftButton | 48 | Area for a widget on the left side of a tab in a tab bar. |
QStyle::SE_TabBarTabRightButton | 49 | Area for a widget on the right side of a tab in a tab bar. |
QStyle::SE_TabBarTabText | 50 | Area for the text on a tab in a tab bar. |
QStyle::SE_ToolBarHandle | 52 | Area for the handle of a toolbar. |
QStyle::SE_CustomBase | 0xf0000000 | Base value for custom sub-elements. Custom values must be greater than this value. |
QStyle::QStyle | ( | ) |
Constructs a style object.
|
virtual |
Destroys the style object.
|
static |
Returns a new rectangle of the specified size that is aligned to the given rect according to the specified alignment and direction.
int QStyle::combinedLayoutSpacing | ( | QSizePolicy::ControlTypes | controls1, |
QSizePolicy::ControlTypes | controls2, | ||
Qt::Orientation | orientation, | ||
QStyleOption * | option = nullptr , |
||
QWidget * | widget = nullptr |
||
) | const |
Returns the spacing that should be used between controls1 and controls2 in a layout. These two controls are a bitwise OR of zero or more control types. The orientation specifies whether the controls are laid out side by side or stacked vertically. The option parameter can be used to pass extra information about the parent widget. The widget parameter is optional and can also be used if option is a nullptr.
This method is called by the layout system. It is used only if PM_LayoutHorizontalSpacing or PM_LayoutVerticalSpacing returns a negative value.
|
pure virtual |
Draws the given control using the provided painter with the style options specified by option.
The widget argument is optional and can be used as aid in drawing the control.
The option parameter is a pointer to a QStyleOptionComplex object that can be cast to the correct subclass using the qstyleoption_cast() function. Note that the rect
member of the specified option must be in logical coordinates. Reimplementations of this function should use visualRect() to change the logical coordinates into screen coordinates before calling the drawPrimitive() or drawControl() function.
The table below is listing the complex control elements and their associated style option subclass. The style options contain all the parameters required to draw the controls, including QStyleOption::state which holds the style flags that are used when drawing. The table also describes which flags that are set when casting the given option to the appropriate subclass.
Complex Control | QStyleOptionComplex Subclass | Style Flag | Remark |
---|---|---|---|
CC_SpinBox | QStyleOptionSpinBox | State_Enabled | Set if the spin box is enabled. |
State_HasFocus | Set if the spin box has input focus. | ||
CC_ComboBox | QStyleOptionComboBox | State_Enabled | Set if the combobox is enabled. |
State_HasFocus | Set if the combobox has input focus. | ||
CC_ScrollBar | QStyleOptionSlider | State_Enabled | Set if the scroll bar is enabled. |
State_HasFocus | Set if the scroll bar has input focus. | ||
CC_Slider | QStyleOptionSlider | State_Enabled | Set if the slider is enabled. |
State_HasFocus | Set if the slider has input focus. | ||
CC_Dial | QStyleOptionSlider | State_Enabled | Set if the dial is enabled. |
State_HasFocus | Set if the dial has input focus. | ||
CC_ToolButton | QStyleOptionToolButton | State_Enabled | Set if the tool button is enabled. |
State_HasFocus | Set if the tool button has input focus. | ||
State_DownArrow | Set if the tool button is down (mouse button or the space bar is pressed). | ||
State_On | Set if the tool button is a toggle button and is toggled on. | ||
State_AutoRaise | Set if the tool button has auto-raise enabled. | ||
State_Raised | Set if the button is not down, not on, and does not contain the mouse when auto-raise is enabled. | ||
CC_TitleBar | QStyleOptionTitleBar | State_Enabled | Set if the title bar is enabled. |
Implemented in QMacStyle::drawComplexControl(), QWindowsStyle::drawComplexControl(), QProxyStyle::drawComplexControl(), QCommonStyle::drawComplexControl(), QWindowsVistaStyle::drawComplexControl(), QGtkStyle::drawComplexControl(), QFusionStyle::drawComplexControl(), QWindowsXPStyle::drawComplexControl()
|
pure virtual |
Draws the given element with the provided painter with the style options specified by option. The widget argument is optional and can be used as aid in drawing the control. The option parameter is a pointer to a QStyleOption object that can be cast to the correct subclass using the qstyleoption_cast() function.
The table below is listing the control elements and their associated style option subclass. The style options contain all the parameters required to draw the controls, including QStyleOption::state which holds the style flags that are used when drawing. The table also describes which flags that are set when casting the given option to the appropriate subclass.
If a control element is not listed here it is because it uses a plain QStyleOption object.
Control Element | QStyleOption Subclass | Style Flag | Remark |
---|---|---|---|
CE_MenuItem, CE_MenuBarItem | QStyleOptionMenuItem | State_Selected | The menu item is currently selected item. |
State_Enabled | The item is enabled. | ||
State_DownArrow | Indicates that a scroll down arrow should be drawn. | ||
State_UpArrow | Indicates that a scroll up arrow should be drawn | ||
State_HasFocus | Set if the menu bar has input focus. | ||
CE_PushButton, CE_PushButtonBevel, CE_PushButtonLabel | QStyleOptionButton | State_Enabled | Set if the button is enabled. |
State_HasFocus | Set if the button has input focus. | ||
State_Raised | Set if the button is not down, not on and not flat. | ||
State_On | Set if the button is a toggle button and is toggled on. | ||
State_Sunken | Set if the button is down (mouse button or the space bar is pressed on the button). | ||
CE_RadioButton, CE_RadioButtonLabel, CE_CheckBox, CE_CheckBoxLabel | QStyleOptionButton | State_Enabled | Set if the button is enabled. |
State_HasFocus | Set if the button has input focus. | ||
State_On | Set if the button is checked. | ||
State_Off | Set if the button is not checked. | ||
State_NoChange | Set if the button is in the NoChange state. | ||
State_Sunken | Set if the button is down (mouse button or the space bar is pressed on the button). | ||
CE_ProgressBarContents, CE_ProgressBarLabel, CE_ProgressBarGroove | QStyleOptionProgressBar | State_Enabled | Set if the progress bar is enabled. |
State_HasFocus | Set if the progress bar has input focus. | ||
CE_Header, CE_HeaderSection, CE_HeaderLabel | QStyleOptionHeader | ||
CE_TabBarTab, CE_TabBarTabShape, CE_TabBarTabLabel | QStyleOptionTab | State_Enabled | Set if the tab bar is enabled. |
State_Selected | The tab bar is the currently selected tab bar. | ||
State_HasFocus | Set if the tab bar tab has input focus. | ||
CE_ToolButtonLabel | QStyleOptionToolButton | State_Enabled | Set if the tool button is enabled. |
State_HasFocus | Set if the tool button has input focus. | ||
State_Sunken | Set if the tool button is down (mouse button or the space bar is pressed). | ||
State_On | Set if the tool button is a toggle button and is toggled on. | ||
State_AutoRaise | Set if the tool button has auto-raise enabled. | ||
State_MouseOver | Set if the mouse pointer is over the tool button. | ||
State_Raised | Set if the button is not down and is not on. | ||
CE_ToolBoxTab | QStyleOptionToolBox | State_Selected | The tab is the currently selected tab. |
CE_HeaderSection | QStyleOptionHeader | State_Sunken | Indicates that the section is pressed. |
State_UpArrow | Indicates that the sort indicator should be pointing up. | ||
State_DownArrow | Indicates that the sort indicator should be pointing down. |
Implemented in QMacStyle::drawControl(), QWindowsXPStyle::drawControl(), QWindowsStyle::drawControl(), QProxyStyle::drawControl(), QCommonStyle::drawControl(), QWindowsVistaStyle::drawControl(), QGtkStyle::drawControl(), QFusionStyle::drawControl()
|
virtual |
Draws the given pixmap in the specified rect, according to the specified alignment, using the provided painter.
Reimplemented in QFusionStyle::drawItemPixmap(), QGtkStyle::drawItemPixmap(), QProxyStyle::drawItemPixmap()
|
virtual |
Draws the given text in the specified rect using the provided painter and palette.
The text is drawn using the painter's pen, and aligned and wrapped according to the specified alignment. If an explicit textRole is specified, the text is drawn using the palette's color for the given role. The enabled parameter indicates whether or not the item is enabled; when reimplementing this function, the enabled parameter should influence how the item is drawn.
Reimplemented in QMacStyle::drawItemText(), QProxyStyle::drawItemText(), QFusionStyle::drawItemText(), QGtkStyle::drawItemText()
|
pure virtual |
Draws the given primitive element with the provided painter using the style options specified by option. The widget argument is optional and may contain a widget that may aid in drawing the primitive element.
The table below shows the primitive elements and their associated style option subclasses. The style options contain all the parameters required to draw the elements, including QStyleOption::state which holds the style flags that are used when drawing. The table also describes which flags that are set when casting the given option to the appropriate subclass.
If a primitive element is not listed here, it is because it uses a plain QStyleOption object.
Primitive Element | QStyleOption Subclass | Style Flag | Remark |
---|---|---|---|
PE_FrameFocusRect | QStyleOptionFocusRect | State_FocusAtBorder | Whether the focus is the border or inside the widget. |
PE_IndicatorCheckBox | QStyleOptionButton | State_NoChange | Indicates a "tri-state" checkbox. |
State_On | Indicates the indicator is checked. | ||
PE_IndicatorRadioButton | QStyleOptionButton | State_On | Indicates that a radio button is selected. |
State_NoChange | Indicates a "tri-state" controller. | ||
State_Enabled | Indicates the controller is enabled. | ||
PE_IndicatorBranch | QStyleOption | State_Children | Indicates that the control for expanding the tree to show child items, should be drawn. |
State_Item | Indicates that a horizontal branch (to show a child item), should be drawn. | ||
State_Open | Indicates that the tree branch is expanded. | ||
State_Sibling | Indicates that a vertical line (to show a sibling item), should be drawn. | ||
PE_IndicatorHeaderArrow | QStyleOptionHeader | State_UpArrow | Indicates that the arrow should be drawn up, otherwise it should be down. |
PE_FrameGroupBox, PE_Frame, PE_FrameLineEdit, PE_FrameMenu, PE_FrameDockWidget, PE_FrameWindow | QStyleOptionFrame | State_Sunken | Indicates that the Frame should be sunken. |
PE_IndicatorToolBarHandle | QStyleOption | State_Horizontal | Indicates that the window handle is horizontal instead of vertical. |
PE_IndicatorSpinPlus, PE_IndicatorSpinMinus, PE_IndicatorSpinUp, PE_IndicatorSpinDown, | QStyleOptionSpinBox | State_Sunken | Indicates that the button is pressed. |
PE_PanelButtonCommand | QStyleOptionButton | State_Enabled | Set if the button is enabled. |
State_HasFocus | Set if the button has input focus. | ||
State_Raised | Set if the button is not down, not on and not flat. | ||
State_On | Set if the button is a toggle button and is toggled on. | ||
State_Sunken | Set if the button is down (mouse button or the space bar is pressed on the button). |
Implemented in QMacStyle::drawPrimitive(), QWindowsXPStyle::drawPrimitive(), QWindowsStyle::drawPrimitive(), QWindowsVistaStyle::drawPrimitive(), QProxyStyle::drawPrimitive(), QCommonStyle::drawPrimitive(), QFusionStyle::drawPrimitive(), QGtkStyle::drawPrimitive()
|
pure virtual |
Returns a copy of the given pixmap styled to conform to the specified iconMode and taking into account the palette specified by option. The option parameter can pass extra information, but it must contain a palette.
Not all pixmaps will conform, in which case the returned pixmap is a plain copy.
Implemented in QGtkStyle::generatedIconPixmap(), QMacStyle::generatedIconPixmap(), QProxyStyle::generatedIconPixmap(), QCommonStyle::generatedIconPixmap(), QFusionStyle::generatedIconPixmap()
|
pure virtual |
Returns the sub control at the given position in the given complex control (with the style options specified by option). The position is expressed in screen coordinates.
The option argument is a pointer to a QStyleOptionComplex object (or one of its subclasses). The object can be cast to the appropriate type using the qstyleoption_cast() function. See drawComplexControl() for details. The widget argument is optional and can contain additional information for the function.
Implemented in QWindowsVistaStyle::hitTestComplexControl(), QProxyStyle::hitTestComplexControl(), QMacStyle::hitTestComplexControl(), QFusionStyle::hitTestComplexControl(), QCommonStyle::hitTestComplexControl(), QGtkStyle::hitTestComplexControl()
|
virtual |
Returns the area within the given rect in which to draw the specified pixmap according to the defined alignment.
Reimplemented in QGtkStyle::itemPixmapRect(), QFusionStyle::itemPixmapRect(), QProxyStyle::itemPixmapRect()
|
virtual |
Returns the area within the given rect in which to draw the provided text according to the specified font metrics and alignment. The enabled parameter indicates whether or not the associated item is enabled.
If the given rectangle is larger than the area needed to render the text, the rectangle that is returned will be offset within rectangle according to the specified alignment. For example, if alignment is Qt::AlignCenter, the returned rectangle will be centered within rectangle. If the given rectangle is smaller than the area needed, the returned rectangle will be the smallest rectangle large enough to render the text.
Reimplemented in QProxyStyle::itemTextRect()
|
pure virtual |
Returns the spacing that should be used between control1 and control2 in a layout. The orientation specifies whether the controls are laid out side by side or stacked vertically. The option parameter can be used to pass extra information about the parent widget. The widget parameter is optional and can also be used if option is 0.
This function is called by the layout system. It is used only if PM_LayoutHorizontalSpacing or PM_LayoutVerticalSpacing returns a negative value.
Implemented in QMacStyle::layoutSpacing(), QCommonStyle::layoutSpacing(), QProxyStyle::layoutSpacing()
|
pure virtual |
Returns the value of the given pixel metric. The specified option and widget can be used for calculating the metric. In general the widget argument is not used. Some pixel metrics are called from widgets and some are only called internally by the style. If the metric is not called by a widget it is the discretion of the style author to make use of it. For some styles, this may not be appropriate.
The option can be cast to the appropriate type using the qstyleoption_cast() method. It may also be zero even for PixelMetrics that can make use of it. Refer to the following table for the data type corresponding to each pixel metric.
Pixel Metric | QStyleOption Subclass |
---|---|
PM_SliderControlThickness | QStyleOptionSlider |
PM_SliderLength | QStyleOptionSlider |
PM_SliderTickmarkOffset | QStyleOptionSlider |
PM_SliderSpaceAvailable | QStyleOptionSlider |
PM_ScrollBarExtent | QStyleOptionSlider |
PM_TabBarTabOverlap | QStyleOptionTab |
PM_TabBarTabHSpace | QStyleOptionTab |
PM_TabBarTabVSpace | QStyleOptionTab |
PM_TabBarBaseHeight | QStyleOptionTab |
PM_TabBarBaseOverlap | QStyleOptionTab |
Implemented in QWindowsXPStyle::pixelMetric(), QWindowsStyle::pixelMetric(), QWindowsVistaStyle::pixelMetric(), QGtkStyle::pixelMetric(), QMacStyle::pixelMetric(), QProxyStyle::pixelMetric(), QCommonStyle::pixelMetric(), QFusionStyle::pixelMetric()
|
virtual |
Late initialization of the given application object.
Reimplemented in QCommonStyle::polish(), QWindowsVistaStyle::polish(), QGtkStyle::polish(), QProxyStyle::polish(), QWindowsXPStyle::polish(), QFusionStyle::polish(), QWindowsStyle::polish(), QMacStyle::polish()
|
virtual |
Changes the palette according to style specific requirements for color palettes (if any).
Reimplemented in QGtkStyle::polish(), QWindowsXPStyle::polish(), QFusionStyle::polish(), QCommonStyle::polish(), QWindowsStyle::polish(), QMacStyle::polish(), QWindowsVistaStyle::polish(), QProxyStyle::polish()
|
virtual |
Initializes the appearance of the given widget. This method 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.
The default implementation does nothing. Reasonable actions in this function might be to call the QWidget::setBackgroundMode() function for the widget. Do not use the function to set, for example, the geometry. Reimplementing this function provides a back-door through which the appearance of a widget can be changed, but with the CopperSpice style engine it is rarely necessary to implement this function; reimplement drawItemPixmap(), drawItemText(), drawPrimitive(), etc. instead.
The QWidget::inherits() method may provide enough information to allow class-specific customizations. But because new QStyle subclasses are expected to work reasonably with all current and future widgets, limited use of hard-coded customization is recommended.
Reimplemented in QWindowsVistaStyle::polish(), QGtkStyle::polish(), QWindowsXPStyle::polish(), QProxyStyle::polish(), QCommonStyle::polish(), QFusionStyle::polish(), QWindowsStyle::polish(), QMacStyle::polish()
const QStyle * QStyle::proxy | ( | ) | const |
This function returns the current proxy for this style. By default most styles will return themselves. However when a proxy style is in use, it will allow the style to call back into its proxy.
|
pure virtual |
Returns the size of the element described by the specified option and type, based on the provided contentsSize.
The option argument is a pointer to a QStyleOption or one of its subclasses. The option can be cast to the appropriate type using the qstyleoption_cast() function. The widget is an optional argument and can contain extra information used for calculating the size.
See the table below for the appropriate option casts:
Contents Type | QStyleOption Subclass |
---|---|
CT_PushButton | QStyleOptionButton |
CT_CheckBox | QStyleOptionButton |
CT_RadioButton | QStyleOptionButton |
CT_ToolButton | QStyleOptionToolButton |
CT_ComboBox | QStyleOptionComboBox |
CT_Splitter | QStyleOption |
CT_ProgressBar | QStyleOptionProgressBar |
CT_MenuItem | QStyleOptionMenuItem |
Implemented in QCommonStyle::sizeFromContents(), QWindowsVistaStyle::sizeFromContents(), QGtkStyle::sizeFromContents(), QProxyStyle::sizeFromContents(), QFusionStyle::sizeFromContents(), QMacStyle::sizeFromContents(), QWindowsXPStyle::sizeFromContents(), QWindowsStyle::sizeFromContents()
|
static |
Converts the given logicalValue to a pixel position. The min parameter maps to 0, max maps to span and other values are distributed evenly in between. This method can handle the entire integer range without overflow, providing that span is less than 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 the upsideDown parameter to true to reverse this behavior.
|
static |
Converts the given pixel position to a logical value. The value of 0 maps to the min parameter, span maps to max and other values are distributed evenly in between. This method 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 the upsideDown parameter to true to reverse this behavior.
|
pure virtual |
Returns an icon for the given standardIcon.
The standardIcon is a standard pixmap which can follow some existing GUI style or guideline. The option argument can be used to pass extra information required when defining the appropriate icon. The widget argument is optional and can also be used to aid the determination of the icon.
Implemented in QWindowsXPStyle::standardIcon(), QWindowsVistaStyle::standardIcon(), QMacStyle::standardIcon(), QGtkStyle::standardIcon(), QProxyStyle::standardIcon(), QFusionStyle::standardIcon(), QWindowsStyle::standardIcon(), QCommonStyle::standardIcon()
|
virtual |
Returns the style's standard palette.
Note that on systems that support system colors, the style's standard palette is not used. In particular, the Windows XP, Vista, and Mac styles do not use the standard palette, but make use of native theme engines. With these styles, you should not set the palette with QApplication::setStandardPalette().
Reimplemented in QWindowsVistaStyle::standardPalette(), QProxyStyle::standardPalette(), QMacStyle::standardPalette(), QWindowsXPStyle::standardPalette(), QGtkStyle::standardPalette(), QFusionStyle::standardPalette()
|
deprecatedpure virtual |
Creates a QPixmap using the given standardPixmap. The option argument can be used to pass extra information required when defining the pixmap. The widget argument is optional and can be used to aid the determination of the pixmap.
Implemented in QWindowsVistaStyle::standardPixmap(), QMacStyle::standardPixmap(), QWindowsXPStyle::standardPixmap(), QProxyStyle::standardPixmap(), QFusionStyle::standardPixmap(), QWindowsStyle::standardPixmap(), QGtkStyle::standardPixmap(), QCommonStyle::standardPixmap()
|
pure virtual |
Returns an integer representing the specified style styleHint for the given widget described by the provided style option.
The styleHintReturn is used when the querying widget needs more detailed data than the integer that styleHint() returns. See the QStyleHintReturn class description for details.
Implemented in QMacStyle::styleHint(), QCommonStyle::styleHint(), QWindowsXPStyle::styleHint(), QProxyStyle::styleHint(), QFusionStyle::styleHint(), QWindowsStyle::styleHint(), QGtkStyle::styleHint(), QWindowsVistaStyle::styleHint()
|
pure virtual |
Returns the rectangle containing the specified subControl of the given complex control (with the style specified by option). The rectangle is defined in screen coordinates.
The option argument is a pointer to QStyleOptionComplex or one of its subclasses, and can be cast to the appropriate type using the qstyleoption_cast() function. See drawComplexControl() for details. The widget is optional and can contain additional information for the function.
Implemented in QMacStyle::subControlRect(), QCommonStyle::subControlRect(), QGtkStyle::subControlRect(), QFusionStyle::subControlRect(), QWindowsVistaStyle::subControlRect(), QProxyStyle::subControlRect(), QWindowsXPStyle::subControlRect()
|
pure virtual |
Returns the sub-area for the given element as described in the provided style option. The returned rectangle is defined in screen coordinates. The widget argument is optional and can be used to aid determining the area. The QStyleOption object can be cast to the appropriate type using the qstyleoption_cast() function.
Refer to the following table for the data type corresponding to each sub element.
Sub Element | QStyleOption Subclass |
---|---|
SE_PushButtonContents | QStyleOptionButton |
SE_PushButtonFocusRect | QStyleOptionButton |
SE_CheckBoxIndicator | QStyleOptionButton |
SE_CheckBoxContents | QStyleOptionButton |
SE_CheckBoxFocusRect | QStyleOptionButton |
SE_RadioButtonIndicator | QStyleOptionButton |
SE_RadioButtonContents | QStyleOptionButton |
SE_RadioButtonFocusRect | QStyleOptionButton |
SE_ComboBoxFocusRect | QStyleOptionComboBox |
SE_ProgressBarGroove | QStyleOptionProgressBar |
SE_ProgressBarContents | QStyleOptionProgressBar |
SE_ProgressBarLabel | QStyleOptionProgressBar |
Implemented in QMacStyle::subElementRect(), QWindowsXPStyle::subElementRect(), QWindowsStyle::subElementRect(), QFusionStyle::subElementRect(), QCommonStyle::subElementRect(), QWindowsVistaStyle::subElementRect(), QGtkStyle::subElementRect(), QProxyStyle::subElementRect()
|
virtual |
Uninitialize the given application.
Reimplemented in QCommonStyle::unpolish(), QWindowsVistaStyle::unpolish(), QGtkStyle::unpolish(), QProxyStyle::unpolish(), QWindowsXPStyle::unpolish(), QFusionStyle::unpolish(), QWindowsStyle::unpolish(), QMacStyle::unpolish()
|
virtual |
Uninitialize the given widget's appearance.
This function is the counterpart to polish(). It is called for every polished widget whenever the style is dynamically changed; the former style has to unpolish its settings before the new style can polish them again.
Note that unpolish() will only be called if the widget is destroyed. This can cause problems in some cases, e.g, if you remove a widget from the UI, cache it, and then reinsert it after the style has changed; some of the CopperSpice classes cache their widgets.
Reimplemented in QWindowsVistaStyle::unpolish(), QGtkStyle::unpolish(), QWindowsXPStyle::unpolish(), QProxyStyle::unpolish(), QFusionStyle::unpolish(), QCommonStyle::unpolish(), QWindowsStyle::unpolish(), QMacStyle::unpolish()
|
static |
Transforms an alignment of Qt::AlignLeft or Qt::AlignRight without Qt::AlignAbsolute into Qt::AlignLeft or Qt::AlignRight with Qt::AlignAbsolute according to the layout direction. The other alignment flags are left untouched.
If no horizontal alignment was specified, the function returns the default alignment for the given layout direction.
|
static |
Returns the given logicalPosition converted to screen coordinates based on the specified direction. The boundingRect is used when performing the translation.
|
static |
Returns the given logicalRect converted to screen coordinates based on the specified direction. The boundingRect is used when performing the translation.
This method is provided to support right-to-left languages and is typically used in implementations of the subControlRect() method.