1
/****************************************************************************
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
5
** This file is part of the style module of the Qt Toolkit.
7
** This file may be distributed under the terms of the Q Public License
8
** as defined by Trolltech AS of Norway and appearing in the file
9
** LICENSE.QPL included in the packaging of this file.
11
** This file may be distributed and/or modified under the terms of the
12
** GNU General Public License version 2 as published by the Free Software
13
** Foundation and appearing in the file LICENSE.GPL included in the
14
** packaging of this file.
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
17
** information about Qt Commercial License Agreements.
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
21
** Contact info@trolltech.com if any conditions of this licensing are
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
27
****************************************************************************/
29
#include "qstyleoption.h"
30
#include "qapplication.h"
32
# include "private/qt_mac_p.h"
40
\brief The QStyleOption class stores the parameters used by QStyle functions.
44
QStyleOption and its subclasses contain all the information that
45
QStyle functions need to draw a graphical element.
47
For performance reasons, there are few member functions and the
48
access to the member variables is direct (i.e., using the \c . or
49
\c -> operator). This low-level feel makes the structures
50
straightforward to use and emphasizes that these are simply
51
parameters used by the style functions.
53
The caller of a QStyle function usually creates QStyleOption
54
objects on the stack. This combined with Qt's extensive use of
55
\l{implicit sharing} for types such as QString, QPalette, and
56
QColor ensures that no memory allocation needlessly takes place.
58
The following code snippet shows how to use a specific
59
QStyleOption subclass to paint a push button:
62
void MyPushButton::paintEvent()
64
QStyleOptionButton option;
66
option.state = isDown() ? QStyle::State_Sunken : QStyle::State_Raised;
68
option.features |= QStyleOptionButton::DefaultButton;
72
QPainter painter(this);
73
style().drawControl(QStyle::CE_PushButton, &option, &painter, this);
77
In our example, the control is a QStyle::CE_PushButton, and
78
according to the QStyle::drawControl() documentation the
79
corresponding class is QStyleOptionButton.
81
When reimplementing QStyle functions that take a QStyleOption
82
parameter, you often need to cast the QStyleOption to a subclass.
83
For safety, you can use qstyleoption_cast<T>() to ensure that the pointer
84
type is correct. For example:
87
void MyStyle::drawPrimitive(PrimitiveElement element,
88
const QStyleOption *option,
90
const QWidget *widget)
92
if (element == PE_FocusRect) {
93
const QStyleOptionFocusRect *focusRectOption =
94
qstyleoption_cast<const QStyleOptionFocusRect *>(option);
95
if (focusRectOption) {
104
qstyleoption_cast<T>() will return 0 if the object to which \c option
105
points isn't of the correct type.
107
\sa QStyle, QStylePainter
111
\enum QStyleOption::OptionType
113
This enum is used internally by QStyleOption, its subclasses, and
114
qstyleoption_cast() to determine the type of style option. In general you do not need
115
to worry about this unless you want to create your own QStyleOption
116
subclass and your own styles.
118
\value SO_Default QStyleOption
119
\value SO_FocusRect \l QStyleOptionFocusRect
120
\value SO_Button \l QStyleOptionButton
121
\value SO_Tab \l QStyleOptionTab
122
\value SO_TabWidgetFrame \l QStyleOptionTabBarBase
123
\value SO_TabBarBase \l QStyleOptionTabWidgetFrame
124
\value SO_MenuItem \l QStyleOptionMenuItem
125
\value SO_Complex \l QStyleOptionComplex
126
\value SO_Slider \l QStyleOptionSlider
127
\value SO_Frame \l QStyleOptionFrame
128
\value SO_ProgressBar \l QStyleOptionProgressBar
129
\value SO_Q3ListView \l QStyleOptionQ3ListView
130
\value SO_Q3ListViewItem \l QStyleOptionQ3ListViewItem
131
\value SO_Header \l QStyleOptionHeader
132
\value SO_Q3DockWindow \l QStyleOptionQ3DockWindow
133
\value SO_DockWidget \l QStyleOptionDockWidget
134
\value SO_SpinBox \l QStyleOptionSpinBox
135
\value SO_ToolButton \l QStyleOptionToolButton
136
\value SO_ComboBox \l QStyleOptionComboBox
137
\value SO_ToolBox \l QStyleOptionToolBox
138
\value SO_RubberBand \l QStyleOptionRubberBand
139
\value SO_TitleBar \l QStyleOptionTitleBar
140
\value SO_ViewItem \l QStyleOptionViewItem (used in Interviews)
141
\value SO_CustomBase Reserved for custom QStyleOptions;
142
all custom controls values must be above this value
143
\value SO_ComplexCustomBase Reserved for custom QStyleOptions;
144
all custom complex controls values must be above this value
148
Constructs a QStyleOption with version \a version and type \a
151
The version has no special meaning for QStyleOption; it can be
152
used by subclasses to distinguish between different version of
153
the same option type.
155
The \l state member variable is initialized to
161
QStyleOption::QStyleOption(int version, int type)
162
: version(version), type(type), state(QStyle::State_None),
163
direction(QApplication::layoutDirection()), fontMetrics(QFont())
169
Destroys the style option object.
171
QStyleOption::~QStyleOption()
176
Initializes the \l state, \l direction, \l rect, \l palette, and
177
\l fontMetrics member variables based on \a widget.
179
This function is provided only for convenience. You can also
180
initialize the variables manually if you want.
182
void QStyleOption::init(const QWidget *widget)
184
state = QStyle::State_None;
185
if (widget->isEnabled())
186
state |= QStyle::State_Enabled;
187
if (widget->hasFocus())
188
state |= QStyle::State_HasFocus;
189
if (widget->window()->testAttribute(Qt::WA_KeyboardFocusChange))
190
state |= QStyle::State_KeyboardFocusChange;
191
if (widget->underMouse())
192
state |= QStyle::State_MouseOver;
193
if (widget->window()->isActiveWindow())
194
state |= QStyle::State_Active;
196
direction = widget->layoutDirection();
197
rect = widget->rect();
198
palette = widget->palette();
199
fontMetrics = widget->fontMetrics();
203
Constructs a copy of \a other.
205
QStyleOption::QStyleOption(const QStyleOption &other)
206
: version(Version), type(Type), state(other.state),
207
direction(other.direction), rect(other.rect), fontMetrics(other.fontMetrics),
208
palette(other.palette)
213
Assign \a other to this QStyleOption.
215
QStyleOption &QStyleOption::operator=(const QStyleOption &other)
218
direction = other.direction;
220
fontMetrics = other.fontMetrics;
221
palette = other.palette;
226
\variable QStyleOption::Type
232
\variable QStyleOption::Version
238
\variable QStyleOption::palette
239
\brief the palette that should be used when painting the control
243
\variable QStyleOption::direction
244
\brief the text layout direction that should be used when drawing text in the control
248
\variable QStyleOption::fontMetrics
249
\brief the font metrics that should be used when drawing text in the control
253
\variable QStyleOption::rect
254
\brief the area that should be used for various calculations and painting.
256
This can have different meanings for different types of elements.
257
For example, for \l QStyle::CE_PushButton it would be the
258
rectangle for the entire button, while for \l
259
QStyle::CE_PushButtonLabel it would be just the area for the push
264
\variable QStyleOption::state
265
\brief the style flags that are used when drawing the control
267
\sa QStyle::drawPrimitive(), QStyle::drawControl(), QStyle::drawComplexControl(),
272
\variable QStyleOption::type
273
\brief the option type of the style option
279
\variable QStyleOption::version
280
\brief the version of the style option
282
This value can be used by subclasses to implement extensions
283
without breaking compatibility. If you use qstyleoption_cast<T>(), you
284
normally don't need to check it.
288
\class QStyleOptionFocusRect
289
\brief The QStyleOptionFocusRect class is used to describe the
290
parameters for drawing a focus rectangle with QStyle.
294
Constructs a QStyleOptionFocusRect. The members variables are
295
initialized to default values.
298
QStyleOptionFocusRect::QStyleOptionFocusRect()
299
: QStyleOption(Version, SO_FocusRect)
301
state |= QStyle::State_KeyboardFocusChange; // assume we had one, will be corrected in init()
307
QStyleOptionFocusRect::QStyleOptionFocusRect(int version)
308
: QStyleOption(version, SO_FocusRect)
310
state |= QStyle::State_KeyboardFocusChange; // assume we had one, will be corrected in init()
314
\variable QStyleOptionFocusRect::Type
320
\variable QStyleOptionFocusRect::Version
326
\fn QStyleOptionFocusRect::QStyleOptionFocusRect(const QStyleOptionFocusRect &other)
328
Constructs a copy of the \a other style option.
332
\variable QStyleOptionFocusRect::backgroundColor
333
\brief The background color on which the focus rectangle is being drawn.
337
\class QStyleOptionFrame
338
\brief The QStyleOptionFrame class is used to describe the
339
parameters for drawing a frame.
341
QStyleOptionFrame is used for drawing several built-in Qt widget,
342
including QFrame, QGroupBox, QLineEdit, and QMenu.
346
Constructs a QStyleOptionFrame. The members variables are
347
initialized to default values.
350
QStyleOptionFrame::QStyleOptionFrame()
351
: QStyleOption(Version, SO_Frame), lineWidth(0), midLineWidth(0)
358
QStyleOptionFrame::QStyleOptionFrame(int version)
359
: QStyleOption(version, SO_Frame), lineWidth(0), midLineWidth(0)
364
\fn QStyleOptionFrame::QStyleOptionFrame(const QStyleOptionFrame &other)
366
Constructs a copy of the \a other style option.
370
\variable QStyleOptionFrame::Type
376
\variable QStyleOptionFrame::Version
382
\variable QStyleOptionFrame::lineWidth
383
\brief The line width for drawing the panel.
387
\variable QStyleOptionFrame::midLineWidth
388
\brief The mid-line width for drawing the panel. This is usually used in
389
drawing sunken or raised frames.
393
\class QStyleOptionHeader
394
\brief The QStyleOptionHeader class is used to describe the
395
parameters for drawing a header.
397
The QStyleOptionHeader class is used for drawing the item views'
398
header pane, header sort arrow, and header label.
402
Constructs a QStyleOptionHeader. The members variables are
403
initialized to default values.
406
QStyleOptionHeader::QStyleOptionHeader()
407
: QStyleOption(QStyleOptionHeader::Version, SO_Header),
408
section(0), textAlignment(0), iconAlignment(0),
409
position(QStyleOptionHeader::Beginning),
410
selectedPosition(QStyleOptionHeader::NotAdjacent), sortIndicator(None),
411
orientation(Qt::Horizontal)
418
QStyleOptionHeader::QStyleOptionHeader(int version)
419
: QStyleOption(version, SO_Header),
420
section(0), textAlignment(0), iconAlignment(0),
421
position(QStyleOptionHeader::Beginning),
422
selectedPosition(QStyleOptionHeader::NotAdjacent), sortIndicator(None),
423
orientation(Qt::Horizontal)
428
\variable QStyleOptionHeader::orientation
429
\brief the header's orientation (horizontal or vertical)
435
\fn QStyleOptionHeader::QStyleOptionHeader(const QStyleOptionHeader &other)
437
Constructs a copy of the \a other style option.
441
\variable QStyleOptionHeader::Type
447
\variable QStyleOptionHeader::Version
453
\variable QStyleOptionHeader::section
454
\brief Which section of the header is being painted.
458
\variable QStyleOptionHeader::text
459
\brief The text of the header.
463
\variable QStyleOptionHeader::textAlignment
464
\brief The alignment flags for the text of the header.
470
\variable QStyleOptionHeader::icon
471
\brief The icon of the header.
475
\variable QStyleOptionHeader::iconAlignment
476
\brief The alignment flags for the icon of the header.
482
\variable QStyleOptionHeader::position
483
\brief the section's position in relation to the other sections
487
\variable QStyleOptionHeader::selectedPosition
488
\brief the section's position in relation to the selected section
492
\variable QStyleOptionHeader::sortIndicator
493
\brief the direction the sort indicator should be drawn
497
\enum QStyleOptionHeader::SectionPosition
499
This enum lets you know where the section's position is in relation to the other sections.
501
\value Beginning At the beginining of the header
502
\value Middle In the middle of the header
503
\value End At the end of the header
504
\value OnlyOneSection Only one header section
508
\enum QStyleOptionHeader::SelectedPosition
510
This enum lets you know where the section's position is in relation to the selected section.
512
\value NotAdjacent Not adjacent to the selected section
513
\value NextIsSelected The next section is selected
514
\value PreviousIsSelected The previous section is selected
515
\value NextAndPreviousAreSelected Both the next and previous section are selected
519
\enum QStyleOptionHeader::SortIndicator
521
Indicates which direction the sort indicator should be drawn
522
\value None No sort indicator is needed
523
\value SortUp Draw an up indicator
524
\value SortDown Draw a down indicator
528
\class QStyleOptionButton
529
\brief The QStyleOptionButton class is used to describe the
530
parameters for drawing buttons.
532
The QStyleOptionButton class is used to draw \l QPushButton, \l
533
QCheckBox, and \l QRadioButton.
535
\sa QStyleOptionToolButton
539
\enum QStyleOptionButton::ButtonFeature
541
This enum describles the different types of features a push button can have.
543
\value None Indicates a normal push button.
544
\value Flat Indicates a flat push button.
545
\value HasMenu Indicates that the button has a drop down menu.
546
\value DefaultButton Indicates that the button is a default button.
547
\value AutoDefaultButton Indicates that the button is an auto default button.
553
Constructs a QStyleOptionButton. The members variables are
554
initialized to default values.
557
QStyleOptionButton::QStyleOptionButton()
558
: QStyleOption(QStyleOptionButton::Version, SO_Button), features(None)
565
QStyleOptionButton::QStyleOptionButton(int version)
566
: QStyleOption(version, SO_Button), features(None)
571
\fn QStyleOptionButton::QStyleOptionButton(const QStyleOptionButton &other)
573
Constructs a copy of the \a other style option.
577
\variable QStyleOptionButton::Type
583
\variable QStyleOptionButton::Version
589
\variable QStyleOptionButton::features
590
\brief The features for the button
592
This variable is a bitwise OR of the features that describe this button.
598
\variable QStyleOptionButton::text
599
\brief The text of the button.
603
\variable QStyleOptionButton::icon
604
\brief The icon of the button.
610
\variable QStyleOptionButton::iconSize
611
\brief The size of the icon for the button
615
\class QStyleOptionTab
616
\brief The QStyleOptionTab class is used to describe the
617
parameters for drawing a tab bar.
619
The QStyleOptionTab class is used for drawing \l QTabBar and the
620
pane for \l QTabWidget.
624
Constructs a QStyleOptionTab object. The members variables are
625
initialized to default values.
628
QStyleOptionTab::QStyleOptionTab()
629
: QStyleOption(QStyleOptionTab::Version, SO_Tab),
630
shape(QTabBar::RoundedNorth),
633
selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets)
640
QStyleOptionTab::QStyleOptionTab(int version)
641
: QStyleOption(version, SO_Tab),
642
shape(QTabBar::RoundedNorth),
645
selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets)
650
\fn QStyleOptionTab::QStyleOptionTab(const QStyleOptionTab &other)
652
Constructs a copy of the \a other style option.
656
\variable QStyleOptionTab::Type
662
\variable QStyleOptionTab::Version
667
/*! \enum QStyleOptionTab::TabPosition
669
\value Beginning The tab is the first tab in the tab bar.
670
\value Middle The tab is neither the first nor the last tab in the tab bar.
671
\value End The tab is the last tab in the tab bar.
672
\value OnlyOneTab The tab is both the first and the last tab in the tab bar.
678
\enum QStyleOptionTab::CornerWidget
680
These flags indicate the corner widgets in a tab.
682
\value NoCornerWidgets There are no corner widgets
683
\value LeftCornerWidget Left corner widget
684
\value RightCornerWidget Right corner widget
689
/*! \enum QStyleOptionTab::SelectedPosition
691
\value NotAdjacent The tab is not adjacent to a selected tab (or is the selected tab).
692
\value NextIsSelected The next tab (typically the tab on the right) is selected.
693
\value PreviousIsSelected The previous tab (typically the tab on the left) is selected.
699
\variable QStyleOptionTab::selectedPosition
701
\brief The position of the selected tab in relation to this tab. Some styles
702
need to draw a tab differently depending on whether or not it is adjacent
707
\variable QStyleOptionTab::cornerWidgets
709
\brief Information on the cornerwidgets of the tab bar.
716
\variable QStyleOptionTab::shape
717
\brief The tab shape used to draw the tab.
722
\variable QStyleOptionTab::text
723
\brief The text of the tab.
727
\variable QStyleOptionTab::icon
728
\brief The icon for the tab.
732
\variable QStyleOptionTab::row
733
\brief which row the tab is currently in
735
0 indicates the front row.
737
Currently this property can only be 0.
741
\variable QStyleOptionTab::position
742
\brief the position of the tab in the tab bar
746
\class QStyleOptionProgressBar
747
\brief The QStyleOptionProgressBar class is used to describe the
748
parameters necessary for drawing a progress bar.
750
The QStyleOptionProgressBar class is used to draw \l QProgressBar.
754
Constructs a QStyleOptionProgressBar. The members variables are
755
initialized to default values.
758
QStyleOptionProgressBar::QStyleOptionProgressBar()
759
: QStyleOption(QStyleOptionProgressBar::Version, SO_ProgressBar),
760
minimum(0), maximum(0), progress(0), textAlignment(0), textVisible(false)
767
QStyleOptionProgressBar::QStyleOptionProgressBar(int version)
768
: QStyleOption(version, SO_ProgressBar),
769
minimum(0), maximum(0), progress(0), textAlignment(0), textVisible(false)
774
\fn QStyleOptionProgressBar::QStyleOptionProgressBar(const QStyleOptionProgressBar &other)
776
Constructs a copy of the \a other style option.
780
\variable QStyleOptionProgressBar::Type
782
Equals SO_ProgressBar.
786
\variable QStyleOptionProgressBar::Version
792
\variable QStyleOptionProgressBar::minimum
793
\brief The minimum value for the progress bar
795
This is the minimum value in the progress bar.
796
\sa QProgressBar::minimum
800
\variable QStyleOptionProgressBar::maximum
801
\brief The maximum value for the progress bar
803
This is the maximum value in the progress bar.
804
\sa QProgressBar::maximum
808
\variable QStyleOptionProgressBar::text
809
\brief The text for the progress bar.
811
The progress bar text is usually just the progress expressed as a string.
812
An empty string indicates that the progress bar has not started yet.
814
\sa QProgressBar::text
818
\variable QStyleOptionProgressBar::textVisible
819
\brief A flag indicating whether or not text is visible.
821
If this flag is true then the text is visible. Otherwise, the text is not visible.
823
\sa QProgressBar::textVisible
828
\variable QStyleOptionProgressBar::textAlignment
829
\brief The text alignment for the text in the QProgressBar
831
This can be used as a guide on where the text should be in the progressbar.
835
\variable QStyleOptionProgressBar::progress
836
\brief the current progress for the progress bar.
838
The current progress. A value of QStyleOptionProgressBar::minimum - 1
839
indicates that the progress hasn't started yet.
841
\sa QProgressBar::value
845
\class QStyleOptionMenuItem
846
\brief The QStyleOptionMenuItem class is used to describe the
847
parameter necessary for drawing a menu item.
849
The QStyleOptionMenuItem is used for drawing menu items from \l
850
QMenu. It is also used for drawing other menu-related widgets.
854
Constructs a QStyleOptionMenuItem. The members variables are
855
initialized to default values.
858
QStyleOptionMenuItem::QStyleOptionMenuItem()
859
: QStyleOption(QStyleOptionMenuItem::Version, SO_MenuItem), menuItemType(Normal),
860
checkType(NotCheckable), checked(false), menuHasCheckableItems(true), maxIconWidth(0), tabWidth(0)
867
QStyleOptionMenuItem::QStyleOptionMenuItem(int version)
868
: QStyleOption(version, SO_MenuItem), menuItemType(Normal),
869
checkType(NotCheckable), checked(false), menuHasCheckableItems(true), maxIconWidth(0), tabWidth(0)
874
\fn QStyleOptionMenuItem::QStyleOptionMenuItem(const QStyleOptionMenuItem &other)
876
Constructs a copy of the \a other style option.
880
\variable QStyleOptionMenuItem::Type
886
\variable QStyleOptionMenuItem::Version
892
\enum QStyleOptionMenuItem::MenuItemType
894
These values indicate the type of menu item that the structure describes.
896
\value Normal A normal menu item.
897
\value DefaultItem A menu item that is the default action as specified with \l QMenu::defaultAction().
898
\value Separator A menu separator.
899
\value SubMenu Indicates the menu item points to a sub-menu.
900
\value Scroller A popup menu scroller (currently only used on Mac OS X).
901
\value TearOff A tear-off handle for the menu.
902
\value Margin The margin of the menu.
903
\value EmptyArea The empty area of the menu.
907
\enum QStyleOptionMenuItem::CheckType
909
These enums are used to indicate whether or not a check mark should be
910
drawn for the item, or even if it should be drawn at all.
912
\value NotCheckable The item is not checkable.
913
\value Exclusive The item is an exclusive check item (like a radio button).
914
\value NonExclusive The item is a non-exclusive check item (like a check box).
916
\sa QAction::checkable, QAction::checked, QActionGroup::exclusive
920
\variable QStyleOptionMenuItem::menuItemType
922
\brief the type of menu item
928
\variable QStyleOptionMenuItem::checkType
929
\brief The type of checkmark of the menu item
934
\variable QStyleOptionMenuItem::checked
935
\brief whether the menu item is checked or not.
939
\variable QStyleOptionMenuItem::menuHasCheckableItems
940
\brief whether the menu as a whole has checkable items or not.
942
If this option is set to false, then the menu has no checkable
943
items. This makes it possible for GUI styles to save some
944
horizontal space that would normally be used for the check column.
948
\variable QStyleOptionMenuItem::menuRect
949
\brief The rectangle for the entire menu.
953
\variable QStyleOptionMenuItem::text
954
\brief The text for the menu item.
956
Note that the text format is something like this "Menu
957
text\bold{\\t}Shortcut".
959
If the menu item doesn't have a shortcut, it will just contain
960
the menu item's text.
964
\variable QStyleOptionMenuItem::icon
965
\brief The icon for the menu item.
969
\variable QStyleOptionMenuItem::maxIconWidth
970
\brief the maximum icon width for the icon in the menu item.
972
This can be used for drawing the icon into the correct place or
973
properly aligning items. The variable must be set regardless of
974
whether or not the menu item has an icon.
978
\variable QStyleOptionMenuItem::tabWidth
979
\brief The tab width for the menu item.
981
The tab width is the distance between the text of the menu item
987
\variable QStyleOptionMenuItem::font
988
\brief The font used for the menu item text.
990
This is the font that should be used for drawing the menu text minus the
991
shortcut. The shortcut is usually drawn using the painter's font.
995
\class QStyleOptionComplex
996
\brief The QStyleOptionComplex class is used to hold parameters that are
997
common to all complex controls.
999
This class is not used on its own. Instead it is used to derive other
1000
complex control options, for example \l QStyleOptionSlider and
1001
\l QStyleOptionSpinBox.
1005
Constructs a QStyleOptionComplex of type \a type and version \a
1006
version. Usually this constructor is called by subclasses.
1008
The \l subControls member is initialized to \l QStyle::SC_All.
1009
The \l activeSubControls member is initialized to \l
1013
QStyleOptionComplex::QStyleOptionComplex(int version, int type)
1014
: QStyleOption(version, type), subControls(QStyle::SC_All), activeSubControls(QStyle::SC_None)
1019
\fn QStyleOptionComplex::QStyleOptionComplex(const QStyleOptionComplex &other)
1021
Constructs a copy of the \a other style option.
1025
\variable QStyleOptionComplex::Type
1031
\variable QStyleOptionComplex::Version
1037
\variable QStyleOptionComplex::subControls
1038
\brief The sub-controls that need to be painted.
1040
This is a bitwise OR of the various sub-controls that need to be drawn for the complex control.
1042
\sa QStyle::SubControl
1046
\variable QStyleOptionComplex::activeSubControls
1047
\brief The sub-controls that are active for the complex control.
1049
This a bitwise OR of the various sub-controls that are active (pressed) for the complex control.
1051
\sa QStyle::SubControl
1055
\class QStyleOptionSlider
1056
\brief The QStyleOptionSlider class is used to describe the
1057
parameters needed for drawing a slider.
1059
The QStyleOptionSlider class is used for drawing \l QSlider and
1064
Constructs a QStyleOptionSlider. The members variables are
1065
initialized to default values.
1068
QStyleOptionSlider::QStyleOptionSlider()
1069
: QStyleOptionComplex(Version, SO_Slider), orientation(Qt::Horizontal), minimum(0), maximum(0),
1070
tickPosition(QSlider::NoTicks), tickInterval(0), upsideDown(false),
1071
sliderPosition(0), sliderValue(0), singleStep(0), pageStep(0), notchTarget(0.0),
1079
QStyleOptionSlider::QStyleOptionSlider(int version)
1080
: QStyleOptionComplex(version, SO_Slider), orientation(Qt::Horizontal), minimum(0), maximum(0),
1081
tickPosition(QSlider::NoTicks), tickInterval(0), upsideDown(false),
1082
sliderPosition(0), sliderValue(0), singleStep(0), pageStep(0), notchTarget(0.0),
1088
\fn QStyleOptionSlider::QStyleOptionSlider(const QStyleOptionSlider &other)
1090
Constructs a copy of the \a other style option.
1094
\variable QStyleOptionSlider::Type
1100
\variable QStyleOptionSlider::Version
1106
\variable QStyleOptionSlider::orientation
1107
\brief the slider's orientation (horizontal or vertical)
1113
\variable QStyleOptionSlider::minimum
1114
\brief The minimum value for the slider.
1118
\variable QStyleOptionSlider::maximum
1119
\brief The maximum value for the slider.
1123
\variable QStyleOptionSlider::tickPosition
1124
\brief the position of the slider's tick marks, if any.
1126
\sa QSlider::TickPosition
1130
\variable QStyleOptionSlider::tickInterval
1131
\brief The interval that should be drawn between tick marks.
1135
\variable QStyleOptionSlider::notchTarget
1136
\brief The number of pixel between notches
1138
\sa QDial::notchTarget()
1142
\variable QStyleOptionSlider::dialWrapping
1143
\brief Indicates whether or not the dial should wrap or not
1145
\sa QDial::wrapping()
1149
\variable QStyleOptionSlider::upsideDown
1150
\brief Indicates slider control orientation.
1152
Normally a slider increases as it moves up or to the right; upsideDown
1153
indicates that it should do the opposite (increase as it moves down or to
1156
\sa QStyle::sliderPositionFromValue(), QStyle::sliderValueFromPosition(),
1157
QAbstractSlider::invertedAppearance
1161
\variable QStyleOptionSlider::sliderPosition
1162
\brief The position of the slider handle.
1164
If the slider has active feedback (i.e.,
1165
QAbstractSlider::tracking is true), this value will be the same
1166
as \l sliderValue. Otherwise, it will have the current position
1169
\sa QAbstractSlider::tracking, sliderValue
1173
\variable QStyleOptionSlider::sliderValue
1174
\brief The value of the slider.
1176
If the slider has active feedback (i.e.,
1177
QAbstractSlider::tracking is true), this value will be the same
1178
as \l sliderPosition. Otherwise, it will have the value the
1179
slider had before the mouse was pressed.
1181
\sa QAbstractSlider::tracking sliderPosition
1185
\variable QStyleOptionSlider::singleStep
1186
\brief The size of the single step of the slider.
1188
\sa QAbstractSlider::singleStep
1192
\variable QStyleOptionSlider::pageStep
1193
\brief The size of the page step of the slider.
1195
\sa QAbstractSlider::pageStep
1199
\class QStyleOptionSpinBox
1200
\brief The QStyleOptionSpinBox class is used to describe the
1201
parameters necessary for drawing a spin box.
1203
The QStyleOptionSpinBox is used for drawing QSpinBox and QDateTimeEdit.
1207
Constructs a QStyleOptionSpinBox. The members variables are
1208
initialized to default values.
1211
QStyleOptionSpinBox::QStyleOptionSpinBox()
1212
: QStyleOptionComplex(Version, SO_SpinBox), buttonSymbols(QAbstractSpinBox::UpDownArrows),
1213
stepEnabled(QAbstractSpinBox::StepNone), frame(false)
1220
QStyleOptionSpinBox::QStyleOptionSpinBox(int version)
1221
: QStyleOptionComplex(version, SO_SpinBox), buttonSymbols(QAbstractSpinBox::UpDownArrows),
1222
stepEnabled(QAbstractSpinBox::StepNone), frame(false)
1227
\fn QStyleOptionSpinBox::QStyleOptionSpinBox(const QStyleOptionSpinBox &other)
1229
Constructs a copy of the \a other style option.
1233
\variable QStyleOptionSpinBox::Type
1239
\variable QStyleOptionSpinBox::Version
1245
\variable QStyleOptionSpinBox::buttonSymbols
1246
\brief The type of button symbols to draw for the spin box.
1248
\sa QAbstractSpinBox::ButtonSymbols
1252
\variable QStyleOptionSpinBox::stepEnabled
1253
\brief Indicates which buttons of the spin box are enabled.
1255
\sa QAbstractSpinBox::StepEnabled
1259
\variable QStyleOptionSpinBox::frame
1260
\brief Indicates whether whether the spin box has a frame.
1265
\class QStyleOptionQ3ListViewItem
1266
\brief The QStyleOptionQ3ListViewItem class is used to describe an
1267
item drawn in a Q3ListView.
1269
This is used by the compatibility Q3ListView to draw its items.
1270
It should be avoided for new classes.
1272
\sa Q3ListView, Q3ListViewItem
1276
\enum QStyleOptionQ3ListViewItem::Q3ListViewItemFeature
1278
This enum describes the features a list view item can have.
1280
\value None A standard item.
1281
\value Expandable The item has children that can be shown.
1282
\value MultiLine The item is more than one line tall.
1283
\value Visible The item is visible.
1284
\value ParentControl The item's parent is a type of item control (Q3CheckListItem::Controller).
1286
\sa features, Q3ListViewItem::isVisible(), Q3ListViewItem::multiLinesEnabled(),
1287
Q3ListViewItem::isExpandable()
1291
Constructs a QStyleOptionQ3ListViewItem. The members variables are
1292
initialized to default values.
1295
QStyleOptionQ3ListViewItem::QStyleOptionQ3ListViewItem()
1296
: QStyleOption(Version, SO_Q3ListViewItem), features(None), height(0), totalHeight(0),
1297
itemY(0), childCount(0)
1304
QStyleOptionQ3ListViewItem::QStyleOptionQ3ListViewItem(int version)
1305
: QStyleOption(version, SO_Q3ListViewItem), features(None), height(0), totalHeight(0),
1306
itemY(0), childCount(0)
1311
\fn QStyleOptionQ3ListViewItem::QStyleOptionQ3ListViewItem(const QStyleOptionQ3ListViewItem &other)
1313
Constructs a copy of the \a other style option.
1317
\variable QStyleOptionQ3ListViewItem::Type
1319
Equals SO_Q3ListViewItem.
1323
\variable QStyleOptionQ3ListViewItem::Version
1329
\variable QStyleOptionQ3ListViewItem::features
1330
\brief The features for this item
1332
This variable is a bitwise OR of the features of the item.
1334
\sa Q3ListViewItemFeature
1338
\variable QStyleOptionQ3ListViewItem::height
1339
\brief The height of the item
1341
This doesn't include the height of the item's children.
1343
\sa Q3ListViewItem::height()
1347
\variable QStyleOptionQ3ListViewItem::totalHeight
1348
\brief The total height of the item, including its children
1350
\sa Q3ListViewItem::totalHeight()
1354
\variable QStyleOptionQ3ListViewItem::itemY
1355
\brief The Y-coordinate for the item
1357
\sa Q3ListViewItem::itemPos()
1361
\variable QStyleOptionQ3ListViewItem::childCount
1362
\brief The number of children the item has.
1366
\class QStyleOptionQ3ListView
1367
\brief The QStyleOptionQ3ListView class is used to describe the
1368
parameters for drawing a Q3ListView.
1370
The class is used for drawing the compat \l Q3ListView. It is not
1371
recommended for use in new code.
1375
Creates a QStyleOptionQ3ListView. The members variables are
1376
initialized to default values.
1379
QStyleOptionQ3ListView::QStyleOptionQ3ListView()
1380
: QStyleOptionComplex(Version, SO_Q3ListView), sortColumn(0), itemMargin(0), treeStepSize(0),
1381
rootIsDecorated(false)
1388
QStyleOptionQ3ListView::QStyleOptionQ3ListView(int version)
1389
: QStyleOptionComplex(version, SO_Q3ListView), sortColumn(0), itemMargin(0), treeStepSize(0),
1390
rootIsDecorated(false)
1395
\fn QStyleOptionQ3ListView::QStyleOptionQ3ListView(const QStyleOptionQ3ListView &other)
1397
Constructs a copy of the \a other style option.
1401
\variable QStyleOptionQ3ListView::Type
1403
Equals SO_Q3ListView.
1407
\variable QStyleOptionQ3ListView::Version
1413
\variable QStyleOptionQ3ListView::items
1414
\brief A list of items in the \l Q3ListView.
1416
This is a list of \l {QStyleOptionQ3ListViewItem}s. The first item
1417
can be used for most of the calculation that are needed for
1418
drawing a list view. Any additional items are the children of
1419
this first item, which may be used for additional information.
1421
\sa QStyleOptionQ3ListViewItem
1425
\variable QStyleOptionQ3ListView::viewportPalette
1426
\brief The palette of Q3ListView's viewport.
1430
\variable QStyleOptionQ3ListView::viewportBGRole
1431
\brief The background role of \l Q3ListView's viewport.
1433
\sa QWidget::backgroundRole()
1437
\variable QStyleOptionQ3ListView::sortColumn
1438
\brief The sort column of the list view.
1440
\sa Q3ListView::sortColumn()
1444
\variable QStyleOptionQ3ListView::itemMargin
1445
\brief The margin for items in the list view.
1447
\sa Q3ListView::itemMargin()
1451
\variable QStyleOptionQ3ListView::treeStepSize
1452
\brief The number of pixel to offset children items from their parents.
1454
\sa Q3ListView::treeStepSize()
1458
\variable QStyleOptionQ3ListView::rootIsDecorated
1459
\brief Whether root items are decorated
1461
\sa Q3ListView::rootIsDecorated()
1465
\class QStyleOptionQ3DockWindow
1466
\brief The QStyleOptionQ3DockWindow class is used to describe the
1467
parameters for drawing various parts of a \l Q3DockWindow.
1469
This class is used for drawing the old Q3DockWindow and its
1470
parts. It is not recommended for new classes.
1474
Constructs a QStyleOptionQ3DockWindow. The member variables are
1475
initialized to default values.
1478
QStyleOptionQ3DockWindow::QStyleOptionQ3DockWindow()
1479
: QStyleOption(Version, SO_Q3DockWindow), docked(false), closeEnabled(false)
1486
QStyleOptionQ3DockWindow::QStyleOptionQ3DockWindow(int version)
1487
: QStyleOption(version, SO_Q3DockWindow), docked(false), closeEnabled(false)
1492
\fn QStyleOptionQ3DockWindow::QStyleOptionQ3DockWindow(const QStyleOptionQ3DockWindow &other)
1494
Constructs a copy of the \a other style option.
1498
\variable QStyleOptionQ3DockWindow::Type
1500
Equals SO_Q3DockWindow.
1504
\variable QStyleOptionQ3DockWindow::Version
1510
\variable QStyleOptionQ3DockWindow::docked
1511
\brief Indicates that the dock window is currently docked.
1515
\variable QStyleOptionQ3DockWindow::closeEnabled
1516
\brief Indicates that the dock window has a close button.
1520
\class QStyleOptionDockWidget
1521
\brief The QStyleOptionDockWidget class is used to describe the
1522
parameters for drawing a dock window.
1526
Constructs a QStyleOptionDockWidget. The member variables are
1527
initialized to default values.
1530
QStyleOptionDockWidget::QStyleOptionDockWidget()
1531
: QStyleOption(Version, SO_DockWidget), movable(false)
1538
QStyleOptionDockWidget::QStyleOptionDockWidget(int version)
1539
: QStyleOption(version, SO_DockWidget), closable(false),
1540
movable(false), floatable(false)
1545
\fn QStyleOptionDockWidget::QStyleOptionDockWidget(const QStyleOptionDockWidget &other)
1547
Constructs a copy of the \a other style option.
1551
\variable QStyleOptionDockWidget::Type
1553
Equals SO_DockWidget.
1557
\variable QStyleOptionDockWidget::Version
1563
\variable QStyleOptionDockWidget::title
1564
\brief The title of the dock window
1568
\variable QStyleOptionDockWidget::closable
1569
\brief Indicates that the dock window is closable.
1573
\variable QStyleOptionDockWidget::movable
1574
\brief Indicates that the dock window is movable.
1578
\variable QStyleOptionDockWidget::floatable
1579
\brief Indicates that the dock window is floatable.
1583
\class QStyleOptionToolButton
1584
\brief The QStyleOptionToolButton class is used to describe the
1585
parameters for drawing a tool button.
1587
The QStyleOptionToolButton class is used for drawing QToolButton.
1591
\enum QStyleOptionToolButton::ToolButtonFeature
1592
Describes the various features that a tool button can have.
1594
\value None A normal tool button.
1595
\value Arrow The tool button is an arrow.
1596
\value Menu The tool button has a menu.
1597
\value PopupDelay There is a delay to showing the menu.
1599
\sa features, QToolButton::toolButtonStyle(), QToolButton::popupMode()
1603
Constructs a QStyleOptionToolButton. The members variables are
1604
initialized to default values.
1607
QStyleOptionToolButton::QStyleOptionToolButton()
1608
: QStyleOptionComplex(Version, SO_ToolButton), features(None), arrowType(Qt::DownArrow)
1609
, toolButtonStyle(Qt::ToolButtonIconOnly)
1616
QStyleOptionToolButton::QStyleOptionToolButton(int version)
1617
: QStyleOptionComplex(version, SO_ToolButton), features(None), arrowType(Qt::DownArrow)
1618
, toolButtonStyle(Qt::ToolButtonIconOnly)
1624
\fn QStyleOptionToolButton::QStyleOptionToolButton(const QStyleOptionToolButton &other)
1626
Constructs a copy of the \a other style option.
1630
\variable QStyleOptionToolButton::Type
1632
Equals SO_ToolButton.
1636
\variable QStyleOptionToolButton::Version
1642
\variable QStyleOptionToolButton::features
1643
\brief The features of the tool button.
1645
This variable is a bitwise OR describing the features of the button.
1647
\sa ToolButtonFeature
1651
\variable QStyleOptionToolButton::icon
1652
\brief The icon for the tool button.
1658
\variable QStyleOptionToolButton::iconSize
1659
\brief the size of the icon for the tool button
1663
\variable QStyleOptionToolButton::text
1664
\brief The text of the tool button.
1666
This value is only used if toolButtonStyle is Qt::ToolButtonTextUnderIcon,
1667
Qt::ToolButtonTextBesideIcon, or Qt::ToolButtonTextOnly
1671
\variable QStyleOptionToolButton::arrowType
1672
\brief The direction of the arrow for the tool button
1674
This value is only used if \l features includes \l Arrow.
1678
\variable QStyleOptionToolButton::toolButtonStyle
1679
\brief Used to describe the appearance of a tool button
1681
\sa QToolButton::toolButtonStyle()
1685
\variable QStyleOptionToolButton::pos
1686
\brief The position of the tool button
1690
\variable QStyleOptionToolButton::font
1691
\brief The font that is used for the text.
1693
This value is only used if toolButtonStyle is Qt::ToolButtonTextUnderIcon,
1694
Qt::ToolButtonTextBesideIcon, or Qt::ToolButtonTextOnly
1698
\class QStyleOptionComboBox
1699
\brief The QStyleOptionComboBox class is used to describe the
1700
parameter for drawing a combobox.
1702
The QStyleOptionComboBox class is used for drawing QComboBox.
1706
Creates a QStyleOptionComboBox. The members variables are
1707
initialized to default values.
1710
QStyleOptionComboBox::QStyleOptionComboBox()
1711
: QStyleOptionComplex(Version, SO_ComboBox), editable(false), frame(true)
1718
QStyleOptionComboBox::QStyleOptionComboBox(int version)
1719
: QStyleOptionComplex(version, SO_ComboBox), editable(false), frame(true)
1724
\fn QStyleOptionComboBox::QStyleOptionComboBox(const QStyleOptionComboBox &other)
1726
Constructs a copy of the \a other style option.
1730
\variable QStyleOptionComboBox::Type
1736
\variable QStyleOptionComboBox::Version
1742
\variable QStyleOptionComboBox::editable
1743
\brief whether or not the combobox is editable or not.
1745
\sa QComboBox::isEditable()
1750
\variable QStyleOptionComboBox::frame
1751
\brief Indicates whether whether the combo box has a frame.
1755
\variable QStyleOptionComboBox::currentText
1756
\brief The text for the current item of the combo box
1760
\variable QStyleOptionComboBox::currentIcon
1761
\brief The icon for the current item of the combo box
1765
\variable QStyleOptionComboBox::iconSize
1766
\brief The icon size for the current item of the combo box
1770
\variable QStyleOptionComboBox::popupRect
1771
\brief The popup rectangle for the combobox.
1775
\class QStyleOptionToolBox
1776
\brief The QStyleOptionToolBox class is used to describe the
1777
parameters needed for drawing a tool box.
1779
The QStyleOptionToolBox class is used for drawing QToolBox.
1783
Creates a QStyleOptionToolBox. The members variables are
1784
initialized to default values.
1787
QStyleOptionToolBox::QStyleOptionToolBox()
1788
: QStyleOption(Version, SO_ToolBox)
1795
QStyleOptionToolBox::QStyleOptionToolBox(int version)
1796
: QStyleOption(version, SO_ToolBox)
1801
\fn QStyleOptionToolBox::QStyleOptionToolBox(const QStyleOptionToolBox &other)
1803
Constructs a copy of the \a other style option.
1807
\variable QStyleOptionToolBox::Type
1813
\variable QStyleOptionToolBox::Version
1819
\variable QStyleOptionToolBox::icon
1820
\brief The icon for the tool box tab.
1824
\variable QStyleOptionToolBox::text
1825
\brief The text for the tool box tab.
1830
\class QStyleOptionRubberBand
1831
\brief The QStyleOptionRubberBand class is used to describe the
1832
parameters needed for drawing a rubber band.
1834
The QStyleOptionRubberBand class is used for drawing QRubberBand.
1838
Creates a QStyleOptionRubberBand. The members variables are
1839
initialized to default values.
1842
QStyleOptionRubberBand::QStyleOptionRubberBand()
1843
: QStyleOption(Version, SO_RubberBand)
1850
QStyleOptionRubberBand::QStyleOptionRubberBand(int version)
1851
: QStyleOption(version, SO_RubberBand)
1856
\fn QStyleOptionRubberBand::QStyleOptionRubberBand(const QStyleOptionRubberBand &other)
1858
Constructs a copy of the \a other style option.
1862
\variable QStyleOptionRubberBand::Type
1864
Equals SO_RubberBand.
1868
\variable QStyleOptionRubberBand::Version
1874
\variable QStyleOptionRubberBand::shape
1875
\brief The shape of the rubber band.
1879
\variable QStyleOptionRubberBand::opaque
1880
\brief Whether the rubber band is required to be drawn in an opque style.
1884
\class QStyleOptionTitleBar
1885
\brief The QStyleOptionTitleBar class is used to describe the
1886
parameters for drawing a title bar.
1888
The QStyleOptionTitleBar class is used to draw the title bars of
1889
QWorkspace's MDI children.
1893
Constructs a QStyleOptionTitleBar. The members variables are
1894
initialized to default values.
1897
QStyleOptionTitleBar::QStyleOptionTitleBar()
1898
: QStyleOptionComplex(Version, SO_TitleBar), titleBarState(0), titleBarFlags(0)
1903
\fn QStyleOptionTitleBar::QStyleOptionTitleBar(const QStyleOptionTitleBar &other)
1905
Constructs a copy of the \a other style option.
1909
\variable QStyleOptionTitleBar::Type
1915
\variable QStyleOptionTitleBar::Version
1923
QStyleOptionTitleBar::QStyleOptionTitleBar(int version)
1924
: QStyleOptionComplex(version, SO_TitleBar), titleBarState(0), titleBarFlags(0)
1930
\variable QStyleOptionTitleBar::text
1931
\brief The text of the title bar.
1935
\variable QStyleOptionTitleBar::icon
1936
\brief The icon for the title bar.
1940
\variable QStyleOptionTitleBar::titleBarState
1941
\brief The state of the title bar.
1943
This is basically the window state of the underlying widget.
1945
\sa QWidget::windowState()
1949
\variable QStyleOptionTitleBar::titleBarFlags
1950
\brief The widget flags for the title bar.
1956
\class QStyleOptionViewItem
1957
\brief The QStyleOptionViewItem class is used to describe the
1958
parameters used to draw an item in a view widget.
1960
The QStyleOptionViewItem class is used by Qt's model/view classes
1961
to draw their items.
1963
\sa {model-view-programming.html}{Model/View Programming}
1967
\enum QStyleOptionViewItem::Position
1969
This enum describes the position of the item's decoration.
1971
\value Left On the left of the text.
1972
\value Right On the right of the text.
1973
\value Top Above the text.
1974
\value Bottom Below the text.
1976
\sa decorationPosition
1980
\variable QStyleOptionViewItem::showDecorationSelected
1982
\brief Whether the decoration should be highlighted on selected items.
1984
If this option is true, the branch and any decorations on selected items
1985
should be highlighted, indicating that the item is selected; otherwise, no
1986
highlighting is required.
1988
\sa QStyle::SH_ItemView_ShowDecorationSelected, QAbstractItemView
1992
\variable QStyleOptionViewItem::textElideMode
1994
\brief Where ellipsis should be added for text that is too long to fit
1997
\sa Qt::TextElideMode, QStyle::SH_ItemView_EllipsisLocation
2001
Constructs a QStyleOptionViewItem. The members variables are
2002
initialized to default values.
2005
QStyleOptionViewItem::QStyleOptionViewItem()
2006
: QStyleOption(Version, SO_ViewItem),
2007
displayAlignment(0), decorationAlignment(0),
2008
textElideMode(Qt::ElideMiddle), decorationPosition(Left),
2009
showDecorationSelected(false)
2016
QStyleOptionViewItem::QStyleOptionViewItem(int version)
2017
: QStyleOption(version, SO_ViewItem),
2018
displayAlignment(0), decorationAlignment(0),
2019
textElideMode(Qt::ElideMiddle), decorationPosition(Left),
2020
showDecorationSelected(false)
2025
\fn QStyleOptionViewItem::QStyleOptionViewItem(const QStyleOptionViewItem &other)
2027
Constructs a copy of the \a other style option.
2031
\variable QStyleOptionViewItem::Type
2037
\variable QStyleOptionViewItem::Version
2043
\variable QStyleOptionViewItem::displayAlignment
2044
\brief The alignment of the display value for the item.
2048
\variable QStyleOptionViewItem::decorationAlignment
2049
\brief The alignment of the decoration for the item.
2053
\variable QStyleOptionViewItem::decorationPosition
2054
\brief The position of the decoration for the item.
2060
\variable QStyleOptionViewItem::decorationSize
2061
\brief The size of the decoration for the item.
2063
\sa decorationAlignment, decorationPosition
2067
\variable QStyleOptionViewItem::font
2068
\brief The font used for the item
2074
\fn T qstyleoption_cast<T>(const QStyleOption *option)
2075
\relates QStyleOption
2077
Returns a T or 0 depending on the \l{QStyleOption::type}{type}
2078
and \l{QStyleOption::version}{version} of \a option.
2083
void MyStyle::drawPrimitive(PrimitiveElement element,
2084
const QStyleOption *option,
2086
const QWidget *widget)
2088
if (element == PE_FocusRect) {
2089
const QStyleOptionFocusRect *focusRectOption =
2090
qstyleoption_cast<const QStyleOptionFocusRect *>(option);
2091
if (focusRectOption) {
2099
\sa QStyleOption::type, QStyleOption::version
2103
\fn T qstyleoption_cast<T>(QStyleOption *option)
2105
\relates QStyleOption
2107
Returns a T or 0 depending on the type of \a option.
2111
\class QStyleOptionTabWidgetFrame
2112
\brief The QStyleOptionTabWidgetFrame class is used to describe the
2113
parameters for drawing the frame around a tab widget.
2115
QStyleOptionTabWidgetFrame is used for drawing QTabWidget.
2119
Constructs a QStyleOptionTabWidgetFrame. The members variables
2120
are initialized to default values.
2122
QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame()
2123
: QStyleOption(Version, SO_TabWidgetFrame), lineWidth(0), midLineWidth(0),
2124
shape(QTabBar::RoundedNorth)
2129
\fn QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(const QStyleOptionTabWidgetFrame &other)
2131
Constructs a copy of \a other.
2135
QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(int version)
2136
: QStyleOption(version, SO_TabWidgetFrame), lineWidth(0), midLineWidth(0),
2137
shape(QTabBar::RoundedNorth)
2142
\variable QStyleOptionTabWidgetFrame::Type
2144
Equals SO_TabWidgetFrame.
2148
\variable QStyleOptionTabWidgetFrame::Version
2154
\variable QStyleOptionTabWidgetFrame::lineWidth
2155
\brief The line width for drawing the panel.
2159
\variable QStyleOptionTabWidgetFrame::midLineWidth
2160
\brief The mid-line width for drawing the panel. This is usually used in
2161
drawing sunken or raised frames.
2165
\variable QStyleOptionTabWidgetFrame::shape
2166
\brief The tab shape used to draw the tabs.
2170
\variable QStyleOptionTabWidgetFrame::tabBarSize
2171
\brief The size of the tab bar.
2175
\variable QStyleOptionTabWidgetFrame::rightCornerWidgetSize
2176
\brief The size of the right-corner widget.
2179
/*! \variable QStyleOptionTabWidgetFrame::leftCornerWidgetSize
2180
\brief The size of the left-corner widget.
2183
QStyleOptionTabBarBase::QStyleOptionTabBarBase()
2184
: QStyleOption(Version, SO_TabBarBase), shape(QTabBar::RoundedNorth)
2189
QStyleOptionTabBarBase::QStyleOptionTabBarBase(int version)
2190
: QStyleOption(version, SO_TabBarBase), shape(QTabBar::RoundedNorth)
2195
\variable QStyleOptionTabBarBase::Type
2197
Equals SO_TabBarBase.
2201
\variable QStyleOptionTabBarBase::Version
2207
\class QStyleHintReturn
2208
\brief The QStyleHintReturn class provides style hints that return more
2209
than basic data types.
2213
QStyleHintReturn and its subclasses are used to pass information
2214
from a style back to the querying widget. This is most useful
2215
when the return value from QStyle::styleHint() does not provide enough
2216
detail; for example, when a mask is to be returned.
2224
\enum QStyleHintReturn::HintReturnType
2226
\value SH_Default QStyleHintReturn
2227
\value SH_Mask \l QStyle::SH_RubberBand_Mask QStyle::SH_FocusFrame_Mask
2231
\variable QStyleHintReturn::Type
2237
\variable QStyleHintReturn::Version
2243
\variable QStyleHintReturn::type
2244
\brief the type of the style hint container
2250
\variable QStyleHintReturn::version
2251
\brief the version of the style hint return container
2253
This value can be used by subclasses to implement extensions
2254
without breaking compatibility. If you use qstyleoption_cast<T>(), you
2255
normally don't need to check it.
2259
Constructs a QStyleHintReturn with version \a version and type \a
2262
The version has no special meaning for QStyleHintReturn; it can be
2263
used by subclasses to distinguish between different version of
2266
\sa QStyleOption::version, QStyleOption::type
2269
QStyleHintReturn::QStyleHintReturn(int version, int type)
2270
: version(version), type(type)
2278
QStyleHintReturn::~QStyleHintReturn()
2284
\class QStyleHintReturnMask
2285
\brief The QStyleHintReturnMask class provides style hints that return a QRegion.
2295
\variable QStyleHintReturnMask::region
2297
\brief The returned region.
2299
This variable contains the region for style hints that return a QRegion.
2303
Constructs a QStyleHintReturnMask. The member variables are
2304
initialized to default values.
2306
QStyleHintReturnMask::QStyleHintReturnMask() : QStyleHintReturn(Version, Type)
2311
\variable QStyleHintReturnMask::Type
2317
\variable QStyleHintReturnMask::Version
2323
\fn T qstyleoption_cast<T>(const QStyleHintReturn *hint)
2324
\relates QStyleHintReturn
2326
Returns a T or 0 depending on the \l{QStyleHintReturn::type}{type}
2327
and \l{QStyleHintReturn::version}{version} of \a hint.
2332
int MyStyle::styleHint(StyleHint stylehint, const QStyleOption *opt,
2333
const QWidget *widget, QStyleHintReturn* returnData) const;
2335
if (stylehint == SH_RubberBand_Mask) {
2336
const QStyleHintReturnMask *maskReturn =
2337
qstyleoption_cast<const QStyleHintReturnMask *>(hint);
2346
\sa QStyleHintReturn::type, QStyleHintReturn::version
2350
\fn T qstyleoption_cast<T>(QStyleHintReturn *hint)
2352
\relates QStyleHintReturn
2354
Returns a T or 0 depending on the type of \a hint.
2358
QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType)
2360
switch (optionType) {
2361
case QStyleOption::SO_Default:
2362
debug << "SO_Default"; break;
2363
case QStyleOption::SO_FocusRect:
2364
debug << "SO_FocusRect"; break;
2365
case QStyleOption::SO_Button:
2366
debug << "SO_Button"; break;
2367
case QStyleOption::SO_Tab:
2368
debug << "SO_Tab"; break;
2369
case QStyleOption::SO_MenuItem:
2370
debug << "SO_MenuItem"; break;
2371
case QStyleOption::SO_Frame:
2372
debug << "SO_Frame"; break;
2373
case QStyleOption::SO_ProgressBar:
2374
debug << "SO_ProgressBar"; break;
2375
case QStyleOption::SO_ToolBox:
2376
debug << "SO_ToolBox"; break;
2377
case QStyleOption::SO_Header:
2378
debug << "SO_Header"; break;
2379
case QStyleOption::SO_Q3DockWindow:
2380
debug << "SO_Q3DockWindow"; break;
2381
case QStyleOption::SO_DockWidget:
2382
debug << "SO_DockWidget"; break;
2383
case QStyleOption::SO_Q3ListViewItem:
2384
debug << "SO_Q3ListViewItem"; break;
2385
case QStyleOption::SO_ViewItem:
2386
debug << "SO_ViewItem"; break;
2387
case QStyleOption::SO_TabWidgetFrame:
2388
debug << "SO_TabWidgetFrame"; break;
2389
case QStyleOption::SO_TabBarBase:
2390
debug << "SO_TabBarBase"; break;
2391
case QStyleOption::SO_RubberBand:
2392
debug << "SO_RubberBand"; break;
2393
case QStyleOption::SO_Complex:
2394
debug << "SO_Complex"; break;
2395
case QStyleOption::SO_Slider:
2396
debug << "SO_Slider"; break;
2397
case QStyleOption::SO_SpinBox:
2398
debug << "SO_SpinBox"; break;
2399
case QStyleOption::SO_ToolButton:
2400
debug << "SO_ToolButton"; break;
2401
case QStyleOption::SO_ComboBox:
2402
debug << "SO_ComboBox"; break;
2403
case QStyleOption::SO_Q3ListView:
2404
debug << "SO_Q3ListView"; break;
2405
case QStyleOption::SO_TitleBar:
2406
debug << "SO_TitleBar"; break;
2407
case QStyleOption::SO_CustomBase:
2408
debug << "SO_CustomBase"; break;
2409
case QStyleOption::SO_ComplexCustomBase:
2410
debug << "SO_ComplexCustomBase"; break;
2416
QDebug operator<<(QDebug debug, const QStyleOption &option)
2418
debug << "QStyleOption(";
2419
debug << QStyleOption::OptionType(option.type);
2420
debug << "," << (option.direction == Qt::RightToLeft ? "RightToLeft" : "LeftToRight");
2421
debug << "," << option.state;
2422
debug << "," << option.rect;