![]() |
Qt 6.x
The Qt SDK
|
The QStyleOptionHeader class is used to describe the parameters for drawing a header. More...
#include <qstyleoption.h>
Public Types | |
enum | StyleOptionType { Type = SO_Header } |
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... | |
enum | SectionPosition { Beginning , Middle , End , OnlyOneSection } |
\variable QStyleOptionHeader::section More... | |
enum | SelectedPosition { NotAdjacent , NextIsSelected , PreviousIsSelected , NextAndPreviousAreSelected } |
This enum lets you know where the section's position is in relation to the selected section. More... | |
enum | SortIndicator { None , SortUp , SortDown } |
Indicates which direction the sort indicator should be drawn. More... | |
![]() | |
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 | |
QStyleOptionHeader () | |
Constructs a QStyleOptionHeader, initializing the members variables to their default values. | |
QStyleOptionHeader (const QStyleOptionHeader &other) | |
\variable QStyleOptionHeader::orientation | |
QStyleOptionHeader & | operator= (const QStyleOptionHeader &)=default |
![]() | |
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) |
QStyleOption & | operator= (const QStyleOption &other) |
Assign other to this QStyleOption. | |
Public Attributes | |
int | section |
QString | text |
Qt::Alignment | textAlignment |
QIcon | icon |
Qt::Alignment | iconAlignment |
SectionPosition | position |
SelectedPosition | selectedPosition |
SortIndicator | sortIndicator |
Qt::Orientation | orientation |
![]() | |
int | version |
int | type |
QStyle::State | state |
Qt::LayoutDirection | direction |
QRect | rect |
QFontMetrics | fontMetrics |
QPalette | palette |
QObject * | styleObject |
Protected Member Functions | |
QStyleOptionHeader (int version) | |
Additional Inherited Members | |
![]() | |
template< typename T > T | qstyleoption_cast (const QStyleOption *option) |
\variable QStyleOptionTitleBar::text | |
template< typename T > T | qstyleoption_cast (QStyleOption *option) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
The QStyleOptionHeader class is used to describe the parameters for drawing a header.
\inmodule QtWidgets
QStyleOptionHeader contains all the information that QStyle functions need to draw the item views' header pane, header sort arrow, and header label.
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.
Definition at line 167 of file qstyleoption.h.
\variable QStyleOptionHeader::section
which section of the header is being painted
The default value is 0.
\variable QStyleOptionHeader::text
the text of the header
The default value is an empty string.
\variable QStyleOptionHeader::textAlignment
the alignment flags for the text of the header
The default value is Qt::AlignLeft.
\variable QStyleOptionHeader::icon
the icon of the header
The default value is an empty icon, i.e. an icon with neither a pixmap nor a filename.
\variable QStyleOptionHeader::iconAlignment
the alignment flags for the icon of the header
The default value is Qt::AlignLeft.
\variable QStyleOptionHeader::position
the section's position in relation to the other sections
The default value is QStyleOptionHeader::Beginning.
\variable QStyleOptionHeader::selectedPosition
the section's position in relation to the selected section
The default value is QStyleOptionHeader::NotAdjacent
\variable QStyleOptionHeader::sortIndicator
the direction the sort indicator should be drawn
The default value is QStyleOptionHeader::None.
This enum lets you know where the section's position is in relation to the other sections.
\value Beginning At the beginining of the header \value Middle In the middle of the header \value End At the end of the header \value OnlyOneSection Only one header section
Enumerator | |
---|---|
Beginning | |
Middle | |
End | |
OnlyOneSection |
Definition at line 173 of file qstyleoption.h.
This enum lets you know where the section's position is in relation to the selected section.
\value NotAdjacent Not adjacent to the selected section \value NextIsSelected The next section is selected \value PreviousIsSelected The previous section is selected \value NextAndPreviousAreSelected Both the next and previous section are selected
Enumerator | |
---|---|
NotAdjacent | |
NextIsSelected | |
PreviousIsSelected | |
NextAndPreviousAreSelected |
Definition at line 174 of file qstyleoption.h.
Indicates which direction the sort indicator should be drawn.
\value None No sort indicator is needed \value SortUp Draw an up indicator \value SortDown Draw a down indicator
Enumerator | |
---|---|
None | |
SortUp | |
SortDown |
Definition at line 176 of file qstyleoption.h.
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_Header} 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.
Enumerator | |
---|---|
Type |
Definition at line 170 of file qstyleoption.h.
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.
Enumerator | |
---|---|
Version |
Definition at line 171 of file qstyleoption.h.
QStyleOptionHeader::QStyleOptionHeader | ( | ) |
Constructs a QStyleOptionHeader, initializing the members variables to their default values.
Definition at line 687 of file qstyleoption.cpp.
|
inline |
\variable QStyleOptionHeader::orientation
the header's orientation (horizontal or vertical)
The default orientation is Qt::Horizontal
Constructs a copy of the other style option.
Definition at line 189 of file qstyleoption.h.
References other().
|
protected |
Definition at line 695 of file qstyleoption.cpp.
|
default |
QIcon QStyleOptionHeader::icon |
Definition at line 181 of file qstyleoption.h.
Qt::Alignment QStyleOptionHeader::iconAlignment |
Definition at line 182 of file qstyleoption.h.
Qt::Orientation QStyleOptionHeader::orientation |
Definition at line 186 of file qstyleoption.h.
SectionPosition QStyleOptionHeader::position |
Definition at line 183 of file qstyleoption.h.
int QStyleOptionHeader::section |
Definition at line 178 of file qstyleoption.h.
SelectedPosition QStyleOptionHeader::selectedPosition |
Definition at line 184 of file qstyleoption.h.
SortIndicator QStyleOptionHeader::sortIndicator |
Definition at line 185 of file qstyleoption.h.
QString QStyleOptionHeader::text |
Definition at line 179 of file qstyleoption.h.
Qt::Alignment QStyleOptionHeader::textAlignment |
Definition at line 180 of file qstyleoption.h.