QStyleOption Class
The QStyleOption class stores the parameters that QStyle functions use to draw. More…
| Header | #include <QStyleOption> |
|---|---|
| CMake | target_link_libraries(app PRIVATE Nt::Widgets) |
| Module | Nt Widgets C++ Classes |
| Inherited by | QStyleOptionButton, QStyleOptionComboBox, QStyleOptionFrame, QStyleOptionGroupBox, QStyleOptionHeader, QStyleOptionMenuItem, QStyleOptionProgressBar, QStyleOptionSlider, QStyleOptionSpinBox, QStyleOptionTab, QStyleOptionViewItem |
List of all members, including inherited members
Public Types
| enum | OptionType |
Public Functions
| QStyleOption(int optionType = SO_Default) | |
| virtual | ~QStyleOption() |
| void | initFrom(const QWidget *widget) |
Public Variables
Detailed Description
An option carries the rectangle to draw in, the state, the palette and the font metrics. Use initFrom() to set them from a widget. Subclasses add the data that an element needs, such as a text.
See also QStyle and QStyleOptionButton.
Differences from Qt
The members are plain data and there is no version, direction, styleObject or operator=.
Member Type Documentation
enum QStyleOption::OptionType
This enum identifies the kind of an option.
| Constant | Description |
|---|---|
QStyleOption::SO_Default | A plain option. |
QStyleOption::SO_Button | A QStyleOptionButton. |
QStyleOption::SO_Frame | A QStyleOptionFrame. |
QStyleOption::SO_Slider | A QStyleOptionSlider. |
QStyleOption::SO_ProgressBar | A QStyleOptionProgressBar. |
QStyleOption::SO_Tab | A QStyleOptionTab. |
QStyleOption::SO_ComboBox | A QStyleOptionComboBox. |
QStyleOption::SO_SpinBox | A QStyleOptionSpinBox. |
QStyleOption::SO_GroupBox | A QStyleOptionGroupBox. |
QStyleOption::SO_Header | A QStyleOptionHeader. |
QStyleOption::SO_MenuItem | A QStyleOptionMenuItem. |
QStyleOption::SO_ViewItem | A QStyleOptionViewItem. |
Member Function Documentation
QStyleOption::QStyleOption(int optionType = SO_Default)
Constructs an option of the given optionType.
QStyleOption::~QStyleOption()
Destroys the option.
void QStyleOption::initFrom(const QWidget *widget)
Sets the state, rectangle, palette and font metrics of the option from widget.
Member Variable Documentation
QFontMetrics QStyleOption::fontMetrics
The metrics of the font of the widget.
QPalette QStyleOption::palette
The palette to draw with.
QRect QStyleOption::rect
The rectangle to draw in.
QStyle::State QStyleOption::state
The state of the element.
int QStyleOption::type
The kind of the option, a value of OptionType.