📄 qstyleoption.cpp
字号:
movable or not, and the ToolBarPosition enum is used to describe the position of a toolbar line, as well as the toolbar's position within the line. For an example demonstrating how style options can be used, see the \l {widgets/styles}{Styles} example. \sa QStyleOption*//*! Constructs a QStyleOptionToolBar, initializing the members variables to their default values.*/QStyleOptionToolBar::QStyleOptionToolBar() : QStyleOption(Version, SO_ToolBar), positionOfLine(OnlyOne), positionWithinLine(OnlyOne), toolBarArea(Qt::TopToolBarArea), features(None), lineWidth(0), midLineWidth(0){}/*! \fn QStyleOptionToolBar::QStyleOptionToolBar(const QStyleOptionToolBar &other) Constructs a copy of the \a other style option.*//*! \internal*/QStyleOptionToolBar::QStyleOptionToolBar(int version): QStyleOption(version, SO_ToolBar), positionOfLine(OnlyOne), positionWithinLine(OnlyOne), toolBarArea(Qt::TopToolBarArea), features(None), lineWidth(0), midLineWidth(0){}/*! \enum QStyleOptionToolBar::ToolBarPosition \image qstyleoptiontoolbar-position.png This enum is used to describe the position of a toolbar line, as well as the toolbar's position within the line. The order of the positions within a line starts at the top of a vertical line, and from the left within a horizontal line. The order of the positions for the lines is always from the the parent widget's boundary edges. \value Beginning The toolbar is located at the beginning of the line, or the toolbar line is the first of several lines. There can only be one toolbar (and only one line) with this position. \value Middle The toolbar is located in the middle of the line, or the toolbar line is in the middle of several lines. There can several toolbars (and lines) with this position. \value End The toolbar is located at the end of the line, or the toolbar line is the last of several lines. There can only be one toolbar (and only one line) with this position. \value OnlyOne There is only one toolbar or line. This is the default value of the positionOfLine and positionWithinLine variables. \sa positionWithinLine, positionOfLine*//*! \enum QStyleOptionToolBar::ToolBarFeature This enum is used to describe whether a toolbar is movable or not. \value None The toolbar cannot be moved. The default value. \value Movable The toolbar is movable, and a handle will appear when holding the cursor over the toolbar's boundary. \sa features, QToolBar::isMovable()*//*! \variable QStyleOptionToolBar::positionOfLine This variable holds the position of the toolbar line. The default value is QStyleOptionToolBar::OnlyOne.*//*! \variable QStyleOptionToolBar::positionWithinLine This variable holds the position of the toolbar within a line. The default value is QStyleOptionToolBar::OnlyOne.*//*! \variable QStyleOptionToolBar::toolBarArea This variable holds the location for drawing the toolbar. The default value is Qt::TopToolBarArea. \sa Qt::ToolBarArea*//*! \variable QStyleOptionToolBar::features This variable holds whether the toolbar is movable or not. The default value is \l None.*//*! \variable QStyleOptionToolBar::lineWidth This variable holds the line width for drawing the toolbar. The default value is 0.*//*! \variable QStyleOptionToolBar::midLineWidth This variable holds the mid-line width for drawing the toolbar. The default value is 0.*//*! \enum QStyleOptionToolBar::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_ToolBar} 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. \sa StyleOptionVersion*//*! \enum QStyleOptionToolBar::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 don't need to check it. \sa StyleOptionType*/#endif#ifndef QT_NO_TABBAR/*! \class QStyleOptionTab \brief The QStyleOptionTab class is used to describe the parameters for drawing a tab bar. The QStyleOptionTab class is used for drawing several built-in Qt widgets including \l QTabBar and the panel for \l QTabWidget. Note that to describe the parameters necessary for drawing a frame in Qt 4.1 or above, you must use the QStyleOptionFrameV2 subclass. An instance of the QStyleOptiontabV2 class has type \l SO_Tab and \l version 1. 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. The version is used by QStyleOption subclasses to implement extensions without breaking compatibility. If you use qstyleoption_cast(), you normally don't need to check it. If you create your own QStyle subclass, you should handle both QStyleOptionTab and QStyleOptionTabV2. For an example demonstrating how style options can be used, see the \l {widgets/styles}{Styles} example. \sa QStyleOptionTabV2, QStyleOption*//*! Constructs a QStyleOptionTab object, initializing the members variables to their default values.*/QStyleOptionTab::QStyleOptionTab() : QStyleOption(QStyleOptionTab::Version, SO_Tab), shape(QTabBar::RoundedNorth), row(0), position(Beginning), selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets){}/*! \internal*/QStyleOptionTab::QStyleOptionTab(int version) : QStyleOption(version, SO_Tab), shape(QTabBar::RoundedNorth), row(0), position(Beginning), selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets){}/*! \fn QStyleOptionTab::QStyleOptionTab(const QStyleOptionTab &other) Constructs a copy of the \a other style option.*//*! \enum QStyleOptionTab::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_Tab} 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. \sa StyleOptionVersion*//*! \enum QStyleOptionTab::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 don't need to check it. \sa StyleOptionType*//*! \enum QStyleOptionTab::TabPosition This enum describes the position of the tab. \value Beginning The tab is the first tab in the tab bar. \value Middle The tab is neither the first nor the last tab in the tab bar. \value End The tab is the last tab in the tab bar. \value OnlyOneTab The tab is both the first and the last tab in the tab bar. \sa position*//*! \enum QStyleOptionTab::CornerWidget These flags indicate the corner widgets in a tab. \value NoCornerWidgets There are no corner widgets \value LeftCornerWidget Left corner widget \value RightCornerWidget Right corner widget \sa cornerWidgets*//*! \enum QStyleOptionTab::SelectedPosition This enum describes the position of the selected tab. Some styles need to draw a tab differently depending on whether or not it is adjacent to the selected tab. \value NotAdjacent The tab is not adjacent to a selected tab (or is the selected tab). \value NextIsSelected The next tab (typically the tab on the right) is selected. \value PreviousIsSelected The previous tab (typically the tab on the left) is selected. \sa selectedPosition*//*! \variable QStyleOptionTab::selectedPosition \brief the position of the selected tab in relation to this tab The default value is NotAdjacent, i.e. the tab is not adjacent to a selected tab nor is it the selected tab.*//*! \variable QStyleOptionTab::cornerWidgets \brief an OR combination of CornerWidget values indicating the corner widgets of the tab bar The default value is NoCornerWidgets. \sa CornerWidget*//*! \variable QStyleOptionTab::shape \brief the tab shape used to draw the tab; by default QTabBar::RoundedNorth \sa QTabBar::Shape*//*! \variable QStyleOptionTab::text \brief the text of the tab The default value is an empty string.*//*! \variable QStyleOptionTab::icon \brief the icon for the tab The default value is an empty icon, i.e. an icon with neither a pixmap nor a filename.*//*! \variable QStyleOptionTab::row \brief which row the tab is currently in The default value is 0, indicating the front row. Currently this property can only be 0.*//*! \variable QStyleOptionTab::position \brief the position of the tab in the tab bar The default value is \l Beginning, i.e. the tab is the first tab in the tab bar.*//*! \class QStyleOptionTabV2 \brief The QStyleOptionTabV2 class is used to describe the parameters necessary for drawing a tabs in Qt 4.1 or above. \since 4.1 An instance of the QStyleOptionTabV2 class has type \l SO_Tab and \l version 2. 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. The version is used by QStyleOption subclasses to implement extensions without breaking compatibility. If you use qstyleoption_cast(), you normally don't need to check it. If you create your own QStyle subclass, you should handle both QStyleOptionTab and QStyleOptionTabV2. One way to achieve this is to use the QStyleOptionTabV2 copy constructor. For example: \quotefromfile snippets/qstyleoption/main.cpp \skipto MyStyle::MyStyle() \skipto *tabOption \printuntil } In the example above: If \c tabOption's version is 1, the extra member (\l iconSize) will be set to an invalid size for \c tabV2. If \c tabOption's version is 2, the constructor will simply copy the \c tab's iconSize. For an example demonstrating how style options can be used, see the \l {widgets/styles}{Styles} example. \sa QStyleOptionTab, QStyleOption*//*! \enum QStyleOptionTabV2::StyleOptionVersion This enum is used to hold information about the version of the style option, and is defined for each QStyleOption subclass. \value Version 2 The version is used by QStyleOption subclasses to implement extensions without breaking compatibility. If you use qstyleoption_cast(), you normally don't need to check it. \sa StyleOptionType*//*! \variable QStyleOptionTabV2::iconSize \brief the size for the icons The default value is QSize(-1, -1), i.e. an invalid size; use QStyle::pixelMetric() to find the default icon size for tab bars. \sa QTabBar::iconSize()*//*! Constructs a QStyleOptionTabV2.*/QStyleOptionTabV2::QStyleOptionTabV2() : QStyleOptionTab(Version){}/*! \internal*/QStyleOptionTabV2::QStyleOptionTabV2(int version) : QStyleOptionTab(version){}/*! \fn QStyleOptionTabV2::QStyleOptionTabV2(const QStyleOptionTabV2 &other) Constructs a copy of the \a other style option.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -