Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QStyleOptionComplex Class Reference

\variable QStyleOptionMenuItem::menuItemType More...

#include <qstyleoption.h>

+ Inheritance diagram for QStyleOptionComplex:
+ Collaboration diagram for QStyleOptionComplex:

Public Types

enum  StyleOptionType { Type = SO_Complex }
 This enum is used to hold information about the type of the style option, and is defined for each QStyleOption subclass. More...
 
enum  StyleOptionVersion { Version = 1 }
 This enum is used to hold information about the version of the style option, and is defined for each QStyleOption subclass. More...
 
- Public Types inherited from QStyleOption
enum  OptionType {
  SO_Default , SO_FocusRect , SO_Button , SO_Tab ,
  SO_MenuItem , SO_Frame , SO_ProgressBar , SO_ToolBox ,
  SO_Header , SO_DockWidget , SO_ViewItem , SO_TabWidgetFrame ,
  SO_TabBarBase , SO_RubberBand , SO_ToolBar , SO_GraphicsItem ,
  SO_Complex = 0xf0000 , SO_Slider , SO_SpinBox , SO_ToolButton ,
  SO_ComboBox , SO_TitleBar , SO_GroupBox , SO_SizeGrip ,
  SO_CustomBase = 0xf00 , SO_ComplexCustomBase = 0xf000000
}
 This enum is used internally by QStyleOption, its subclasses, and qstyleoption_cast() to determine the type of style option. More...
 
enum  StyleOptionType { Type = SO_Default }
 This enum is used to hold information about the type of the style option, and is defined for each QStyleOption subclass. More...
 
enum  StyleOptionVersion { Version = 1 }
 This enum is used to hold information about the version of the style option, and is defined for each QStyleOption subclass. More...
 

Public Member Functions

 QStyleOptionComplex (int version=QStyleOptionComplex::Version, int type=SO_Complex)
 Constructs a QStyleOptionComplex of the specified type and version, initializing the member variables to their default values.
 
 QStyleOptionComplex (const QStyleOptionComplex &other)
 Constructs a copy of the other style option.
 
QStyleOptionComplexoperator= (const QStyleOptionComplex &)=default
 
- Public Member Functions inherited from QStyleOption
 QStyleOption (int version=QStyleOption::Version, int type=SO_Default)
 Constructs a QStyleOption with the specified version and type.
 
 QStyleOption (const QStyleOption &other)
 Constructs a copy of other.
 
 ~QStyleOption ()
 Destroys this style option object.
 
void initFrom (const QWidget *w)
 
QStyleOptionoperator= (const QStyleOption &other)
 Assign other to this QStyleOption.
 

Public Attributes

QStyle::SubControls subControls
 
QStyle::SubControls activeSubControls
 
- Public Attributes inherited from QStyleOption
int version
 
int type
 
QStyle::State state
 
Qt::LayoutDirection direction
 
QRect rect
 
QFontMetrics fontMetrics
 
QPalette palette
 
QObjectstyleObject
 

Additional Inherited Members

Detailed Description

\variable QStyleOptionMenuItem::menuItemType

the type of menu item

The default value is \l Normal.

See also
MenuItemType

\variable QStyleOptionMenuItem::checkType

the type of checkmark of the menu item

The default value is \l NotCheckable.

See also
CheckType

\variable QStyleOptionMenuItem::checked

whether the menu item is checked or not

The default value is false.

\variable QStyleOptionMenuItem::menuHasCheckableItems

whether the menu as a whole has checkable items or not

The default value is true.

If this option is set to false, then the menu has no checkable items. This makes it possible for GUI styles to save some horizontal space that would normally be used for the check column.

\variable QStyleOptionMenuItem::menuRect

the rectangle for the entire menu

The default value is a null rectangle, i.e. a rectangle with both the width and the height set to 0.

\variable QStyleOptionMenuItem::text

the text for the menu item

Note that the text format is something like this "Menu text\b{\\t}Shortcut".

If the menu item doesn't have a shortcut, it will just contain the menu item's text. The default value is an empty string.

\variable QStyleOptionMenuItem::icon

the icon for the menu item

The default value is an empty icon, i.e. an icon with neither a pixmap nor a filename.

\variable QStyleOptionMenuItem::maxIconWidth

the maximum icon width for the icon in the menu item

This can be used for drawing the icon into the correct place or properly aligning items. The variable must be set regardless of whether or not the menu item has an icon. The default value is 0.

\variable QStyleOptionMenuItem::reservedShortcutWidth

the reserved width for the menu item's shortcut

QMenu sets it to the width occupied by the widest shortcut among all visible items within the menu.

The default value is 0.

\variable QStyleOptionMenuItem::font

the font used for the menu item text

This is the font that should be used for drawing the menu text minus the shortcut. The shortcut is usually drawn using the painter's font. By default, the application's default font is used.

The QStyleOptionComplex class is used to hold parameters that are common to all complex controls.

\inmodule QtWidgets

This class is not used on its own. Instead it is used to derive other complex control options, for example QStyleOptionSlider and QStyleOptionSpinBox.

For performance reasons, there are few member functions and the access to the member variables is direct (i.e., using the . or -> operator). This makes the structures straightforward to use and emphasizes that these are simply parameters used by the style functions.

See also
QStyleOption

Definition at line 479 of file qstyleoption.h.

Member Enumeration Documentation

◆ StyleOptionType

This enum is used to hold information about the type of the style option, and is defined for each QStyleOption subclass.

\value Type The type of style option provided (\l{SO_Complex} for this class).

The type is used internally by QStyleOption, its subclasses, and qstyleoption_cast() to determine the type of style option. In general you do not need to worry about this unless you want to create your own QStyleOption subclass and your own styles.

See also
StyleOptionVersion
Enumerator
Type 

Definition at line 482 of file qstyleoption.h.

◆ StyleOptionVersion

This enum is used to hold information about the version of the style option, and is defined for each QStyleOption subclass.

\value Version 1

The version is used by QStyleOption subclasses to implement extensions without breaking compatibility. If you use qstyleoption_cast(), you normally do not need to check it.

See also
StyleOptionType
Enumerator
Version 

Definition at line 483 of file qstyleoption.h.

Constructor & Destructor Documentation

◆ QStyleOptionComplex() [1/2]

QStyleOptionComplex::QStyleOptionComplex ( int version = QStyleOptionComplex::Version,
int type = SO_Complex )

Constructs a QStyleOptionComplex of the specified type and version, initializing the member variables to their default values.

This constructor is usually called by subclasses.

Definition at line 1822 of file qstyleoption.cpp.

◆ QStyleOptionComplex() [2/2]

QStyleOptionComplex::QStyleOptionComplex ( const QStyleOptionComplex & other)
inline

Constructs a copy of the other style option.

Definition at line 489 of file qstyleoption.h.

References other().

+ Here is the call graph for this function:

Member Function Documentation

◆ operator=()

QStyleOptionComplex & QStyleOptionComplex::operator= ( const QStyleOptionComplex & )
default

Member Data Documentation

◆ activeSubControls

QStyle::SubControls QStyleOptionComplex::activeSubControls

◆ subControls

QStyle::SubControls QStyleOptionComplex::subControls

The documentation for this class was generated from the following files: