1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the QtWidgets module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU Lesser General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU Lesser
19** General Public License version 3 as published by the Free Software
20** Foundation and appearing in the file LICENSE.LGPL3 included in the
21** packaging of this file. Please review the following information to
22** ensure the GNU Lesser General Public License version 3 requirements
23** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24**
25** GNU General Public License Usage
26** Alternatively, this file may be used under the terms of the GNU
27** General Public License version 2.0 or (at your option) the GNU General
28** Public license version 3 or any later version approved by the KDE Free
29** Qt Foundation. The licenses are as published by the Free Software
30** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31** included in the packaging of this file. Please review the following
32** information to ensure the GNU General Public License requirements will
33** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34** https://www.gnu.org/licenses/gpl-3.0.html.
35**
36** $QT_END_LICENSE$
37**
38****************************************************************************/
39
40#include <QtWidgets/private/qtwidgetsglobal_p.h>
41#include "private/qstylehelper_p.h"
42#include "qstyleoption.h"
43#include "qapplication.h"
44#include <qdebug.h>
45#include <QtCore/qmath.h>
46
47QT_BEGIN_NAMESPACE
48
49/*!
50 \class QStyleOption
51 \brief The QStyleOption class stores the parameters used by QStyle functions.
52
53 \ingroup appearance
54 \inmodule QtWidgets
55
56 QStyleOption and its subclasses contain all the information that
57 QStyle functions need to draw a graphical element.
58
59 For performance reasons, there are few member functions and the
60 access to the member variables is direct (i.e., using the \c . or
61 \c -> operator). This low-level feel makes the structures
62 straightforward to use and emphasizes that these are simply
63 parameters used by the style functions.
64
65 The caller of a QStyle function usually creates QStyleOption
66 objects on the stack. This combined with Qt's extensive use of
67 \l{implicit sharing} for types such as QString, QPalette, and
68 QColor ensures that no memory allocation needlessly takes place.
69
70 The following code snippet shows how to use a specific
71 QStyleOption subclass to paint a push button:
72
73 \snippet qstyleoption/main.cpp 0
74
75 In our example, the control is a QStyle::CE_PushButton, and
76 according to the QStyle::drawControl() documentation the
77 corresponding class is QStyleOptionButton.
78
79 When reimplementing QStyle functions that take a QStyleOption
80 parameter, you often need to cast the QStyleOption to a subclass.
81 For safety, you can use qstyleoption_cast() to ensure that the
82 pointer type is correct. For example:
83
84 \snippet qstyleoption/main.cpp 4
85
86 The qstyleoption_cast() function will return 0 if the object to
87 which \c option points is not of the correct type.
88
89 For an example demonstrating how style options can be used, see
90 the \l {widgets/styles}{Styles} example.
91
92 \sa QStyle, QStylePainter
93*/
94
95/*!
96 \enum QStyleOption::OptionType
97
98 This enum is used internally by QStyleOption, its subclasses, and
99 qstyleoption_cast() to determine the type of style option. In
100 general you do not need to worry about this unless you want to
101 create your own QStyleOption subclass and your own styles.
102
103 \value SO_Button \l QStyleOptionButton
104 \value SO_ComboBox \l QStyleOptionComboBox
105 \value SO_Complex \l QStyleOptionComplex
106 \value SO_Default QStyleOption
107 \value SO_DockWidget \l QStyleOptionDockWidget
108 \value SO_FocusRect \l QStyleOptionFocusRect
109 \value SO_Frame \l QStyleOptionFrame
110 \value SO_GraphicsItem \l QStyleOptionGraphicsItem
111 \value SO_GroupBox \l QStyleOptionGroupBox
112 \value SO_Header \l QStyleOptionHeader
113 \value SO_MenuItem \l QStyleOptionMenuItem
114 \value SO_ProgressBar \l QStyleOptionProgressBar
115 \value SO_RubberBand \l QStyleOptionRubberBand
116 \value SO_SizeGrip \l QStyleOptionSizeGrip
117 \value SO_Slider \l QStyleOptionSlider
118 \value SO_SpinBox \l QStyleOptionSpinBox
119 \value SO_Tab \l QStyleOptionTab
120 \value SO_TabBarBase \l QStyleOptionTabBarBase
121 \value SO_TabWidgetFrame \l QStyleOptionTabWidgetFrame
122 \value SO_TitleBar \l QStyleOptionTitleBar
123 \value SO_ToolBar \l QStyleOptionToolBar
124 \value SO_ToolBox \l QStyleOptionToolBox
125 \value SO_ToolButton \l QStyleOptionToolButton
126 \value SO_ViewItem \l QStyleOptionViewItem (used in Interviews)
127
128 The following values are used for custom controls:
129
130 \value SO_CustomBase Reserved for custom QStyleOptions;
131 all custom controls values must be above this value
132 \value SO_ComplexCustomBase Reserved for custom QStyleOptions;
133 all custom complex controls values must be above this value
134
135 \sa type
136*/
137
138/*!
139 Constructs a QStyleOption with the specified \a version and \a
140 type.
141
142 The version has no special meaning for QStyleOption; it can be
143 used by subclasses to distinguish between different version of
144 the same option type.
145
146 The \l state member variable is initialized to
147 QStyle::State_None.
148
149 \sa version, type
150*/
151
152QStyleOption::QStyleOption(int version, int type)
153 : version(version), type(type), state(QStyle::State_None),
154 direction(QGuiApplication::layoutDirection()), fontMetrics(QFont()), styleObject(nullptr)
155{
156}
157
158
159/*!
160 Destroys this style option object.
161*/
162QStyleOption::~QStyleOption()
163{
164}
165
166/*!
167 \fn void QStyleOption::initFrom(const QWidget *widget)
168 \since 4.1
169
170 Initializes the \l state, \l direction, \l rect, \l palette, \l fontMetrics
171 and \l styleObject member variables based on the specified \a widget.
172
173 This is a convenience function; the member variables can also be
174 initialized manually.
175
176 \sa QWidget::layoutDirection(), QWidget::rect(),
177 QWidget::palette(), QWidget::fontMetrics()
178*/
179
180/*!
181 \obsolete
182
183 Use initFrom(\a widget) instead.
184*/
185void QStyleOption::init(const QWidget *widget)
186{
187 QWidget *window = widget->window();
188 state = QStyle::State_None;
189 if (widget->isEnabled())
190 state |= QStyle::State_Enabled;
191 if (widget->hasFocus())
192 state |= QStyle::State_HasFocus;
193 if (window->testAttribute(attribute: Qt::WA_KeyboardFocusChange))
194 state |= QStyle::State_KeyboardFocusChange;
195 if (widget->underMouse())
196 state |= QStyle::State_MouseOver;
197 if (window->isActiveWindow())
198 state |= QStyle::State_Active;
199 if (widget->isWindow())
200 state |= QStyle::State_Window;
201 switch (QStyleHelper::widgetSizePolicy(w: widget)) {
202 case QStyleHelper::SizeSmall:
203 state |= QStyle::State_Small;
204 break;
205 case QStyleHelper::SizeMini:
206 state |= QStyle::State_Mini;
207 break;
208 default:
209 ;
210 }
211#ifdef QT_KEYPAD_NAVIGATION
212 if (widget->hasEditFocus())
213 state |= QStyle::State_HasEditFocus;
214#endif
215
216 direction = widget->layoutDirection();
217 rect = widget->rect();
218 palette = widget->palette();
219 fontMetrics = widget->fontMetrics();
220 styleObject = const_cast<QWidget*>(widget);
221}
222
223/*!
224 Constructs a copy of \a other.
225*/
226QStyleOption::QStyleOption(const QStyleOption &other)
227 : version(Version), type(Type), state(other.state),
228 direction(other.direction), rect(other.rect), fontMetrics(other.fontMetrics),
229 palette(other.palette), styleObject(other.styleObject)
230{
231}
232
233/*!
234 Assign \a other to this QStyleOption.
235*/
236QStyleOption &QStyleOption::operator=(const QStyleOption &other)
237{
238 state = other.state;
239 direction = other.direction;
240 rect = other.rect;
241 fontMetrics = other.fontMetrics;
242 palette = other.palette;
243 styleObject = other.styleObject;
244 return *this;
245}
246
247/*!
248 \enum QStyleOption::StyleOptionType
249
250 This enum is used to hold information about the type of the style option, and
251 is defined for each QStyleOption subclass.
252
253 \value Type The type of style option provided (\l{SO_Default} for
254 this class).
255
256 The type is used internally by QStyleOption, its subclasses, and
257 qstyleoption_cast() to determine the type of style option. In
258 general you do not need to worry about this unless you want to
259 create your own QStyleOption subclass and your own styles.
260
261 \sa StyleOptionVersion
262*/
263
264/*!
265 \enum QStyleOption::StyleOptionVersion
266
267 This enum is used to hold information about the version of the style option, and
268 is defined for each QStyleOption subclass.
269
270 \value Version 1
271
272 The version is used by QStyleOption subclasses to implement
273 extensions without breaking compatibility. If you use
274 qstyleoption_cast(), you normally do not need to check it.
275
276 \sa StyleOptionType
277*/
278
279/*!
280 \variable QStyleOption::palette
281 \brief the palette that should be used when painting the control
282
283 By default, the application's default palette is used.
284
285 \sa initFrom()
286*/
287
288/*!
289 \variable QStyleOption::direction
290 \brief the text layout direction that should be used when drawing text in the control
291
292 By default, the layout direction is Qt::LeftToRight.
293
294 \sa initFrom()
295*/
296
297/*!
298 \variable QStyleOption::fontMetrics
299 \brief the font metrics that should be used when drawing text in the control
300
301 By default, the application's default font is used.
302
303 \sa initFrom()
304*/
305
306/*!
307 \variable QStyleOption::styleObject
308 \brief the object being styled
309
310 The built-in styles support the following types: QWidget, QGraphicsObject and QQuickItem.
311
312 \sa initFrom()
313*/
314
315/*!
316 \variable QStyleOption::rect
317 \brief the area that should be used for various calculations and painting
318
319 This can have different meanings for different types of elements.
320 For example, for a \l QStyle::CE_PushButton element it would be
321 the rectangle for the entire button, while for a \l
322 QStyle::CE_PushButtonLabel element it would be just the area for
323 the push button label.
324
325 The default value is a null rectangle, i.e. a rectangle with both
326 the width and the height set to 0.
327
328 \sa initFrom()
329*/
330
331/*!
332 \variable QStyleOption::state
333 \brief the style flags that are used when drawing the control
334
335 The default value is QStyle::State_None.
336
337 \sa initFrom(), QStyle::drawPrimitive(), QStyle::drawControl(),
338 QStyle::drawComplexControl(), QStyle::State
339*/
340
341/*!
342 \variable QStyleOption::type
343 \brief the option type of the style option
344
345 The default value is SO_Default.
346
347 \sa OptionType
348*/
349
350/*!
351 \variable QStyleOption::version
352 \brief the version of the style option
353
354 This value can be used by subclasses to implement extensions
355 without breaking compatibility. If you use the qstyleoption_cast()
356 function, you normally do not need to check it.
357
358 The default value is 1.
359*/
360
361/*!
362 \class QStyleOptionFocusRect
363 \brief The QStyleOptionFocusRect class is used to describe the
364 parameters for drawing a focus rectangle with QStyle.
365
366 \inmodule QtWidgets
367
368 For performance reasons, the access to the member variables is
369 direct (i.e., using the \c . or \c -> operator). This low-level feel
370 makes the structures straightforward to use and emphasizes that
371 these are simply parameters used by the style functions.
372
373 For an example demonstrating how style options can be used, see
374 the \l {widgets/styles}{Styles} example.
375
376 \sa QStyleOption
377*/
378
379/*!
380 Constructs a QStyleOptionFocusRect, initializing the members
381 variables to their default values.
382*/
383
384QStyleOptionFocusRect::QStyleOptionFocusRect()
385 : QStyleOption(Version, SO_FocusRect)
386{
387 state |= QStyle::State_KeyboardFocusChange; // assume we had one, will be corrected in initFrom()
388}
389
390/*!
391 \internal
392*/
393QStyleOptionFocusRect::QStyleOptionFocusRect(int version)
394 : QStyleOption(version, SO_FocusRect)
395{
396 state |= QStyle::State_KeyboardFocusChange; // assume we had one, will be corrected in initFrom()
397}
398
399/*!
400 \enum QStyleOptionFocusRect::StyleOptionType
401
402 This enum is used to hold information about the type of the style option, and
403 is defined for each QStyleOption subclass.
404
405 \value Type The type of style option provided (\l{SO_FocusRect} for this class).
406
407 The type is used internally by QStyleOption, its subclasses, and
408 qstyleoption_cast() to determine the type of style option. In
409 general you do not need to worry about this unless you want to
410 create your own QStyleOption subclass and your own styles.
411
412 \sa StyleOptionVersion
413*/
414
415/*!
416 \enum QStyleOptionFocusRect::StyleOptionVersion
417
418 This enum is used to hold information about the version of the style option, and
419 is defined for each QStyleOption subclass.
420
421 \value Version 1
422
423 The version is used by QStyleOption subclasses to implement
424 extensions without breaking compatibility. If you use
425 qstyleoption_cast(), you normally do not need to check it.
426
427 \sa StyleOptionType
428*/
429
430/*!
431 \fn QStyleOptionFocusRect::QStyleOptionFocusRect(const QStyleOptionFocusRect &other)
432
433 Constructs a copy of the \a other style option.
434*/
435
436/*!
437 \variable QStyleOptionFocusRect::backgroundColor
438 \brief the background color on which the focus rectangle is being drawn
439
440 The default value is an invalid color with the RGB value (0, 0,
441 0). An invalid color is a color that is not properly set up for
442 the underlying window system.
443*/
444
445/*!
446 \class QStyleOptionFrame
447 \brief The QStyleOptionFrame class is used to describe the
448 parameters for drawing a frame.
449
450 \inmodule QtWidgets
451
452 QStyleOptionFrame is used for drawing several built-in Qt widgets,
453 including QFrame, QGroupBox, QLineEdit, and QMenu.
454
455 An instance of the QStyleOptionFrame class has
456 \l{QStyleOption::type} {type} SO_Frame and \l{QStyleOption::version}
457 {version} 3.
458
459 The type is used internally by QStyleOption, its subclasses, and
460 qstyleoption_cast() to determine the type of style option. In
461 general you do not need to worry about this unless you want to
462 create your own QStyleOption subclass and your own styles. The
463 version is used by QStyleOption subclasses to implement extensions
464 without breaking compatibility. If you use qstyleoption_cast(),
465 you normally do not need to check it.
466
467 For an example demonstrating how style options can be used, see
468 the \l {widgets/styles}{Styles} example.
469
470 \sa QStyleOption
471*/
472
473/*!
474 \typedef QStyleOptionFrameV2
475 \relates QStyleOptionFrame
476 \obsolete
477
478 Synonym for QStyleOptionFrame.
479*/
480
481/*!
482 \typedef QStyleOptionFrameV3
483 \relates QStyleOptionFrame
484 \obsolete
485
486 Synonym for QStyleOptionFrame.
487*/
488
489/*!
490 Constructs a QStyleOptionFrame, initializing the members
491 variables to their default values.
492*/
493
494QStyleOptionFrame::QStyleOptionFrame()
495 : QStyleOption(Version, SO_Frame), lineWidth(0), midLineWidth(0),
496 features(None), frameShape(QFrame::NoFrame)
497{
498}
499
500/*!
501 \internal
502*/
503QStyleOptionFrame::QStyleOptionFrame(int version)
504 : QStyleOption(version, SO_Frame), lineWidth(0), midLineWidth(0),
505 features(None), frameShape(QFrame::NoFrame)
506{
507}
508
509/*!
510 \fn QStyleOptionFrame::QStyleOptionFrame(const QStyleOptionFrame &other)
511
512 Constructs a copy of the \a other style option.
513*/
514
515/*!
516 \enum QStyleOptionFrame::StyleOptionType
517
518 This enum is used to hold information about the type of the style option, and
519 is defined for each QStyleOption subclass.
520
521 \value Type The type of style option provided (\l{SO_Frame} for this class).
522
523 The type is used internally by QStyleOption, its subclasses, and
524 qstyleoption_cast() to determine the type of style option. In
525 general you do not need to worry about this unless you want to
526 create your own QStyleOption subclass and your own styles.
527
528 \sa StyleOptionVersion
529*/
530
531/*!
532 \enum QStyleOptionFrame::StyleOptionVersion
533
534 This enum is used to hold information about the version of the style option, and
535 is defined for each QStyleOption subclass.
536
537 \value Version 3
538
539 The version is used by QStyleOption subclasses to implement
540 extensions without breaking compatibility. If you use
541 qstyleoption_cast(), you normally do not need to check it.
542
543 \sa StyleOptionType
544*/
545
546/*!
547 \variable QStyleOptionFrame::lineWidth
548 \brief the line width for drawing the frame
549
550 The default value is 0.
551
552 \sa QFrame::lineWidth
553*/
554
555/*!
556 \variable QStyleOptionFrame::midLineWidth
557 \brief the mid-line width for drawing the frame
558
559 This is usually used in drawing sunken or raised frames.
560
561 The default value is 0.
562
563 \sa QFrame::midLineWidth
564*/
565
566/*!
567 \enum QStyleOptionFrame::FrameFeature
568
569 This enum describes the different types of features a frame can have.
570
571 \value None Indicates a normal frame.
572 \value Flat Indicates a flat frame.
573 \value Rounded Indicates a rounded frame.
574*/
575
576/*!
577 \variable QStyleOptionFrame::features
578 \brief a bitwise OR of the features that describe this frame.
579
580 \sa FrameFeature
581*/
582
583/*!
584 \variable QStyleOptionFrame::frameShape
585 \brief This property holds the frame shape value of the frame.
586
587 \sa QFrame::frameShape
588*/
589
590/*!
591 \class QStyleOptionGroupBox
592 \brief The QStyleOptionGroupBox class describes the parameters for
593 drawing a group box.
594
595 \since 4.1
596 \inmodule QtWidgets
597
598 QStyleOptionButton contains all the information that QStyle
599 functions need the various graphical elements of a group box.
600
601 It holds the lineWidth and the midLineWidth for drawing the panel,
602 the group box's \l {text}{title} and the title's \l
603 {textAlignment}{alignment} and \l {textColor}{color}.
604
605 For performance reasons, the access to the member variables is
606 direct (i.e., using the \c . or \c -> operator). This low-level feel
607 makes the structures straightforward to use and emphasizes that
608 these are simply parameters used by the style functions.
609
610 For an example demonstrating how style options can be used, see
611 the \l {widgets/styles}{Styles} example.
612
613 \sa QStyleOption, QStyleOptionComplex, QGroupBox
614*/
615
616/*!
617 \enum QStyleOptionGroupBox::StyleOptionType
618
619 This enum is used to hold information about the type of the style option, and
620 is defined for each QStyleOption subclass.
621
622 \value Type The type of style option provided (\l{SO_GroupBox} for this class).
623
624 The type is used internally by QStyleOption, its subclasses, and
625 qstyleoption_cast() to determine the type of style option. In
626 general you do not need to worry about this unless you want to
627 create your own QStyleOption subclass and your own styles.
628
629 \sa StyleOptionVersion
630*/
631
632/*!
633 \enum QStyleOptionGroupBox::StyleOptionVersion
634
635 This enum is used to hold information about the version of the style option, and
636 is defined for each QStyleOption subclass.
637
638 \value Version 1
639
640 The version is used by QStyleOption subclasses to implement
641 extensions without breaking compatibility. If you use
642 qstyleoption_cast(), you normally do not need to check it.
643
644 \sa StyleOptionType
645*/
646
647/*!
648 \variable QStyleOptionGroupBox::lineWidth
649 \brief the line width for drawing the panel
650
651 The value of this variable is, currently, always 1.
652
653 \sa QFrame::lineWidth
654*/
655
656/*!
657 \variable QStyleOptionGroupBox::midLineWidth
658 \brief the mid-line width for drawing the panel
659
660 The mid-line width is usually used when drawing sunken or raised
661 group box frames. The value of this variable is, currently, always 0.
662
663 \sa QFrame::midLineWidth
664*/
665
666/*!
667 \variable QStyleOptionGroupBox::text
668 \brief the text of the group box
669
670 The default value is an empty string.
671
672 \sa QGroupBox::title
673*/
674
675/*!
676 \variable QStyleOptionGroupBox::textAlignment
677 \brief the alignment of the group box title
678
679 The default value is Qt::AlignLeft.
680
681 \sa QGroupBox::alignment
682*/
683
684/*!
685 \variable QStyleOptionGroupBox::features
686 \brief the features of the group box frame
687
688 The frame is flat by default.
689
690 \sa QStyleOptionFrame::FrameFeature
691*/
692
693/*!
694 \variable QStyleOptionGroupBox::textColor
695 \brief the color of the group box title
696
697 The default value is an invalid color with the RGB value (0, 0,
698 0). An invalid color is a color that is not properly set up for
699 the underlying window system.
700*/
701
702/*!
703 Constructs a QStyleOptionGroupBox, initializing the members
704 variables to their default values.
705*/
706QStyleOptionGroupBox::QStyleOptionGroupBox()
707 : QStyleOptionComplex(Version, Type), features(QStyleOptionFrame::None),
708 textAlignment(Qt::AlignLeft), lineWidth(0), midLineWidth(0)
709{
710}
711
712/*!
713 \fn QStyleOptionGroupBox::QStyleOptionGroupBox(const QStyleOptionGroupBox &other)
714
715 Constructs a copy of the \a other style option.
716*/
717
718/*!
719 \internal
720*/
721QStyleOptionGroupBox::QStyleOptionGroupBox(int version)
722 : QStyleOptionComplex(version, Type), features(QStyleOptionFrame::None),
723 textAlignment(Qt::AlignLeft), lineWidth(0), midLineWidth(0)
724{
725}
726
727/*!
728 \class QStyleOptionHeader
729 \brief The QStyleOptionHeader class is used to describe the
730 parameters for drawing a header.
731
732 \inmodule QtWidgets
733
734 QStyleOptionHeader contains all the information that QStyle
735 functions need to draw the item views' header pane, header sort
736 arrow, and header label.
737
738 For performance reasons, the access to the member variables is
739 direct (i.e., using the \c . or \c -> operator). This low-level feel
740 makes the structures straightforward to use and emphasizes that
741 these are simply parameters used by the style functions.
742
743 For an example demonstrating how style options can be used, see
744 the \l {widgets/styles}{Styles} example.
745
746 \sa QStyleOption
747*/
748
749/*!
750 Constructs a QStyleOptionHeader, initializing the members
751 variables to their default values.
752*/
753
754QStyleOptionHeader::QStyleOptionHeader()
755 : QStyleOption(QStyleOptionHeader::Version, SO_Header),
756 section(0), textAlignment(Qt::AlignLeft), iconAlignment(Qt::AlignLeft),
757 position(QStyleOptionHeader::Beginning),
758 selectedPosition(QStyleOptionHeader::NotAdjacent), sortIndicator(None),
759 orientation(Qt::Horizontal)
760{
761}
762
763/*!
764 \internal
765*/
766QStyleOptionHeader::QStyleOptionHeader(int version)
767 : QStyleOption(version, SO_Header),
768 section(0), textAlignment(Qt::AlignLeft), iconAlignment(Qt::AlignLeft),
769 position(QStyleOptionHeader::Beginning),
770 selectedPosition(QStyleOptionHeader::NotAdjacent), sortIndicator(None),
771 orientation(Qt::Horizontal)
772{
773}
774
775/*!
776 \variable QStyleOptionHeader::orientation
777 \brief the header's orientation (horizontal or vertical)
778
779 The default orientation is Qt::Horizontal
780*/
781
782/*!
783 \fn QStyleOptionHeader::QStyleOptionHeader(const QStyleOptionHeader &other)
784
785 Constructs a copy of the \a other style option.
786*/
787
788/*!
789 \enum QStyleOptionHeader::StyleOptionType
790
791 This enum is used to hold information about the type of the style option, and
792 is defined for each QStyleOption subclass.
793
794 \value Type The type of style option provided (\l{SO_Header} for this class).
795
796 The type is used internally by QStyleOption, its subclasses, and
797 qstyleoption_cast() to determine the type of style option. In
798 general you do not need to worry about this unless you want to
799 create your own QStyleOption subclass and your own styles.
800
801 \sa StyleOptionVersion
802*/
803
804/*!
805 \enum QStyleOptionHeader::StyleOptionVersion
806
807 This enum is used to hold information about the version of the style option, and
808 is defined for each QStyleOption subclass.
809
810 \value Version 1
811
812 The version is used by QStyleOption subclasses to implement
813 extensions without breaking compatibility. If you use
814 qstyleoption_cast(), you normally do not need to check it.
815
816 \sa StyleOptionType
817*/
818
819/*!
820 \variable QStyleOptionHeader::section
821 \brief which section of the header is being painted
822
823 The default value is 0.
824*/
825
826/*!
827 \variable QStyleOptionHeader::text
828 \brief the text of the header
829
830 The default value is an empty string.
831*/
832
833/*!
834 \variable QStyleOptionHeader::textAlignment
835 \brief the alignment flags for the text of the header
836
837 The default value is Qt::AlignLeft.
838*/
839
840/*!
841 \variable QStyleOptionHeader::icon
842 \brief the icon of the header
843
844 The default value is an empty icon, i.e. an icon with neither a
845 pixmap nor a filename.
846*/
847
848/*!
849 \variable QStyleOptionHeader::iconAlignment
850 \brief the alignment flags for the icon of the header
851
852 The default value is Qt::AlignLeft.
853*/
854
855/*!
856 \variable QStyleOptionHeader::position
857 \brief the section's position in relation to the other sections
858
859 The default value is QStyleOptionHeader::Beginning.
860*/
861
862/*!
863 \variable QStyleOptionHeader::selectedPosition
864 \brief the section's position in relation to the selected section
865
866 The default value is QStyleOptionHeader::NotAdjacent
867*/
868
869/*!
870 \variable QStyleOptionHeader::sortIndicator
871 \brief the direction the sort indicator should be drawn
872
873 The default value is QStyleOptionHeader::None.
874*/
875
876/*!
877 \enum QStyleOptionHeader::SectionPosition
878
879 This enum lets you know where the section's position is in relation to the other sections.
880
881 \value Beginning At the beginining of the header
882 \value Middle In the middle of the header
883 \value End At the end of the header
884 \value OnlyOneSection Only one header section
885
886 \sa position
887*/
888
889/*!
890 \enum QStyleOptionHeader::SelectedPosition
891
892 This enum lets you know where the section's position is in relation to the selected section.
893
894 \value NotAdjacent Not adjacent to the selected section
895 \value NextIsSelected The next section is selected
896 \value PreviousIsSelected The previous section is selected
897 \value NextAndPreviousAreSelected Both the next and previous section are selected
898
899 \sa selectedPosition
900*/
901
902/*!
903 \enum QStyleOptionHeader::SortIndicator
904
905 Indicates which direction the sort indicator should be drawn
906
907 \value None No sort indicator is needed
908 \value SortUp Draw an up indicator
909 \value SortDown Draw a down indicator
910
911 \sa sortIndicator
912*/
913
914/*!
915 \class QStyleOptionButton
916 \brief The QStyleOptionButton class is used to describe the
917 parameters for drawing buttons.
918
919 \inmodule QtWidgets
920
921 QStyleOptionButton contains all the information that QStyle
922 functions need to draw graphical elements like QPushButton,
923 QCheckBox, and QRadioButton.
924
925 For performance reasons, the access to the member variables is
926 direct (i.e., using the \c . or \c -> operator). This low-level feel
927 makes the structures straightforward to use and emphasizes that
928 these are simply parameters used by the style functions.
929
930 For an example demonstrating how style options can be used, see
931 the \l {widgets/styles}{Styles} example.
932
933 \sa QStyleOption, QStyleOptionToolButton
934*/
935
936/*!
937 \enum QStyleOptionButton::ButtonFeature
938
939 This enum describes the different types of features a push button can have.
940
941 \value None Indicates a normal push button.
942 \value Flat Indicates a flat push button.
943 \value HasMenu Indicates that the button has a drop down menu.
944 \value DefaultButton Indicates that the button is a default button.
945 \value AutoDefaultButton Indicates that the button is an auto default button.
946 \value CommandLinkButton Indicates that the button is a Windows Vista type command link.
947
948 \sa features
949*/
950
951/*!
952 Constructs a QStyleOptionButton, initializing the members
953 variables to their default values.
954*/
955
956QStyleOptionButton::QStyleOptionButton()
957 : QStyleOption(QStyleOptionButton::Version, SO_Button), features(None)
958{
959}
960
961/*!
962 \internal
963*/
964QStyleOptionButton::QStyleOptionButton(int version)
965 : QStyleOption(version, SO_Button), features(None)
966{
967}
968
969/*!
970 \fn QStyleOptionButton::QStyleOptionButton(const QStyleOptionButton &other)
971
972 Constructs a copy of the \a other style option.
973*/
974
975/*!
976 \enum QStyleOptionButton::StyleOptionType
977
978 This enum is used to hold information about the type of the style option, and
979 is defined for each QStyleOption subclass.
980
981 \value Type The type of style option provided (\l{SO_Button} for this class).
982
983 The type is used internally by QStyleOption, its subclasses, and
984 qstyleoption_cast() to determine the type of style option. In
985 general you do not need to worry about this unless you want to
986 create your own QStyleOption subclass and your own styles.
987
988 \sa StyleOptionVersion
989*/
990
991/*!
992 \enum QStyleOptionButton::StyleOptionVersion
993
994 This enum is used to hold information about the version of the style option, and
995 is defined for each QStyleOption subclass.
996
997 \value Version 1
998
999 The version is used by QStyleOption subclasses to implement
1000 extensions without breaking compatibility. If you use
1001 qstyleoption_cast(), you normally do not need to check it.
1002
1003 \sa StyleOptionType
1004*/
1005
1006/*!
1007 \variable QStyleOptionButton::features
1008 \brief a bitwise OR of the features that describe this button
1009
1010 \sa ButtonFeature
1011*/
1012
1013/*!
1014 \variable QStyleOptionButton::text
1015 \brief the text of the button
1016
1017 The default value is an empty string.
1018*/
1019
1020/*!
1021 \variable QStyleOptionButton::icon
1022 \brief the icon of the button
1023
1024 The default value is an empty icon, i.e. an icon with neither a
1025 pixmap nor a filename.
1026
1027 \sa iconSize
1028*/
1029
1030/*!
1031 \variable QStyleOptionButton::iconSize
1032 \brief the size of the icon for the button
1033
1034 The default value is QSize(-1, -1), i.e. an invalid size.
1035*/
1036
1037
1038#if QT_CONFIG(toolbar)
1039/*!
1040 \class QStyleOptionToolBar
1041 \brief The QStyleOptionToolBar class is used to describe the
1042 parameters for drawing a toolbar.
1043
1044 \since 4.1
1045 \inmodule QtWidgets
1046
1047 QStyleOptionToolBar contains all the information that QStyle
1048 functions need to draw QToolBar.
1049
1050 For performance reasons, the access to the member variables is
1051 direct (i.e., using the \c . or \c -> operator). This low-level feel
1052 makes the structures straightforward to use and emphasizes that
1053 these are simply parameters used by the style functions.
1054
1055 The QStyleOptionToolBar class holds the lineWidth and the
1056 midLineWidth for drawing the widget. It also stores information
1057 about which \l {toolBarArea}{area} the toolbar should be located
1058 in, whether it is movable or not, which position the toolbar line
1059 should have (positionOfLine), and the toolbar's position within
1060 the line (positionWithinLine).
1061
1062 In addition, the class provides a couple of enums: The
1063 ToolBarFeature enum is used to describe whether a toolbar is
1064 movable or not, and the ToolBarPosition enum is used to describe
1065 the position of a toolbar line, as well as the toolbar's position
1066 within the line.
1067
1068 For an example demonstrating how style options can be used, see
1069 the \l {widgets/styles}{Styles} example.
1070
1071 \sa QStyleOption
1072*/
1073
1074/*!
1075 Constructs a QStyleOptionToolBar, initializing the members
1076 variables to their default values.
1077*/
1078
1079QStyleOptionToolBar::QStyleOptionToolBar()
1080 : QStyleOption(Version, SO_ToolBar), positionOfLine(OnlyOne), positionWithinLine(OnlyOne),
1081 toolBarArea(Qt::TopToolBarArea), features(None), lineWidth(0), midLineWidth(0)
1082{
1083}
1084
1085/*!
1086 \fn QStyleOptionToolBar::QStyleOptionToolBar(const QStyleOptionToolBar &other)
1087
1088 Constructs a copy of the \a other style option.
1089*/
1090
1091/*!
1092 \internal
1093*/
1094QStyleOptionToolBar::QStyleOptionToolBar(int version)
1095: QStyleOption(version, SO_ToolBar), positionOfLine(OnlyOne), positionWithinLine(OnlyOne),
1096 toolBarArea(Qt::TopToolBarArea), features(None), lineWidth(0), midLineWidth(0)
1097{
1098
1099}
1100
1101/*!
1102 \enum QStyleOptionToolBar::ToolBarPosition
1103
1104 \image qstyleoptiontoolbar-position.png
1105
1106 This enum is used to describe the position of a toolbar line, as
1107 well as the toolbar's position within the line.
1108
1109 The order of the positions within a line starts at the top of a
1110 vertical line, and from the left within a horizontal line. The
1111 order of the positions for the lines is always from the
1112 parent widget's boundary edges.
1113
1114 \value Beginning The toolbar is located at the beginning of the line,
1115 or the toolbar line is the first of several lines. There can
1116 only be one toolbar (and only one line) with this position.
1117 \value Middle The toolbar is located in the middle of the line,
1118 or the toolbar line is in the middle of several lines. There can
1119 several toolbars (and lines) with this position.
1120 \value End The toolbar is located at the end of the line,
1121 or the toolbar line is the last of several lines. There can
1122 only be one toolbar (and only one line) with this position.
1123 \value OnlyOne There is only one toolbar or line. This is the default value
1124 of the positionOfLine and positionWithinLine variables.
1125
1126 \sa positionWithinLine, positionOfLine
1127*/
1128
1129/*!
1130 \enum QStyleOptionToolBar::ToolBarFeature
1131
1132 This enum is used to describe whether a toolbar is movable or not.
1133
1134 \value None The toolbar cannot be moved. The default value.
1135 \value Movable The toolbar is movable, and a handle will appear when
1136 holding the cursor over the toolbar's boundary.
1137
1138 \sa features, QToolBar::isMovable()
1139*/
1140
1141/*!
1142 \variable QStyleOptionToolBar::positionOfLine
1143
1144 This variable holds the position of the toolbar line.
1145
1146 The default value is QStyleOptionToolBar::OnlyOne.
1147*/
1148
1149/*!
1150 \variable QStyleOptionToolBar::positionWithinLine
1151
1152 This variable holds the position of the toolbar within a line.
1153
1154 The default value is QStyleOptionToolBar::OnlyOne.
1155*/
1156
1157/*!
1158 \variable QStyleOptionToolBar::toolBarArea
1159
1160 This variable holds the location for drawing the toolbar.
1161
1162 The default value is Qt::TopToolBarArea.
1163
1164 \sa Qt::ToolBarArea
1165*/
1166
1167/*!
1168 \variable QStyleOptionToolBar::features
1169
1170 This variable holds whether the toolbar is movable or not.
1171
1172 The default value is \l None.
1173*/
1174
1175/*!
1176 \variable QStyleOptionToolBar::lineWidth
1177
1178 This variable holds the line width for drawing the toolbar.
1179
1180 The default value is 0.
1181*/
1182
1183/*!
1184 \variable QStyleOptionToolBar::midLineWidth
1185
1186 This variable holds the mid-line width for drawing the toolbar.
1187
1188 The default value is 0.
1189*/
1190
1191/*!
1192 \enum QStyleOptionToolBar::StyleOptionType
1193
1194 This enum is used to hold information about the type of the style
1195 option, and is defined for each QStyleOption subclass.
1196
1197 \value Type The type of style option provided (\l{SO_ToolBar} for
1198 this class).
1199
1200 The type is used internally by QStyleOption, its subclasses, and
1201 qstyleoption_cast() to determine the type of style option. In
1202 general you do not need to worry about this unless you want to
1203 create your own QStyleOption subclass and your own styles.
1204
1205 \sa StyleOptionVersion
1206*/
1207
1208/*!
1209 \enum QStyleOptionToolBar::StyleOptionVersion
1210
1211 This enum is used to hold information about the version of the
1212 style option, and is defined for each QStyleOption subclass.
1213
1214 \value Version 1
1215
1216 The version is used by QStyleOption subclasses to implement
1217 extensions without breaking compatibility. If you use
1218 qstyleoption_cast(), you normally do not need to check it.
1219
1220 \sa StyleOptionType
1221*/
1222
1223#endif
1224
1225#if QT_CONFIG(tabbar)
1226/*!
1227 \class QStyleOptionTab
1228 \brief The QStyleOptionTab class is used to describe the
1229 parameters for drawing a tab bar.
1230
1231 \inmodule QtWidgets
1232
1233 The QStyleOptionTab class is used for drawing several built-in Qt
1234 widgets including \l QTabBar and the panel for \l QTabWidget.
1235
1236 An instance of the QStyleOptionTab class has
1237 \l{QStyleOption::type} {type} \l SO_Tab and
1238 \l{QStyleOption::version} {version} 3. The type is used internally
1239 by QStyleOption, its subclasses, and qstyleoption_cast() to
1240 determine the type of style option. In general you do not need to
1241 worry about this unless you want to create your own QStyleOption
1242 subclass and your own styles. The version is used by QStyleOption
1243 subclasses to implement extensions without breaking
1244 compatibility. If you use qstyleoption_cast(), you normally do not
1245 need to check it.
1246
1247 For an example demonstrating how style options can be used, see
1248 the \l {widgets/styles}{Styles} example.
1249
1250 \sa QStyleOption
1251*/
1252
1253/*!
1254 \typedef QStyleOptionTabV2
1255 \relates QStyleOptionTab
1256 \obsolete
1257
1258 Synonym for QStyleOptionTab.
1259*/
1260
1261/*!
1262 \typedef QStyleOptionTabV3
1263 \relates QStyleOptionTab
1264 \obsolete
1265
1266 Synonym for QStyleOptionTab.
1267*/
1268
1269/*!
1270 Constructs a QStyleOptionTab object, initializing the members
1271 variables to their default values.
1272*/
1273
1274QStyleOptionTab::QStyleOptionTab()
1275 : QStyleOption(QStyleOptionTab::Version, SO_Tab),
1276 shape(QTabBar::RoundedNorth),
1277 row(0),
1278 position(Beginning),
1279 selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets),
1280 documentMode(false),
1281 features(QStyleOptionTab::None)
1282{
1283}
1284
1285/*!
1286 \internal
1287*/
1288QStyleOptionTab::QStyleOptionTab(int version)
1289 : QStyleOption(version, SO_Tab),
1290 shape(QTabBar::RoundedNorth),
1291 row(0),
1292 position(Beginning),
1293 selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets),
1294 documentMode(false),
1295 features(QStyleOptionTab::None)
1296{
1297}
1298
1299/*!
1300 \fn QStyleOptionTab::QStyleOptionTab(const QStyleOptionTab &other)
1301
1302 Constructs a copy of the \a other style option.
1303*/
1304
1305/*!
1306 \enum QStyleOptionTab::StyleOptionType
1307
1308 This enum is used to hold information about the type of the style option, and
1309 is defined for each QStyleOption subclass.
1310
1311 \value Type The type of style option provided (\l{SO_Tab} for this class).
1312
1313 The type is used internally by QStyleOption, its subclasses, and
1314 qstyleoption_cast() to determine the type of style option. In
1315 general you do not need to worry about this unless you want to
1316 create your own QStyleOption subclass and your own styles.
1317
1318 \sa StyleOptionVersion
1319*/
1320
1321/*!
1322 \enum QStyleOptionTab::StyleOptionVersion
1323
1324 This enum is used to hold information about the version of the style option, and
1325 is defined for each QStyleOption subclass.
1326
1327 \value Version 3
1328
1329 The version is used by QStyleOption subclasses to implement
1330 extensions without breaking compatibility. If you use
1331 qstyleoption_cast(), you normally do not need to check it.
1332
1333 \sa StyleOptionType
1334*/
1335
1336/*!
1337 \enum QStyleOptionTab::TabPosition
1338
1339 This enum describes the position of the tab.
1340
1341 \value Beginning The tab is the first tab in the tab bar.
1342 \value Middle The tab is neither the first nor the last tab in the tab bar.
1343 \value End The tab is the last tab in the tab bar.
1344 \value OnlyOneTab The tab is both the first and the last tab in the tab bar.
1345
1346 \sa position
1347*/
1348
1349/*!
1350 \enum QStyleOptionTab::CornerWidget
1351
1352 These flags indicate the corner widgets in a tab.
1353
1354 \value NoCornerWidgets There are no corner widgets
1355 \value LeftCornerWidget Left corner widget
1356 \value RightCornerWidget Right corner widget
1357
1358 \sa cornerWidgets
1359*/
1360
1361/*! \enum QStyleOptionTab::SelectedPosition
1362
1363 This enum describes the position of the selected tab. Some styles
1364 need to draw a tab differently depending on whether or not it is
1365 adjacent to the selected tab.
1366
1367 \value NotAdjacent The tab is not adjacent to a selected tab (or is the selected tab).
1368 \value NextIsSelected The next tab (typically the tab on the right) is selected.
1369 \value PreviousIsSelected The previous tab (typically the tab on the left) is selected.
1370
1371 \sa selectedPosition
1372*/
1373
1374/*!
1375 \variable QStyleOptionTab::selectedPosition
1376 \brief the position of the selected tab in relation to this tab
1377
1378 The default value is NotAdjacent, i.e. the tab is not adjacent to
1379 a selected tab nor is it the selected tab.
1380*/
1381
1382/*!
1383 \variable QStyleOptionTab::cornerWidgets
1384 \brief an OR combination of CornerWidget values indicating the
1385 corner widgets of the tab bar
1386
1387 The default value is NoCornerWidgets.
1388
1389 \sa CornerWidget
1390*/
1391
1392
1393/*!
1394 \variable QStyleOptionTab::shape
1395 \brief the tab shape used to draw the tab; by default
1396 QTabBar::RoundedNorth
1397
1398 \sa QTabBar::Shape
1399*/
1400
1401/*!
1402 \variable QStyleOptionTab::text
1403 \brief the text of the tab
1404
1405 The default value is an empty string.
1406*/
1407
1408/*!
1409 \variable QStyleOptionTab::icon
1410 \brief the icon for the tab
1411
1412 The default value is an empty icon, i.e. an icon with neither a
1413 pixmap nor a filename.
1414*/
1415
1416/*!
1417 \variable QStyleOptionTab::row
1418 \brief which row the tab is currently in
1419
1420 The default value is 0, indicating the front row. Currently this
1421 property can only be 0.
1422*/
1423
1424/*!
1425 \variable QStyleOptionTab::position
1426 \brief the position of the tab in the tab bar
1427
1428 The default value is \l Beginning, i.e. the tab is the first tab
1429 in the tab bar.
1430*/
1431/*!
1432 \variable QStyleOptionTab::iconSize
1433 \brief the size for the icons
1434
1435 The default value is QSize(-1, -1), i.e. an invalid size; use
1436 QStyle::pixelMetric() to find the default icon size for tab bars.
1437
1438 \sa QTabBar::iconSize()
1439*/
1440
1441/*!
1442 \variable QStyleOptionTab::documentMode
1443 \brief whether the tabbar is in document mode.
1444
1445 The default value is false;
1446*/
1447
1448/*!
1449 \enum QStyleOptionTab::TabFeature
1450
1451 Describes the various features that a tab button can have.
1452
1453 \value None A normal tab button.
1454 \value HasFrame The tab button is positioned on a tab frame
1455
1456 \sa QStyleOptionToolBar::features
1457*/
1458
1459/*!
1460 \variable QStyleOptionTab::leftButtonSize
1461 \brief the size for the left widget on the tab.
1462
1463 The default value is QSize(-1, -1), i.e. an invalid size;
1464*/
1465
1466/*!
1467 \variable QStyleOptionTab::rightButtonSize
1468 \brief the size for the right widget on the tab.
1469
1470 The default value is QSize(-1, -1), i.e. an invalid size;
1471*/
1472
1473/*!
1474 Constructs a QStyleOptionTabV4 object, initializing the members
1475 variables to their default values.
1476 */
1477
1478QStyleOptionTabV4::QStyleOptionTabV4() : QStyleOptionTab(QStyleOptionTabV4::Version)
1479{
1480}
1481
1482/*!
1483 \variable QStyleOptionTabV4::tabIndex
1484 \brief the index for the tab being represented.
1485
1486 The default value is -1, i.e. a tab not on a tabbar;
1487 */
1488
1489#endif // QT_CONFIG(tabbar)
1490
1491/*!
1492 \class QStyleOptionProgressBar
1493 \brief The QStyleOptionProgressBar class is used to describe the
1494 parameters necessary for drawing a progress bar.
1495
1496 \inmodule QtWidgets
1497
1498 An instance of the QStyleOptionProgressBar class has type
1499 SO_ProgressBar and version 2.
1500
1501 The type is used internally by QStyleOption, its subclasses, and
1502 qstyleoption_cast() to determine the type of style option. In
1503 general you do not need to worry about this unless you want to
1504 create your own QStyleOption subclass and your own styles. The
1505 version is used by QStyleOption subclasses to implement extensions
1506 without breaking compatibility. If you use qstyleoption_cast(),
1507 you normally do not need to check it.
1508
1509 For an example demonstrating how style options can be used, see
1510 the \l {widgets/styles}{Styles} example.
1511
1512 \sa QStyleOption
1513*/
1514
1515/*!
1516 \typedef QStyleOptionProgressBarV2
1517 \relates QStyleOptionProgressBar
1518 \obsolete
1519
1520 Synonym for QStyleOptionProgressBar.
1521*/
1522
1523/*!
1524 Constructs a QStyleOptionProgressBar, initializing the members
1525 variables to their default values.
1526*/
1527
1528QStyleOptionProgressBar::QStyleOptionProgressBar()
1529 : QStyleOption(QStyleOptionProgressBar::Version, SO_ProgressBar),
1530 minimum(0), maximum(0), progress(0), textAlignment(Qt::AlignLeft), textVisible(false),
1531 orientation(Qt::Horizontal), invertedAppearance(false), bottomToTop(false)
1532{
1533}
1534
1535/*!
1536 \internal
1537*/
1538QStyleOptionProgressBar::QStyleOptionProgressBar(int version)
1539 : QStyleOption(version, SO_ProgressBar),
1540 minimum(0), maximum(0), progress(0), textAlignment(Qt::AlignLeft), textVisible(false),
1541 orientation(Qt::Horizontal), invertedAppearance(false), bottomToTop(false)
1542{
1543}
1544
1545/*!
1546 \fn QStyleOptionProgressBar::QStyleOptionProgressBar(const QStyleOptionProgressBar &other)
1547
1548 Constructs a copy of the \a other style option.
1549*/
1550
1551/*!
1552 \enum QStyleOptionProgressBar::StyleOptionType
1553
1554 This enum is used to hold information about the type of the style option, and
1555 is defined for each QStyleOption subclass.
1556
1557 \value Type The type of style option provided (\l{SO_ProgressBar} for this class).
1558
1559 The type is used internally by QStyleOption, its subclasses, and
1560 qstyleoption_cast() to determine the type of style option. In
1561 general you do not need to worry about this unless you want to
1562 create your own QStyleOption subclass and your own styles.
1563
1564 \sa StyleOptionVersion
1565*/
1566
1567/*!
1568 \enum QStyleOptionProgressBar::StyleOptionVersion
1569
1570 This enum is used to hold information about the version of the style option, and
1571 is defined for each QStyleOption subclass.
1572
1573 \value Version 2
1574
1575 The version is used by QStyleOption subclasses to implement
1576 extensions without breaking compatibility. If you use
1577 qstyleoption_cast(), you normally do not need to check it.
1578
1579 \sa StyleOptionType
1580*/
1581
1582/*!
1583 \variable QStyleOptionProgressBar::minimum
1584 \brief the minimum value for the progress bar
1585
1586 This is the minimum value in the progress bar. The default value
1587 is 0.
1588
1589 \sa QProgressBar::minimum
1590*/
1591
1592/*!
1593 \variable QStyleOptionProgressBar::maximum
1594 \brief the maximum value for the progress bar
1595
1596 This is the maximum value in the progress bar. The default value
1597 is 0.
1598
1599 \sa QProgressBar::maximum
1600*/
1601
1602/*!
1603 \variable QStyleOptionProgressBar::text
1604 \brief the text for the progress bar
1605
1606 The progress bar text is usually just the progress expressed as a
1607 string. An empty string indicates that the progress bar has not
1608 started yet. The default value is an empty string.
1609
1610 \sa QProgressBar::text
1611*/
1612
1613/*!
1614 \variable QStyleOptionProgressBar::textVisible
1615 \brief a flag indicating whether or not text is visible
1616
1617 If this flag is true then the text is visible. Otherwise, the text
1618 is not visible. The default value is false.
1619
1620 \sa QProgressBar::textVisible
1621*/
1622
1623
1624/*!
1625 \variable QStyleOptionProgressBar::textAlignment
1626 \brief the text alignment for the text in the QProgressBar
1627
1628 This can be used as a guide on where the text should be in the
1629 progress bar. The default value is Qt::AlignLeft.
1630*/
1631
1632/*!
1633 \variable QStyleOptionProgressBar::progress
1634 \brief the current progress for the progress bar
1635
1636 The current progress. A value of QStyleOptionProgressBar::minimum
1637 - 1 indicates that the progress hasn't started yet. The default
1638 value is 0.
1639
1640 \sa QProgressBar::value
1641*/
1642
1643/*!
1644 \variable QStyleOptionProgressBar::orientation
1645 \brief the progress bar's orientation (horizontal or vertical);
1646 the default orentation is Qt::Horizontal
1647
1648 \deprecated
1649 Use the QStyle::State_Horizontal flag instead (in the QStyleOption::state member).
1650
1651 \sa QProgressBar::orientation
1652*/
1653
1654/*!
1655 \variable QStyleOptionProgressBar::invertedAppearance
1656 \brief whether the progress bar's appearance is inverted
1657
1658 The default value is false.
1659
1660 \sa QProgressBar::invertedAppearance
1661*/
1662
1663/*!
1664 \variable QStyleOptionProgressBar::bottomToTop
1665 \brief whether the text reads from bottom to top when the progress
1666 bar is vertical
1667
1668 The default value is false.
1669
1670 \sa QProgressBar::textDirection
1671*/
1672
1673/*!
1674 \class QStyleOptionMenuItem
1675 \brief The QStyleOptionMenuItem class is used to describe the
1676 parameter necessary for drawing a menu item.
1677
1678 \inmodule QtWidgets
1679
1680 QStyleOptionMenuItem contains all the information that QStyle
1681 functions need to draw the menu items from \l QMenu. It is also
1682 used for drawing other menu-related widgets.
1683
1684 For performance reasons, the access to the member variables is
1685 direct (i.e., using the \c . or \c -> operator). This low-level feel
1686 makes the structures straightforward to use and emphasizes that
1687 these are simply parameters used by the style functions.
1688
1689 For an example demonstrating how style options can be used, see
1690 the \l {widgets/styles}{Styles} example.
1691
1692 \sa QStyleOption
1693*/
1694
1695/*!
1696 Constructs a QStyleOptionMenuItem, initializing the members
1697 variables to their default values.
1698*/
1699
1700QStyleOptionMenuItem::QStyleOptionMenuItem()
1701 : QStyleOption(QStyleOptionMenuItem::Version, SO_MenuItem), menuItemType(Normal),
1702 checkType(NotCheckable), checked(false), menuHasCheckableItems(true), maxIconWidth(0), tabWidth(0)
1703{
1704}
1705
1706/*!
1707 \internal
1708*/
1709QStyleOptionMenuItem::QStyleOptionMenuItem(int version)
1710 : QStyleOption(version, SO_MenuItem), menuItemType(Normal),
1711 checkType(NotCheckable), checked(false), menuHasCheckableItems(true), maxIconWidth(0), tabWidth(0)
1712{
1713}
1714
1715/*!
1716 \fn QStyleOptionMenuItem::QStyleOptionMenuItem(const QStyleOptionMenuItem &other)
1717
1718 Constructs a copy of the \a other style option.
1719*/
1720
1721/*!
1722 \enum QStyleOptionMenuItem::StyleOptionType
1723
1724 This enum is used to hold information about the type of the style option, and
1725 is defined for each QStyleOption subclass.
1726
1727 \value Type The type of style option provided (\l{SO_MenuItem} for this class).
1728
1729 The type is used internally by QStyleOption, its subclasses, and
1730 qstyleoption_cast() to determine the type of style option. In
1731 general you do not need to worry about this unless you want to
1732 create your own QStyleOption subclass and your own styles.
1733
1734 \sa StyleOptionVersion
1735*/
1736
1737/*!
1738 \enum QStyleOptionMenuItem::StyleOptionVersion
1739
1740 This enum is used to hold information about the version of the style option, and
1741 is defined for each QStyleOption subclass.
1742
1743 \value Version 1
1744
1745 The version is used by QStyleOption subclasses to implement
1746 extensions without breaking compatibility. If you use
1747 qstyleoption_cast(), you normally do not need to check it.
1748
1749 \sa StyleOptionType
1750*/
1751
1752/*!
1753 \enum QStyleOptionMenuItem::MenuItemType
1754
1755 This enum indicates the type of menu item that the structure describes.
1756
1757 \value Normal A normal menu item.
1758 \value DefaultItem A menu item that is the default action as specified with \l QMenu::defaultAction().
1759 \value Separator A menu separator.
1760 \value SubMenu Indicates the menu item points to a sub-menu.
1761 \value Scroller A popup menu scroller (currently only used on \macos).
1762 \value TearOff A tear-off handle for the menu.
1763 \value Margin The margin of the menu.
1764 \value EmptyArea The empty area of the menu.
1765
1766 \sa menuItemType
1767*/
1768
1769/*!
1770 \enum QStyleOptionMenuItem::CheckType
1771
1772 This enum is used to indicate whether or not a check mark should be
1773 drawn for the item, or even if it should be drawn at all.
1774
1775 \value NotCheckable The item is not checkable.
1776 \value Exclusive The item is an exclusive check item (like a radio button).
1777 \value NonExclusive The item is a non-exclusive check item (like a check box).
1778
1779 \sa checkType, QAction::checkable, QAction::checked, QActionGroup::exclusionPolicy
1780*/
1781
1782/*!
1783 \variable QStyleOptionMenuItem::menuItemType
1784 \brief the type of menu item
1785
1786 The default value is \l Normal.
1787
1788 \sa MenuItemType
1789*/
1790
1791/*!
1792 \variable QStyleOptionMenuItem::checkType
1793 \brief the type of checkmark of the menu item
1794
1795 The default value is \l NotCheckable.
1796
1797 \sa CheckType
1798*/
1799
1800/*!
1801 \variable QStyleOptionMenuItem::checked
1802 \brief whether the menu item is checked or not
1803
1804 The default value is false.
1805*/
1806
1807/*!
1808 \variable QStyleOptionMenuItem::menuHasCheckableItems
1809 \brief whether the menu as a whole has checkable items or not
1810
1811 The default value is true.
1812
1813 If this option is set to false, then the menu has no checkable
1814 items. This makes it possible for GUI styles to save some
1815 horizontal space that would normally be used for the check column.
1816*/
1817
1818/*!
1819 \variable QStyleOptionMenuItem::menuRect
1820 \brief the rectangle for the entire menu
1821
1822 The default value is a null rectangle, i.e. a rectangle with both
1823 the width and the height set to 0.
1824*/
1825
1826/*!
1827 \variable QStyleOptionMenuItem::text
1828 \brief the text for the menu item
1829
1830 Note that the text format is something like this "Menu
1831 text\b{\\t}Shortcut".
1832
1833 If the menu item doesn't have a shortcut, it will just contain the
1834 menu item's text. The default value is an empty string.
1835*/
1836
1837/*!
1838 \variable QStyleOptionMenuItem::icon
1839 \brief the icon for the menu item
1840
1841 The default value is an empty icon, i.e. an icon with neither a
1842 pixmap nor a filename.
1843*/
1844
1845/*!
1846 \variable QStyleOptionMenuItem::maxIconWidth
1847 \brief the maximum icon width for the icon in the menu item
1848
1849 This can be used for drawing the icon into the correct place or
1850 properly aligning items. The variable must be set regardless of
1851 whether or not the menu item has an icon. The default value is 0.
1852*/
1853
1854/*!
1855 \variable QStyleOptionMenuItem::tabWidth
1856 \brief the reserved width for the menu item's shortcut
1857
1858 QMenu sets it to the width occupied by the widest shortcut among
1859 all visible items within the menu.
1860
1861 The default value is 0.
1862*/
1863
1864
1865/*!
1866 \variable QStyleOptionMenuItem::font
1867 \brief the font used for the menu item text
1868
1869 This is the font that should be used for drawing the menu text
1870 minus the shortcut. The shortcut is usually drawn using the
1871 painter's font. By default, the application's default font is
1872 used.
1873*/
1874
1875/*!
1876 \class QStyleOptionComplex
1877 \brief The QStyleOptionComplex class is used to hold parameters that are
1878 common to all complex controls.
1879
1880 \inmodule QtWidgets
1881
1882 This class is not used on its own. Instead it is used to derive
1883 other complex control options, for example QStyleOptionSlider and
1884 QStyleOptionSpinBox.
1885
1886 For performance reasons, the access to the member variables is
1887 direct (i.e., using the \c . or \c -> operator).
1888
1889 For an example demonstrating how style options can be used, see
1890 the \l {widgets/styles}{Styles} example.
1891
1892 \sa QStyleOption
1893*/
1894
1895/*!
1896 Constructs a QStyleOptionComplex of the specified \a type and \a
1897 version, initializing the member variables to their default
1898 values. This constructor is usually called by subclasses.
1899*/
1900
1901QStyleOptionComplex::QStyleOptionComplex(int version, int type)
1902 : QStyleOption(version, type), subControls(QStyle::SC_All), activeSubControls(QStyle::SC_None)
1903{
1904}
1905
1906/*!
1907 \fn QStyleOptionComplex::QStyleOptionComplex(const QStyleOptionComplex &other)
1908
1909 Constructs a copy of the \a other style option.
1910*/
1911
1912/*!
1913 \enum QStyleOptionComplex::StyleOptionType
1914
1915 This enum is used to hold information about the type of the style option, and
1916 is defined for each QStyleOption subclass.
1917
1918 \value Type The type of style option provided (\l{SO_Complex} for this class).
1919
1920 The type is used internally by QStyleOption, its subclasses, and
1921 qstyleoption_cast() to determine the type of style option. In
1922 general you do not need to worry about this unless you want to
1923 create your own QStyleOption subclass and your own styles.
1924
1925 \sa StyleOptionVersion
1926*/
1927
1928/*!
1929 \enum QStyleOptionComplex::StyleOptionVersion
1930
1931 This enum is used to hold information about the version of the style option, and
1932 is defined for each QStyleOption subclass.
1933
1934 \value Version 1
1935
1936 The version is used by QStyleOption subclasses to implement
1937 extensions without breaking compatibility. If you use
1938 qstyleoption_cast(), you normally do not need to check it.
1939
1940 \sa StyleOptionType
1941*/
1942
1943/*!
1944 \variable QStyleOptionComplex::subControls
1945
1946 This variable holds a bitwise OR of the \l{QStyle::SubControl}
1947 {sub-controls} to be drawn for the complex control.
1948
1949 The default value is QStyle::SC_All.
1950
1951 \sa QStyle::SubControl
1952*/
1953
1954/*!
1955 \variable QStyleOptionComplex::activeSubControls
1956
1957 This variable holds a bitwise OR of the \l{QStyle::SubControl}
1958 {sub-controls} that are active for the complex control.
1959
1960 The default value is QStyle::SC_None.
1961
1962 \sa QStyle::SubControl
1963*/
1964
1965#if QT_CONFIG(slider)
1966/*!
1967 \class QStyleOptionSlider
1968 \brief The QStyleOptionSlider class is used to describe the
1969 parameters needed for drawing a slider.
1970
1971 \inmodule QtWidgets
1972
1973 QStyleOptionSlider contains all the information that QStyle
1974 functions need to draw QSlider and QScrollBar.
1975
1976 For performance reasons, the access to the member variables is
1977 direct (i.e., using the \c . or \c -> operator). This low-level feel
1978 makes the structures straightforward to use and emphasizes that
1979 these are simply parameters used by the style functions.
1980
1981 For an example demonstrating how style options can be used, see
1982 the \l {widgets/styles}{Styles} example.
1983
1984 \sa QStyleOptionComplex, QSlider, QScrollBar
1985*/
1986
1987/*!
1988 Constructs a QStyleOptionSlider, initializing the members
1989 variables to their default values.
1990*/
1991
1992QStyleOptionSlider::QStyleOptionSlider()
1993 : QStyleOptionComplex(Version, SO_Slider), orientation(Qt::Horizontal), minimum(0), maximum(0),
1994 tickPosition(QSlider::NoTicks), tickInterval(0), upsideDown(false),
1995 sliderPosition(0), sliderValue(0), singleStep(0), pageStep(0), notchTarget(0.0),
1996 dialWrapping(false)
1997{
1998}
1999
2000/*!
2001 \internal
2002*/
2003QStyleOptionSlider::QStyleOptionSlider(int version)
2004 : QStyleOptionComplex(version, SO_Slider), orientation(Qt::Horizontal), minimum(0), maximum(0),
2005 tickPosition(QSlider::NoTicks), tickInterval(0), upsideDown(false),
2006 sliderPosition(0), sliderValue(0), singleStep(0), pageStep(0), notchTarget(0.0),
2007 dialWrapping(false)
2008{
2009}
2010
2011/*!
2012 \fn QStyleOptionSlider::QStyleOptionSlider(const QStyleOptionSlider &other)
2013
2014 Constructs a copy of the \a other style option.
2015*/
2016
2017/*!
2018 \enum QStyleOptionSlider::StyleOptionType
2019
2020 This enum is used to hold information about the type of the style option, and
2021 is defined for each QStyleOption subclass.
2022
2023 \value Type The type of style option provided (\l{SO_Slider} for this class).
2024
2025 The type is used internally by QStyleOption, its subclasses, and
2026 qstyleoption_cast() to determine the type of style option. In
2027 general you do not need to worry about this unless you want to
2028 create your own QStyleOption subclass and your own styles.
2029
2030 \sa StyleOptionVersion
2031*/
2032
2033/*!
2034 \enum QStyleOptionSlider::StyleOptionVersion
2035
2036 This enum is used to hold information about the version of the style option, and
2037 is defined for each QStyleOption subclass.
2038
2039 \value Version 1
2040
2041 The version is used by QStyleOption subclasses to implement
2042 extensions without breaking compatibility. If you use
2043 qstyleoption_cast(), you normally do not need to check it.
2044
2045 \sa StyleOptionType
2046*/
2047
2048/*!
2049 \variable QStyleOptionSlider::orientation
2050 \brief the slider's orientation (horizontal or vertical)
2051
2052 The default orientation is Qt::Horizontal.
2053
2054 \sa Qt::Orientation
2055*/
2056
2057/*!
2058 \variable QStyleOptionSlider::minimum
2059 \brief the minimum value for the slider
2060
2061 The default value is 0.
2062*/
2063
2064/*!
2065 \variable QStyleOptionSlider::maximum
2066 \brief the maximum value for the slider
2067
2068 The default value is 0.
2069*/
2070
2071/*!
2072 \variable QStyleOptionSlider::tickPosition
2073 \brief the position of the slider's tick marks, if any
2074
2075 The default value is QSlider::NoTicks.
2076
2077 \sa QSlider::TickPosition
2078*/
2079
2080/*!
2081 \variable QStyleOptionSlider::tickInterval
2082 \brief the interval that should be drawn between tick marks
2083
2084 The default value is 0.
2085*/
2086
2087/*!
2088 \variable QStyleOptionSlider::notchTarget
2089 \brief the number of pixel between notches
2090
2091 The default value is 0.0.
2092
2093 \sa QDial::notchTarget()
2094*/
2095
2096/*!
2097 \variable QStyleOptionSlider::dialWrapping
2098 \brief whether the dial should wrap or not
2099
2100 The default value is false, i.e. the dial is not wrapped.
2101
2102 \sa QDial::wrapping()
2103*/
2104
2105/*!
2106 \variable QStyleOptionSlider::upsideDown
2107 \brief the slider control orientation
2108
2109 Normally a slider increases as it moves up or to the right;
2110 upsideDown indicates that it should do the opposite (increase as
2111 it moves down or to the left). The default value is false,
2112 i.e. the slider increases as it moves up or to the right.
2113
2114 \sa QStyle::sliderPositionFromValue(),
2115 QStyle::sliderValueFromPosition(),
2116 QAbstractSlider::invertedAppearance
2117*/
2118
2119/*!
2120 \variable QStyleOptionSlider::sliderPosition
2121 \brief the position of the slider handle
2122
2123 If the slider has active feedback (i.e.,
2124 QAbstractSlider::tracking is true), this value will be the same as
2125 \l sliderValue. Otherwise, it will have the current position of
2126 the handle. The default value is 0.
2127
2128 \sa QAbstractSlider::tracking, sliderValue
2129*/
2130
2131/*!
2132 \variable QStyleOptionSlider::sliderValue
2133 \brief the value of the slider
2134
2135 If the slider has active feedback (i.e.,
2136 QAbstractSlider::tracking is true), this value will be the same
2137 as \l sliderPosition. Otherwise, it will have the value the
2138 slider had before the mouse was pressed.
2139
2140 The default value is 0.
2141
2142 \sa QAbstractSlider::tracking, sliderPosition
2143*/
2144
2145/*!
2146 \variable QStyleOptionSlider::singleStep
2147 \brief the size of the single step of the slider
2148
2149 The default value is 0.
2150
2151 \sa QAbstractSlider::singleStep
2152*/
2153
2154/*!
2155 \variable QStyleOptionSlider::pageStep
2156 \brief the size of the page step of the slider
2157
2158 The default value is 0.
2159
2160 \sa QAbstractSlider::pageStep
2161*/
2162#endif // QT_CONFIG(slider)
2163
2164#if QT_CONFIG(spinbox)
2165/*!
2166 \class QStyleOptionSpinBox
2167 \brief The QStyleOptionSpinBox class is used to describe the
2168 parameters necessary for drawing a spin box.
2169
2170 \inmodule QtWidgets
2171
2172 QStyleOptionSpinBox contains all the information that QStyle
2173 functions need to draw QSpinBox and QDateTimeEdit.
2174
2175 For performance reasons, the access to the member variables is
2176 direct (i.e., using the \c . or \c -> operator). This low-level feel
2177 makes the structures straightforward to use and emphasizes that
2178 these are simply parameters used by the style functions.
2179
2180 For an example demonstrating how style options can be used, see
2181 the \l {widgets/styles}{Styles} example.
2182
2183 \sa QStyleOption, QStyleOptionComplex
2184*/
2185
2186/*!
2187 Constructs a QStyleOptionSpinBox, initializing the members
2188 variables to their default values.
2189*/
2190
2191QStyleOptionSpinBox::QStyleOptionSpinBox()
2192 : QStyleOptionComplex(Version, SO_SpinBox), buttonSymbols(QAbstractSpinBox::UpDownArrows),
2193 stepEnabled(QAbstractSpinBox::StepNone), frame(false)
2194{
2195}
2196
2197/*!
2198 \internal
2199*/
2200QStyleOptionSpinBox::QStyleOptionSpinBox(int version)
2201 : QStyleOptionComplex(version, SO_SpinBox), buttonSymbols(QAbstractSpinBox::UpDownArrows),
2202 stepEnabled(QAbstractSpinBox::StepNone), frame(false)
2203{
2204}
2205
2206/*!
2207 \fn QStyleOptionSpinBox::QStyleOptionSpinBox(const QStyleOptionSpinBox &other)
2208
2209 Constructs a copy of the \a other style option.
2210*/
2211
2212/*!
2213 \enum QStyleOptionSpinBox::StyleOptionType
2214
2215 This enum is used to hold information about the type of the style option, and
2216 is defined for each QStyleOption subclass.
2217
2218 \value Type The type of style option provided (\l{SO_SpinBox} for this class).
2219
2220 The type is used internally by QStyleOption, its subclasses, and
2221 qstyleoption_cast() to determine the type of style option. In
2222 general you do not need to worry about this unless you want to
2223 create your own QStyleOption subclass and your own styles.
2224
2225 \sa StyleOptionVersion
2226*/
2227
2228/*!
2229 \enum QStyleOptionSpinBox::StyleOptionVersion
2230
2231 This enum is used to hold information about the version of the style option, and
2232 is defined for each QStyleOption subclass.
2233
2234 \value Version 1
2235
2236 The version is used by QStyleOption subclasses to implement
2237 extensions without breaking compatibility. If you use
2238 qstyleoption_cast(), you normally do not need to check it.
2239
2240 \sa StyleOptionType
2241*/
2242
2243/*!
2244 \variable QStyleOptionSpinBox::buttonSymbols
2245 \brief the type of button symbols to draw for the spin box
2246
2247 The default value is QAbstractSpinBox::UpDownArrows specufying
2248 little arrows in the classic style.
2249
2250 \sa QAbstractSpinBox::ButtonSymbols
2251*/
2252
2253/*!
2254 \variable QStyleOptionSpinBox::stepEnabled
2255 \brief which buttons of the spin box that are enabled
2256
2257 The default value is QAbstractSpinBox::StepNone.
2258
2259 \sa QAbstractSpinBox::StepEnabled
2260*/
2261
2262/*!
2263 \variable QStyleOptionSpinBox::frame
2264 \brief whether the spin box has a frame
2265
2266 The default value is false, i.e. the spin box has no frame.
2267*/
2268#endif // QT_CONFIG(spinbox)
2269
2270/*!
2271 \class QStyleOptionDockWidget
2272 \brief The QStyleOptionDockWidget class is used to describe the
2273 parameters for drawing a dock widget.
2274
2275 \inmodule QtWidgets
2276
2277 QStyleOptionDockWidget contains all the information that QStyle
2278 functions need to draw graphical elements like QDockWidget.
2279
2280 For performance reasons, the access to the member variables is
2281 direct (i.e., using the \c . or \c -> operator). This low-level feel
2282 makes the structures straightforward to use and emphasizes that
2283 these are simply parameters used by the style functions.
2284
2285 For an example demonstrating how style options can be used, see
2286 the \l {widgets/styles}{Styles} example.
2287
2288 \sa QStyleOption
2289*/
2290
2291/*!
2292 \typedef QStyleOptionDockWidgetV2
2293 \relates QStyleOptionDockWidget
2294 \obsolete
2295
2296 Synonym for QStyleOptionDockWidget.
2297*/
2298
2299/*!
2300 Constructs a QStyleOptionDockWidget, initializing the member
2301 variables to their default values.
2302*/
2303
2304QStyleOptionDockWidget::QStyleOptionDockWidget()
2305 : QStyleOption(Version, SO_DockWidget), closable(false),
2306 movable(false), floatable(false), verticalTitleBar(false)
2307{
2308}
2309
2310/*!
2311 \internal
2312*/
2313QStyleOptionDockWidget::QStyleOptionDockWidget(int version)
2314 : QStyleOption(version, SO_DockWidget), closable(false),
2315 movable(false), floatable(false), verticalTitleBar(false)
2316{
2317}
2318
2319/*!
2320 \fn QStyleOptionDockWidget::QStyleOptionDockWidget(const QStyleOptionDockWidget &other)
2321
2322 Constructs a copy of the \a other style option.
2323*/
2324
2325/*!
2326 \enum QStyleOptionDockWidget::StyleOptionType
2327
2328 This enum is used to hold information about the type of the style option, and
2329 is defined for each QStyleOption subclass.
2330
2331 \value Type The type of style option provided (\l{SO_DockWidget} for this class).
2332
2333 The type is used internally by QStyleOption, its subclasses, and
2334 qstyleoption_cast() to determine the type of style option. In
2335 general you do not need to worry about this unless you want to
2336 create your own QStyleOption subclass and your own styles.
2337
2338 \sa StyleOptionVersion
2339*/
2340
2341/*!
2342 \enum QStyleOptionDockWidget::StyleOptionVersion
2343
2344 This enum is used to hold information about the version of the style option, and
2345 is defined for each QStyleOption subclass.
2346
2347 \value Version 2
2348
2349 The version is used by QStyleOption subclasses to implement
2350 extensions without breaking compatibility. If you use
2351 qstyleoption_cast(), you normally do not need to check it.
2352
2353 \sa StyleOptionType
2354*/
2355
2356/*!
2357 \variable QStyleOptionDockWidget::title
2358 \brief the title of the dock window
2359
2360 The default value is an empty string.
2361*/
2362
2363/*!
2364 \variable QStyleOptionDockWidget::closable
2365 \brief whether the dock window is closable
2366
2367 The default value is true.
2368*/
2369
2370/*!
2371 \variable QStyleOptionDockWidget::movable
2372 \brief whether the dock window is movable
2373
2374 The default value is false.
2375*/
2376
2377/*!
2378 \variable QStyleOptionDockWidget::floatable
2379 \brief whether the dock window is floatable
2380
2381 The default value is true.
2382*/
2383
2384/*!
2385 \class QStyleOptionToolButton
2386 \brief The QStyleOptionToolButton class is used to describe the
2387 parameters for drawing a tool button.
2388
2389 \inmodule QtWidgets
2390
2391 QStyleOptionToolButton contains all the information that QStyle
2392 functions need to draw QToolButton.
2393
2394 For performance reasons, the access to the member variables is
2395 direct (i.e., using the \c . or \c -> operator). This low-level feel
2396 makes the structures straightforward to use and emphasizes that
2397 these are simply parameters used by the style functions.
2398
2399 For an example demonstrating how style options can be used, see
2400 the \l {widgets/styles}{Styles} example.
2401
2402 \sa QStyleOption, QStyleOptionComplex, QStyleOptionButton
2403*/
2404
2405/*!
2406 \enum QStyleOptionToolButton::ToolButtonFeature
2407 Describes the various features that a tool button can have.
2408
2409 \value None A normal tool button.
2410 \value Arrow The tool button is an arrow.
2411 \value Menu The tool button has a menu.
2412 \value PopupDelay There is a delay to showing the menu.
2413 \value HasMenu The button has a popup menu.
2414 \value MenuButtonPopup The button should display an arrow to
2415 indicate that a menu is present.
2416
2417 \sa features, QToolButton::toolButtonStyle(), QToolButton::popupMode()
2418*/
2419
2420/*!
2421 Constructs a QStyleOptionToolButton, initializing the members
2422 variables to their default values.
2423*/
2424
2425QStyleOptionToolButton::QStyleOptionToolButton()
2426 : QStyleOptionComplex(Version, SO_ToolButton), features(None), arrowType(Qt::DownArrow)
2427 , toolButtonStyle(Qt::ToolButtonIconOnly)
2428{
2429}
2430
2431/*!
2432 \internal
2433*/
2434QStyleOptionToolButton::QStyleOptionToolButton(int version)
2435 : QStyleOptionComplex(version, SO_ToolButton), features(None), arrowType(Qt::DownArrow)
2436 , toolButtonStyle(Qt::ToolButtonIconOnly)
2437
2438{
2439}
2440
2441/*!
2442 \fn QStyleOptionToolButton::QStyleOptionToolButton(const QStyleOptionToolButton &other)
2443
2444 Constructs a copy of the \a other style option.
2445*/
2446
2447/*!
2448 \enum QStyleOptionToolButton::StyleOptionType
2449
2450 This enum is used to hold information about the type of the style option, and
2451 is defined for each QStyleOption subclass.
2452
2453 \value Type The type of style option provided (\l{SO_ToolButton} for this class).
2454
2455 The type is used internally by QStyleOption, its subclasses, and
2456 qstyleoption_cast() to determine the type of style option. In
2457 general you do not need to worry about this unless you want to
2458 create your own QStyleOption subclass and your own styles.
2459
2460 \sa StyleOptionVersion
2461*/
2462
2463/*!
2464 \enum QStyleOptionToolButton::StyleOptionVersion
2465
2466 This enum is used to hold information about the version of the style option, and
2467 is defined for each QStyleOption subclass.
2468
2469 \value Version 1
2470
2471 The version is used by QStyleOption subclasses to implement
2472 extensions without breaking compatibility. If you use
2473 qstyleoption_cast(), you normally do not need to check it.
2474
2475 \sa StyleOptionType
2476*/
2477
2478/*!
2479 \variable QStyleOptionToolButton::features
2480 \brief an OR combination of the tool button's features
2481
2482 The default value is \l None.
2483
2484 \sa ToolButtonFeature
2485*/
2486
2487/*!
2488 \variable QStyleOptionToolButton::icon
2489 \brief the icon for the tool button
2490
2491 The default value is an empty icon, i.e. an icon with neither a
2492 pixmap nor a filename.
2493
2494 \sa iconSize
2495*/
2496
2497/*!
2498 \variable QStyleOptionToolButton::iconSize
2499 \brief the size of the icon for the tool button
2500
2501 The default value is QSize(-1, -1), i.e. an invalid size.
2502*/
2503
2504/*!
2505 \variable QStyleOptionToolButton::text
2506 \brief the text of the tool button
2507
2508 This value is only used if toolButtonStyle is
2509 Qt::ToolButtonTextUnderIcon, Qt::ToolButtonTextBesideIcon, or
2510 Qt::ToolButtonTextOnly. The default value is an empty string.
2511*/
2512
2513/*!
2514 \variable QStyleOptionToolButton::arrowType
2515 \brief the direction of the arrow for the tool button
2516
2517 This value is only used if \l features includes \l Arrow. The
2518 default value is Qt::DownArrow.
2519*/
2520
2521/*!
2522 \variable QStyleOptionToolButton::toolButtonStyle
2523 \brief a Qt::ToolButtonStyle value describing the appearance of
2524 the tool button
2525
2526 The default value is Qt::ToolButtonIconOnly.
2527
2528 \sa QToolButton::toolButtonStyle()
2529*/
2530
2531/*!
2532 \variable QStyleOptionToolButton::pos
2533 \brief the position of the tool button
2534
2535 The default value is a null point, i.e. (0, 0)
2536*/
2537
2538/*!
2539 \variable QStyleOptionToolButton::font
2540 \brief the font that is used for the text
2541
2542 This value is only used if toolButtonStyle is
2543 Qt::ToolButtonTextUnderIcon, Qt::ToolButtonTextBesideIcon, or
2544 Qt::ToolButtonTextOnly. By default, the application's default font
2545 is used.
2546*/
2547
2548/*!
2549 \class QStyleOptionComboBox
2550 \brief The QStyleOptionComboBox class is used to describe the
2551 parameter for drawing a combobox.
2552
2553 \inmodule QtWidgets
2554
2555 QStyleOptionButton contains all the information that QStyle
2556 functions need to draw QComboBox.
2557
2558 For performance reasons, the access to the member variables is
2559 direct (i.e., using the \c . or \c -> operator). This low-level feel
2560 makes the structures straightforward to use and emphasizes that
2561 these are simply parameters used by the style functions.
2562
2563 For an example demonstrating how style options can be used, see
2564 the \l {widgets/styles}{Styles} example.
2565
2566 \sa QStyleOption, QStyleOptionComplex, QComboBox
2567*/
2568
2569/*!
2570 Creates a QStyleOptionComboBox, initializing the members variables
2571 to their default values.
2572*/
2573
2574QStyleOptionComboBox::QStyleOptionComboBox()
2575 : QStyleOptionComplex(Version, SO_ComboBox), editable(false), frame(true)
2576{
2577}
2578
2579/*!
2580 \internal
2581*/
2582QStyleOptionComboBox::QStyleOptionComboBox(int version)
2583 : QStyleOptionComplex(version, SO_ComboBox), editable(false), frame(true)
2584{
2585}
2586
2587/*!
2588 \fn QStyleOptionComboBox::QStyleOptionComboBox(const QStyleOptionComboBox &other)
2589
2590 Constructs a copy of the \a other style option.
2591*/
2592
2593/*!
2594 \enum QStyleOptionComboBox::StyleOptionType
2595
2596 This enum is used to hold information about the type of the style option, and
2597 is defined for each QStyleOption subclass.
2598
2599 \value Type The type of style option provided (\l{SO_ComboBox} for this class).
2600
2601 The type is used internally by QStyleOption, its subclasses, and
2602 qstyleoption_cast() to determine the type of style option. In
2603 general you do not need to worry about this unless you want to
2604 create your own QStyleOption subclass and your own styles.
2605
2606 \sa StyleOptionVersion
2607*/
2608
2609/*!
2610 \enum QStyleOptionComboBox::StyleOptionVersion
2611
2612 This enum is used to hold information about the version of the style option, and
2613 is defined for each QStyleOption subclass.
2614
2615 \value Version 1
2616
2617 The version is used by QStyleOption subclasses to implement
2618 extensions without breaking compatibility. If you use
2619 qstyleoption_cast(), you normally do not need to check it.
2620
2621 \sa StyleOptionType
2622*/
2623
2624/*!
2625 \variable QStyleOptionComboBox::editable
2626 \brief whether or not the combobox is editable or not
2627
2628 the default
2629 value is false
2630
2631 \sa QComboBox::isEditable()
2632*/
2633
2634
2635/*!
2636 \variable QStyleOptionComboBox::frame
2637 \brief whether the combo box has a frame
2638
2639 The default value is true.
2640*/
2641
2642/*!
2643 \variable QStyleOptionComboBox::currentText
2644 \brief the text for the current item of the combo box
2645
2646 The default value is an empty string.
2647*/
2648
2649/*!
2650 \variable QStyleOptionComboBox::currentIcon
2651 \brief the icon for the current item of the combo box
2652
2653 The default value is an empty icon, i.e. an icon with neither a
2654 pixmap nor a filename.
2655*/
2656
2657/*!
2658 \variable QStyleOptionComboBox::iconSize
2659 \brief the icon size for the current item of the combo box
2660
2661 The default value is QSize(-1, -1), i.e. an invalid size.
2662*/
2663
2664/*!
2665 \variable QStyleOptionComboBox::popupRect
2666 \brief the popup rectangle for the combobox
2667
2668 The default value is a null rectangle, i.e. a rectangle with both
2669 the width and the height set to 0.
2670
2671 This variable is currently unused. You can safely ignore it.
2672
2673 \sa QStyle::SC_ComboBoxListBoxPopup
2674*/
2675
2676/*!
2677 \class QStyleOptionToolBox
2678 \brief The QStyleOptionToolBox class is used to describe the
2679 parameters needed for drawing a tool box.
2680
2681 \inmodule QtWidgets
2682
2683 QStyleOptionToolBox contains all the information that QStyle
2684 functions need to draw QToolBox.
2685
2686 For performance reasons, the access to the member variables is
2687 direct (i.e., using the \c . or \c -> operator). This low-level feel
2688 makes the structures straightforward to use and emphasizes that
2689 these are simply parameters used by the style functions.
2690
2691 For an example demonstrating how style options can be used, see
2692 the \l {widgets/styles}{Styles} example.
2693
2694 \sa QStyleOption, QToolBox
2695*/
2696
2697/*!
2698 \typedef QStyleOptionToolBoxV2
2699 \relates QStyleOptionToolBox
2700 \obsolete
2701
2702 Synonym for QStyleOptionToolBox.
2703*/
2704
2705/*!
2706 Creates a QStyleOptionToolBox, initializing the members variables
2707 to their default values.
2708*/
2709
2710QStyleOptionToolBox::QStyleOptionToolBox()
2711 : QStyleOption(Version, SO_ToolBox), position(Beginning), selectedPosition(NotAdjacent)
2712{
2713}
2714
2715/*!
2716 \internal
2717*/
2718QStyleOptionToolBox::QStyleOptionToolBox(int version)
2719 : QStyleOption(version, SO_ToolBox), position(Beginning), selectedPosition(NotAdjacent)
2720{
2721}
2722
2723/*!
2724 \fn QStyleOptionToolBox::QStyleOptionToolBox(const QStyleOptionToolBox &other)
2725
2726 Constructs a copy of the \a other style option.
2727*/
2728
2729/*!
2730 \enum QStyleOptionToolBox::StyleOptionType
2731
2732 This enum is used to hold information about the type of the style option, and
2733 is defined for each QStyleOption subclass.
2734
2735 \value Type The type of style option provided (\l{SO_ToolBox} for this class).
2736
2737 The type is used internally by QStyleOption, its subclasses, and
2738 qstyleoption_cast() to determine the type of style option. In
2739 general you do not need to worry about this unless you want to
2740 create your own QStyleOption subclass and your own styles.
2741
2742 \sa StyleOptionVersion
2743*/
2744
2745/*!
2746 \enum QStyleOptionToolBox::StyleOptionVersion
2747
2748 This enum is used to hold information about the version of the style option, and
2749 is defined for each QStyleOption subclass.
2750
2751 \value Version 2
2752
2753 The version is used by QStyleOption subclasses to implement
2754 extensions without breaking compatibility. If you use
2755 qstyleoption_cast(), you normally do not need to check it.
2756
2757 \sa StyleOptionType
2758*/
2759
2760/*!
2761 \variable QStyleOptionToolBox::icon
2762 \brief the icon for the tool box tab
2763
2764 The default value is an empty icon, i.e. an icon with neither a
2765 pixmap nor a filename.
2766*/
2767
2768/*!
2769 \variable QStyleOptionToolBox::text
2770 \brief the text for the tool box tab
2771
2772 The default value is an empty string.
2773*/
2774
2775/*!
2776 \enum QStyleOptionToolBox::SelectedPosition
2777
2778 This enum describes the position of the selected tab. Some styles
2779 need to draw a tab differently depending on whether or not it is
2780 adjacent to the selected tab.
2781
2782 \value NotAdjacent The tab is not adjacent to a selected tab (or is the selected tab).
2783 \value NextIsSelected The next tab (typically the tab on the right) is selected.
2784 \value PreviousIsSelected The previous tab (typically the tab on the left) is selected.
2785
2786 \sa selectedPosition
2787*/
2788
2789/*!
2790 \enum QStyleOptionToolBox::TabPosition
2791
2792 This enum describes tab positions relative to other tabs.
2793
2794 \value Beginning The tab is the first (i.e., top-most) tab in
2795 the toolbox.
2796 \value Middle The tab is placed in the middle of the toolbox.
2797 \value End The tab is placed at the bottom of the toolbox.
2798 \value OnlyOneTab There is only one tab in the toolbox.
2799*/
2800
2801/*!
2802 \variable QStyleOptionToolBox::selectedPosition
2803 \brief the position of the selected tab in relation to this tab
2804
2805 The default value is NotAdjacent, i.e. the tab is not adjacent to
2806 a selected tab nor is it the selected tab.
2807*/
2808
2809#if QT_CONFIG(rubberband)
2810/*!
2811 \class QStyleOptionRubberBand
2812 \brief The QStyleOptionRubberBand class is used to describe the
2813 parameters needed for drawing a rubber band.
2814
2815 \inmodule QtWidgets
2816
2817 QStyleOptionRubberBand contains all the information that
2818 QStyle functions need to draw QRubberBand.
2819
2820 For performance reasons, the access to the member variables is
2821 direct (i.e., using the \c . or \c -> operator). This low-level feel
2822 makes the structures straightforward to use and emphasizes that
2823 these are simply parameters used by the style functions.
2824
2825 For an example demonstrating how style options can be used, see
2826 the \l {widgets/styles}{Styles} example.
2827
2828 \sa QStyleOption, QRubberBand
2829*/
2830
2831/*!
2832 Creates a QStyleOptionRubberBand, initializing the members
2833 variables to their default values.
2834*/
2835
2836QStyleOptionRubberBand::QStyleOptionRubberBand()
2837 : QStyleOption(Version, SO_RubberBand), shape(QRubberBand::Line), opaque(false)
2838{
2839}
2840
2841/*!
2842 \internal
2843*/
2844QStyleOptionRubberBand::QStyleOptionRubberBand(int version)
2845 : QStyleOption(version, SO_RubberBand), shape(QRubberBand::Line), opaque(false)
2846{
2847}
2848
2849/*!
2850 \fn QStyleOptionRubberBand::QStyleOptionRubberBand(const QStyleOptionRubberBand &other)
2851
2852 Constructs a copy of the \a other style option.
2853*/
2854
2855/*!
2856 \enum QStyleOptionRubberBand::StyleOptionType
2857
2858 This enum is used to hold information about the type of the style option, and
2859 is defined for each QStyleOption subclass.
2860
2861 \value Type The type of style option provided (\l{SO_RubberBand} for this class).
2862
2863 The type is used internally by QStyleOption, its subclasses, and
2864 qstyleoption_cast() to determine the type of style option. In
2865 general you do not need to worry about this unless you want to
2866 create your own QStyleOption subclass and your own styles.
2867
2868 \sa StyleOptionVersion
2869*/
2870
2871/*!
2872 \enum QStyleOptionRubberBand::StyleOptionVersion
2873
2874 This enum is used to hold information about the version of the style option, and
2875 is defined for each QStyleOption subclass.
2876
2877 \value Version 1
2878
2879 The version is used by QStyleOption subclasses to implement
2880 extensions without breaking compatibility. If you use
2881 qstyleoption_cast(), you normally do not need to check it.
2882
2883 \sa StyleOptionType
2884*/
2885
2886/*!
2887 \variable QStyleOptionRubberBand::shape
2888 \brief the shape of the rubber band
2889
2890 The default shape is QRubberBand::Line.
2891*/
2892
2893/*!
2894 \variable QStyleOptionRubberBand::opaque
2895 \brief whether the rubber band is required to be drawn in an opaque style
2896
2897 The default value is true.
2898*/
2899#endif // QT_CONFIG(rubberband)
2900
2901/*!
2902 \class QStyleOptionTitleBar
2903 \brief The QStyleOptionTitleBar class is used to describe the
2904 parameters for drawing a title bar.
2905
2906 \inmodule QtWidgets
2907
2908 QStyleOptionTitleBar contains all the information that QStyle
2909 functions need to draw the title bar of a QMdiSubWindow.
2910
2911 For performance reasons, the access to the member variables is
2912 direct (i.e., using the \c . or \c -> operator). This low-level feel
2913 makes the structures straightforward to use and emphasizes that
2914 these are simply parameters used by the style functions.
2915
2916 For an example demonstrating how style options can be used, see
2917 the \l {widgets/styles}{Styles} example.
2918
2919 \sa QStyleOption, QStyleOptionComplex, QMdiSubWindow
2920*/
2921
2922/*!
2923 Constructs a QStyleOptionTitleBar, initializing the members
2924 variables to their default values.
2925*/
2926
2927QStyleOptionTitleBar::QStyleOptionTitleBar()
2928 : QStyleOptionComplex(Version, SO_TitleBar), titleBarState(0)
2929{
2930}
2931
2932/*!
2933 \fn QStyleOptionTitleBar::QStyleOptionTitleBar(const QStyleOptionTitleBar &other)
2934
2935 Constructs a copy of the \a other style option.
2936*/
2937
2938/*!
2939 \enum QStyleOptionTitleBar::StyleOptionType
2940
2941 This enum is used to hold information about the type of the style option, and
2942 is defined for each QStyleOption subclass.
2943
2944 \value Type The type of style option provided (\l{SO_TitleBar} for this class).
2945
2946 The type is used internally by QStyleOption, its subclasses, and
2947 qstyleoption_cast() to determine the type of style option. In
2948 general you do not need to worry about this unless you want to
2949 create your own QStyleOption subclass and your own styles.
2950
2951 \sa StyleOptionVersion
2952*/
2953
2954/*!
2955 \enum QStyleOptionTitleBar::StyleOptionVersion
2956
2957 This enum is used to hold information about the version of the style option, and
2958 is defined for each QStyleOption subclass.
2959
2960 \value Version 1
2961
2962 The version is used by QStyleOption subclasses to implement
2963 extensions without breaking compatibility. If you use
2964 qstyleoption_cast(), you normally do not need to check it.
2965
2966 \sa StyleOptionType
2967*/
2968
2969/*!
2970 \internal
2971*/
2972QStyleOptionTitleBar::QStyleOptionTitleBar(int version)
2973 : QStyleOptionComplex(version, SO_TitleBar), titleBarState(0)
2974{
2975}
2976
2977
2978/*!
2979 \variable QStyleOptionTitleBar::text
2980 \brief the text of the title bar
2981
2982 The default value is an empty string.
2983*/
2984
2985/*!
2986 \variable QStyleOptionTitleBar::icon
2987 \brief the icon for the title bar
2988
2989 The default value is an empty icon, i.e. an icon with neither a
2990 pixmap nor a filename.
2991*/
2992
2993/*!
2994 \variable QStyleOptionTitleBar::titleBarState
2995 \brief the state of the title bar
2996
2997 This is basically the window state of the underlying widget. The
2998 default value is 0.
2999
3000 \sa QWidget::windowState()
3001*/
3002
3003/*!
3004 \variable QStyleOptionTitleBar::titleBarFlags
3005 \brief the widget flags for the title bar
3006
3007 The default value is Qt::Widget.
3008
3009 \sa Qt::WindowFlags
3010*/
3011
3012#if QT_CONFIG(itemviews)
3013/*!
3014 \class QStyleOptionViewItem
3015 \brief The QStyleOptionViewItem class is used to describe the
3016 parameters used to draw an item in a view widget.
3017
3018 \inmodule QtWidgets
3019
3020 QStyleOptionViewItem contains all the information that QStyle
3021 functions need to draw the items for Qt's model/view classes.
3022
3023 For performance reasons, the access to the member variables is
3024 direct (i.e., using the \c . or \c -> operator). This low-level feel
3025 makes the structures straightforward to use and emphasizes that
3026 these are simply parameters used by the style functions.
3027
3028 For an example demonstrating how style options can be used, see
3029 the \l {widgets/styles}{Styles} example.
3030
3031 \sa QStyleOption, {model-view-programming.html}{Model/View
3032 Programming}
3033*/
3034
3035/*!
3036 \typedef QStyleOptionViewItemV2
3037 \relates QStyleOptionViewItem
3038 \obsolete
3039
3040 Synonym for QStyleOptionViewItem.
3041*/
3042
3043/*!
3044 \typedef QStyleOptionViewItemV3
3045 \relates QStyleOptionViewItem
3046 \obsolete
3047
3048 Synonym for QStyleOptionViewItem.
3049*/
3050
3051/*!
3052 \typedef QStyleOptionViewItemV4
3053 \relates QStyleOptionViewItem
3054 \obsolete
3055
3056 Synonym for QStyleOptionViewItem.
3057*/
3058
3059/*!
3060 \enum QStyleOptionViewItem::Position
3061
3062 This enum describes the position of the item's decoration.
3063
3064 \value Left On the left of the text.
3065 \value Right On the right of the text.
3066 \value Top Above the text.
3067 \value Bottom Below the text.
3068
3069 \sa decorationPosition
3070*/
3071
3072/*!
3073 \variable QStyleOptionViewItem::showDecorationSelected
3074 \brief whether the decoration should be highlighted on selected
3075 items
3076
3077 If this option is true, the branch and any decorations on selected items
3078 should be highlighted, indicating that the item is selected; otherwise, no
3079 highlighting is required. The default value is false.
3080
3081 \sa QStyle::SH_ItemView_ShowDecorationSelected, QAbstractItemView
3082*/
3083
3084/*!
3085 \variable QStyleOptionViewItem::textElideMode
3086 \brief where ellipsis should be added for text that is too long to fit
3087 into an item
3088
3089 The default value is Qt::ElideMiddle, i.e. the ellipsis appears in
3090 the middle of the text.
3091
3092 \sa Qt::TextElideMode, QStyle::SH_ItemView_EllipsisLocation
3093*/
3094
3095/*!
3096 Constructs a QStyleOptionViewItem, initializing the members
3097 variables to their default values.
3098*/
3099
3100QStyleOptionViewItem::QStyleOptionViewItem()
3101 : QStyleOption(Version, SO_ViewItem),
3102 displayAlignment(Qt::AlignLeft), decorationAlignment(Qt::AlignLeft),
3103 textElideMode(Qt::ElideMiddle), decorationPosition(Left),
3104 showDecorationSelected(false), features(None), widget(nullptr),
3105 checkState(Qt::Unchecked), viewItemPosition(QStyleOptionViewItem::Invalid)
3106{
3107}
3108
3109/*!
3110 \internal
3111*/
3112QStyleOptionViewItem::QStyleOptionViewItem(int version)
3113 : QStyleOption(version, SO_ViewItem),
3114 displayAlignment(Qt::AlignLeft), decorationAlignment(Qt::AlignLeft),
3115 textElideMode(Qt::ElideMiddle), decorationPosition(Left),
3116 showDecorationSelected(false), features(None), widget(nullptr),
3117 checkState(Qt::Unchecked), viewItemPosition(QStyleOptionViewItem::Invalid)
3118{
3119}
3120
3121/*!
3122 \fn QStyleOptionViewItem::QStyleOptionViewItem(const QStyleOptionViewItem &other)
3123
3124 Constructs a copy of the \a other style option.
3125*/
3126
3127/*!
3128 \enum QStyleOptionViewItem::StyleOptionType
3129
3130 This enum is used to hold information about the type of the style option, and
3131 is defined for each QStyleOption subclass.
3132
3133 \value Type The type of style option provided (\l{SO_ViewItem} for this class).
3134
3135 The type is used internally by QStyleOption, its subclasses, and
3136 qstyleoption_cast() to determine the type of style option. In
3137 general you do not need to worry about this unless you want to
3138 create your own QStyleOption subclass and your own styles.
3139
3140 \sa StyleOptionVersion
3141*/
3142
3143/*!
3144 \enum QStyleOptionViewItem::StyleOptionVersion
3145
3146 This enum is used to hold information about the version of the style option, and
3147 is defined for each QStyleOption subclass.
3148
3149 \value Version 4
3150
3151 The version is used by QStyleOption subclasses to implement
3152 extensions without breaking compatibility. If you use
3153 qstyleoption_cast(), you normally do not need to check it.
3154
3155 \sa StyleOptionType
3156*/
3157
3158/*!
3159 \variable QStyleOptionViewItem::displayAlignment
3160 \brief the alignment of the display value for the item
3161
3162 The default value is Qt::AlignLeft.
3163*/
3164
3165/*!
3166 \variable QStyleOptionViewItem::decorationAlignment
3167 \brief the alignment of the decoration for the item
3168
3169 The default value is Qt::AlignLeft.
3170*/
3171
3172/*!
3173 \variable QStyleOptionViewItem::decorationPosition
3174 \brief the position of the decoration for the item
3175
3176 The default value is \l Left.
3177
3178 \sa Position
3179*/
3180
3181/*!
3182 \variable QStyleOptionViewItem::decorationSize
3183 \brief the size of the decoration for the item
3184
3185 The default value is QSize(-1, -1), i.e. an invalid size.
3186
3187 \sa decorationAlignment, decorationPosition
3188*/
3189
3190/*!
3191 \variable QStyleOptionViewItem::font
3192 \brief the font used for the item
3193
3194 By default, the application's default font is used.
3195
3196 \sa QFont
3197*/
3198
3199/*!
3200 \variable QStyleOptionViewItem::features
3201 \brief a bitwise OR of the features that describe this view item
3202
3203 \sa ViewItemFeature
3204*/
3205
3206/*!
3207 \enum QStyleOptionViewItem::ViewItemFeature
3208
3209 This enum describes the different types of features an item can have.
3210
3211 \value None Indicates a normal item.
3212 \value WrapText Indicates an item with wrapped text.
3213 \value Alternate Indicates that the item's background is rendered using alternateBase.
3214 \value HasCheckIndicator Indicates that the item has a check state indicator.
3215 \value HasDisplay Indicates that the item has a display role.
3216 \value HasDecoration Indicates that the item has a decoration role.
3217*/
3218
3219/*!
3220 \variable QStyleOptionViewItem::index
3221
3222 The model index that is to be drawn.
3223*/
3224
3225/*!
3226 \variable QStyleOptionViewItem::checkState
3227
3228 If this view item is checkable, i.e.,
3229 ViewItemFeature::HasCheckIndicator is true, \c checkState is true
3230 if the item is checked; otherwise, it is false.
3231
3232*/
3233
3234/*!
3235 \variable QStyleOptionViewItem::icon
3236
3237 The icon (if any) to be drawn in the view item.
3238*/
3239
3240
3241/*!
3242 \variable QStyleOptionViewItem::text
3243
3244 The text (if any) to be drawn in the view item.
3245*/
3246
3247/*!
3248 \variable QStyleOptionViewItem::backgroundBrush
3249
3250 The QBrush that should be used to paint the view items
3251 background.
3252*/
3253
3254/*!
3255 \variable QStyleOptionViewItem::viewItemPosition
3256
3257 Gives the position of this view item relative to other items. See
3258 the \l{QStyleOptionViewItem::}{ViewItemPosition} enum for the
3259 details.
3260*/
3261
3262/*!
3263 \enum QStyleOptionViewItem::ViewItemPosition
3264
3265 This enum is used to represent the placement of the item on
3266 a row. This can be used to draw items differently depending
3267 on their placement, for example by putting rounded edges at
3268 the beginning and end, and straight edges in between.
3269
3270 \value Invalid The ViewItemPosition is unknown and should be
3271 disregarded.
3272 \value Beginning The item appears at the beginning of the row.
3273 \value Middle The item appears in the middle of the row.
3274 \value End The item appears at the end of the row.
3275 \value OnlyOne The item is the only one on the row, and is
3276 therefore both at the beginning and the end.
3277*/
3278
3279#endif // QT_CONFIG(itemviews)
3280/*!
3281 \fn template <typename T> T qstyleoption_cast<T>(const QStyleOption *option)
3282 \relates QStyleOption
3283
3284 Returns a T or \nullptr depending on the \l{QStyleOption::type}{type} and
3285 \l{QStyleOption::version}{version} of the given \a option.
3286
3287 Example:
3288
3289 \snippet qstyleoption/main.cpp 4
3290
3291 \sa QStyleOption::type, QStyleOption::version
3292*/
3293
3294/*!
3295 \fn template <typename T> T qstyleoption_cast<T>(QStyleOption *option)
3296 \overload
3297 \relates QStyleOption
3298
3299 Returns a T or \nullptr depending on the type of the given \a option.
3300*/
3301
3302#if QT_CONFIG(tabwidget)
3303/*!
3304 \class QStyleOptionTabWidgetFrame
3305 \brief The QStyleOptionTabWidgetFrame class is used to describe the
3306 parameters for drawing the frame around a tab widget.
3307
3308 \inmodule QtWidgets
3309
3310 QStyleOptionTabWidgetFrame contains all the information that
3311 QStyle functions need to draw the frame around QTabWidget.
3312
3313 For performance reasons, the access to the member variables is
3314 direct (i.e., using the \c . or \c -> operator). This low-level feel
3315 makes the structures straightforward to use and emphasizes that
3316 these are simply parameters used by the style functions.
3317
3318 For an example demonstrating how style options can be used, see
3319 the \l {widgets/styles}{Styles} example.
3320
3321 \sa QStyleOption, QTabWidget
3322*/
3323
3324/*!
3325 \typedef QStyleOptionTabWidgetFrameV2
3326 \relates QStyleOptionTabWidgetFrame
3327 \obsolete
3328
3329 Synonym for QStyleOptionTabWidgetFrame.
3330*/
3331
3332/*!
3333 Constructs a QStyleOptionTabWidgetFrame, initializing the members
3334 variables to their default values.
3335*/
3336QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame()
3337 : QStyleOption(Version, SO_TabWidgetFrame), lineWidth(0), midLineWidth(0),
3338 shape(QTabBar::RoundedNorth)
3339{
3340}
3341
3342/*!
3343 \fn QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(const QStyleOptionTabWidgetFrame &other)
3344
3345 Constructs a copy of \a other.
3346*/
3347
3348/*! \internal */
3349QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(int version)
3350 : QStyleOption(version, SO_TabWidgetFrame), lineWidth(0), midLineWidth(0),
3351 shape(QTabBar::RoundedNorth)
3352{
3353}
3354
3355/*!
3356 \enum QStyleOptionTabWidgetFrame::StyleOptionType
3357
3358 This enum is used to hold information about the type of the style option, and
3359 is defined for each QStyleOption subclass.
3360
3361 \value Type The type of style option provided (\l{SO_TabWidgetFrame} for this class).
3362
3363 The type is used internally by QStyleOption, its subclasses, and
3364 qstyleoption_cast() to determine the type of style option. In
3365 general you do not need to worry about this unless you want to
3366 create your own QStyleOption subclass and your own styles.
3367
3368 \sa StyleOptionVersion
3369*/
3370
3371/*!
3372 \enum QStyleOptionTabWidgetFrame::StyleOptionVersion
3373
3374 This enum is used to hold information about the version of the style option, and
3375 is defined for each QStyleOption subclass.
3376
3377 \value Version 2
3378
3379 The version is used by QStyleOption subclasses to implement
3380 extensions without breaking compatibility. If you use
3381 qstyleoption_cast(), you normally do not need to check it.
3382
3383 \sa StyleOptionType
3384*/
3385
3386/*!
3387 \variable QStyleOptionTabWidgetFrame::lineWidth
3388 \brief the line width for drawing the panel
3389
3390 The default value is 0.
3391*/
3392
3393/*!
3394 \variable QStyleOptionTabWidgetFrame::midLineWidth
3395 \brief the mid-line width for drawing the panel
3396
3397 The mid line width is usually used in drawing sunken or raised
3398 frames. The default value is 0.
3399*/
3400
3401/*!
3402 \variable QStyleOptionTabWidgetFrame::shape
3403 \brief the tab shape used to draw the tabs
3404
3405 The default value is QTabBar::RoundedNorth.
3406*/
3407
3408/*!
3409 \variable QStyleOptionTabWidgetFrame::tabBarSize
3410 \brief the size of the tab bar
3411
3412 The default value is QSize(-1, -1), i.e. an invalid size.
3413*/
3414
3415/*!
3416 \variable QStyleOptionTabWidgetFrame::rightCornerWidgetSize
3417 \brief the size of the right-corner widget
3418
3419 The default value is QSize(-1, -1), i.e. an invalid size.
3420*/
3421
3422/*! \variable QStyleOptionTabWidgetFrame::leftCornerWidgetSize
3423 \brief the size of the left-corner widget
3424
3425 The default value is QSize(-1, -1), i.e. an invalid size.
3426*/
3427
3428
3429/*!
3430 \variable QStyleOptionTabWidgetFrame::tabBarRect
3431 \brief the rectangle containing all the tabs
3432
3433 The default value is a null rectangle, i.e. a rectangle with both
3434 the width and the height set to 0.
3435*/
3436
3437/*!
3438 \variable QStyleOptionTabWidgetFrame::selectedTabRect
3439 \brief the rectangle containing the selected tab
3440
3441 This rectangle is contained within the tabBarRect. The default
3442 value is a null rectangle, i.e. a rectangle with both the width
3443 and the height set to 0.
3444*/
3445
3446#endif // QT_CONFIG(tabwidget)
3447
3448#if QT_CONFIG(tabbar)
3449
3450/*!
3451 \class QStyleOptionTabBarBase
3452 \brief The QStyleOptionTabBarBase class is used to describe
3453 the base of a tab bar, i.e. the part that the tab bar usually
3454 overlaps with.
3455
3456 \inmodule QtWidgets
3457
3458 QStyleOptionTabBarBase contains all the information that QStyle
3459 functions need to draw the tab bar base. Note that this is only
3460 drawn for a standalone QTabBar (one that isn't part of a
3461 QTabWidget).
3462
3463 For performance reasons, the access to the member variables is
3464 direct (i.e., using the \c . or \c -> operator). This low-level feel
3465 makes the structures straightforward to use and emphasizes that
3466 these are simply parameters used by the style functions.
3467
3468 For an example demonstrating how style options can be used, see
3469 the \l {widgets/styles}{Styles} example.
3470
3471 \sa QStyleOption, QTabBar::drawBase()
3472*/
3473
3474/*!
3475 \typedef QStyleOptionTabBarBaseV2
3476 \relates QStyleOptionTabBarBase
3477 \obsolete
3478
3479 Synonym for QStyleOptionTabBarBase.
3480*/
3481
3482/*!
3483 Construct a QStyleOptionTabBarBase, initializing the members
3484 vaiables to their default values.
3485*/
3486QStyleOptionTabBarBase::QStyleOptionTabBarBase()
3487 : QStyleOption(Version, SO_TabBarBase), shape(QTabBar::RoundedNorth),
3488 documentMode(false)
3489{
3490}
3491
3492/*! \internal */
3493QStyleOptionTabBarBase::QStyleOptionTabBarBase(int version)
3494 : QStyleOption(version, SO_TabBarBase), shape(QTabBar::RoundedNorth),
3495 documentMode(false)
3496{
3497}
3498
3499/*!
3500 \fn QStyleOptionTabBarBase::QStyleOptionTabBarBase(const QStyleOptionTabBarBase &other)
3501
3502 Constructs a copy of \a other.
3503*/
3504
3505/*!
3506 \enum QStyleOptionTabBarBase::StyleOptionType
3507
3508 This enum is used to hold information about the type of the style option, and
3509 is defined for each QStyleOption subclass.
3510
3511 \value Type The type of style option provided (\l{SO_TabBarBase} for this class).
3512
3513 The type is used internally by QStyleOption, its subclasses, and
3514 qstyleoption_cast() to determine the type of style option. In
3515 general you do not need to worry about this unless you want to
3516 create your own QStyleOption subclass and your own styles.
3517
3518 \sa StyleOptionVersion
3519*/
3520
3521/*!
3522 \enum QStyleOptionTabBarBase::StyleOptionVersion
3523
3524 This enum is used to hold information about the version of the style option, and
3525 is defined for each QStyleOption subclass.
3526
3527 \value Version 2
3528
3529 The version is used by QStyleOption subclasses to implement
3530 extensions without breaking compatibility. If you use
3531 qstyleoption_cast(), you normally do not need to check it.
3532
3533 \sa StyleOptionType
3534*/
3535
3536/*!
3537 \variable QStyleOptionTabBarBase::shape
3538 \brief the shape of the tab bar
3539
3540 The default value is QTabBar::RoundedNorth.
3541*/
3542
3543/*!
3544 \variable QStyleOptionTabBarBase::tabBarRect
3545 \brief the rectangle containing all the tabs
3546
3547 The default value is a null rectangle, i.e. a rectangle with both
3548 the width and the height set to 0.
3549*/
3550
3551/*!
3552 \variable QStyleOptionTabBarBase::selectedTabRect
3553 \brief the rectangle containing the selected tab
3554
3555 This rectangle is contained within the tabBarRect. The default
3556 value is a null rectangle, i.e. a rectangle with both the width
3557 and the height set to 0.
3558*/
3559
3560
3561/*!
3562 \variable QStyleOptionTabBarBase::documentMode
3563 \brief whether the tabbar is in document mode.
3564
3565 The default value is false;
3566*/
3567
3568#endif // QT_CONFIG(tabbar)
3569
3570#if QT_CONFIG(sizegrip)
3571/*!
3572 \class QStyleOptionSizeGrip
3573 \brief The QStyleOptionSizeGrip class is used to describe the
3574 parameter for drawing a size grip.
3575 \since 4.2
3576 \inmodule QtWidgets
3577
3578 QStyleOptionButton contains all the information that QStyle
3579 functions need to draw QSizeGrip.
3580
3581 For performance reasons, the access to the member variables is
3582 direct (i.e., using the \c . or \c -> operator). This low-level feel
3583 makes the structures straightforward to use and emphasizes that
3584 these are simply parameters used by the style functions.
3585
3586 For an example demonstrating how style options can be used, see
3587 the \l {widgets/styles}{Styles} example.
3588
3589 \sa QStyleOption, QStyleOptionComplex, QSizeGrip
3590*/
3591
3592/*!
3593 Constructs a QStyleOptionSizeGrip.
3594*/
3595QStyleOptionSizeGrip::QStyleOptionSizeGrip()
3596 : QStyleOptionComplex(Version, Type), corner(Qt::BottomRightCorner)
3597{
3598}
3599
3600/*!
3601 \fn QStyleOptionSizeGrip::QStyleOptionSizeGrip(const QStyleOptionSizeGrip &other)
3602
3603 Constructs a copy of the \a other style option.
3604*/
3605
3606/*!
3607 \internal
3608*/
3609QStyleOptionSizeGrip::QStyleOptionSizeGrip(int version)
3610 : QStyleOptionComplex(version, Type), corner(Qt::BottomRightCorner)
3611{
3612}
3613
3614/*!
3615 \variable QStyleOptionSizeGrip::corner
3616
3617 The corner in which the size grip is located.
3618*/
3619
3620/*!
3621 \enum QStyleOptionSizeGrip::StyleOptionType
3622
3623 This enum is used to hold information about the type of the style option, and
3624 is defined for each QStyleOption subclass.
3625
3626 \value Type The type of style option provided (\l{SO_TabBarBase} for this class).
3627
3628 The type is used internally by QStyleOption, its subclasses, and
3629 qstyleoption_cast() to determine the type of style option. In
3630 general you do not need to worry about this unless you want to
3631 create your own QStyleOption subclass and your own styles.
3632
3633 \sa StyleOptionVersion
3634*/
3635
3636/*!
3637 \enum QStyleOptionSizeGrip::StyleOptionVersion
3638
3639 This enum is used to hold information about the version of the style option, and
3640 is defined for each QStyleOption subclass.
3641
3642 \value Version 1
3643
3644 The version is used by QStyleOption subclasses to implement
3645 extensions without breaking compatibility. If you use
3646 qstyleoption_cast(), you normally do not need to check it.
3647
3648 \sa StyleOptionType
3649*/
3650#endif // QT_CONFIG(sizegrip)
3651
3652/*!
3653 \class QStyleOptionGraphicsItem
3654 \brief The QStyleOptionGraphicsItem class is used to describe
3655 the parameters needed to draw a QGraphicsItem.
3656 \since 4.2
3657 \ingroup graphicsview-api
3658 \inmodule QtWidgets
3659
3660 For performance reasons, the access to the member variables is
3661 direct (i.e., using the \c . or \c -> operator). This low-level feel
3662 makes the structures straightforward to use and emphasizes that
3663 these are simply parameters.
3664
3665 For an example demonstrating how style options can be used, see
3666 the \l {widgets/styles}{Styles} example.
3667
3668 \sa QStyleOption, QGraphicsItem::paint()
3669*/
3670
3671/*!
3672 \enum QStyleOptionGraphicsItem::StyleOptionType
3673
3674 This enum is used to hold information about the type of the style option, and
3675 is defined for each QStyleOption subclass.
3676
3677 \value Type The type of style option provided (\l SO_GraphicsItem for this class).
3678
3679 The type is used internally by QStyleOption, its subclasses, and
3680 qstyleoption_cast() to determine the type of style option. In
3681 general you do not need to worry about this unless you want to
3682 create your own QStyleOption subclass and your own styles.
3683
3684 \sa StyleOptionVersion
3685*/
3686
3687/*!
3688 \enum QStyleOptionGraphicsItem::StyleOptionVersion
3689
3690 This enum is used to hold information about the version of the style option, and
3691 is defined for each QStyleOption subclass.
3692
3693 \value Version 1
3694
3695 The version is used by QStyleOption subclasses to implement
3696 extensions without breaking compatibility. If you use
3697 qstyleoption_cast(), you normally do not need to check it.
3698
3699 \sa StyleOptionType
3700*/
3701
3702/*!
3703 Constructs a QStyleOptionGraphicsItem.
3704*/
3705QStyleOptionGraphicsItem::QStyleOptionGraphicsItem()
3706 : QStyleOption(Version, Type), levelOfDetail(1)
3707{
3708}
3709
3710/*!
3711 \internal
3712*/
3713QStyleOptionGraphicsItem::QStyleOptionGraphicsItem(int version)
3714 : QStyleOption(version, Type), levelOfDetail(1)
3715{
3716}
3717
3718/*!
3719 \since 4.6
3720
3721 Returns the level of detail from the \a worldTransform.
3722
3723 Its value represents the maximum value of the height and
3724 width of a unity rectangle, mapped using the \a worldTransform
3725 of the painter used to draw the item. By default, if no
3726 transformations are applied, its value is 1. If zoomed out 1:2, the level
3727 of detail will be 0.5, and if zoomed in 2:1, its value is 2.
3728
3729 \sa QGraphicsScene::minimumRenderSize()
3730*/
3731qreal QStyleOptionGraphicsItem::levelOfDetailFromTransform(const QTransform &worldTransform)
3732{
3733 if (worldTransform.type() <= QTransform::TxTranslate)
3734 return 1; // Translation only? The LOD is 1.
3735
3736 // Two unit vectors.
3737 QLineF v1(0, 0, 1, 0);
3738 QLineF v2(0, 0, 0, 1);
3739 // LOD is the transformed area of a 1x1 rectangle.
3740 return qSqrt(v: worldTransform.map(l: v1).length() * worldTransform.map(l: v2).length());
3741}
3742
3743/*!
3744 \fn QStyleOptionGraphicsItem::QStyleOptionGraphicsItem(const QStyleOptionGraphicsItem &other)
3745
3746 Constructs a copy of \a other.
3747*/
3748
3749/*!
3750 \variable QStyleOptionGraphicsItem::exposedRect
3751 \brief the exposed rectangle, in item coordinates
3752
3753 Make use of this rectangle to speed up item drawing when only parts of the
3754 item are exposed. If the whole item is exposed, this rectangle will be the
3755 same as QGraphicsItem::boundingRect().
3756
3757 This member is only initialized for items that have the
3758 QGraphicsItem::ItemUsesExtendedStyleOption flag set.
3759*/
3760
3761/*!
3762 \variable QStyleOptionGraphicsItem::matrix
3763 \brief the complete transformation matrix for the item
3764 \obsolete
3765
3766 The QMatrix provided through this member does include information about
3767 any perspective transformations applied to the view or item. To get the
3768 correct transformation matrix, use QPainter::transform() on the painter
3769 passed into the QGraphicsItem::paint() implementation.
3770
3771 This matrix is the combination of the item's scene matrix and the matrix
3772 of the painter used for drawing the item. It is provided for convenience,
3773 allowing anvanced level-of-detail metrics that can be used to speed up
3774 item drawing.
3775
3776 To find the dimensions of an item in screen coordinates (i.e., pixels),
3777 you can use the mapping functions of QMatrix, such as QMatrix::map().
3778
3779 This member is only initialized for items that have the
3780 QGraphicsItem::ItemUsesExtendedStyleOption flag set.
3781
3782 \sa QStyleOptionGraphicsItem::levelOfDetailFromTransform()
3783*/
3784
3785/*!
3786 \variable QStyleOptionGraphicsItem::levelOfDetail
3787 \obsolete
3788
3789 Use QStyleOptionGraphicsItem::levelOfDetailFromTransform()
3790 together with QPainter::worldTransform() instead.
3791*/
3792
3793/*!
3794 \class QStyleHintReturn
3795 \brief The QStyleHintReturn class provides style hints that return more
3796 than basic data types.
3797
3798 \ingroup appearance
3799 \inmodule QtWidgets
3800
3801 QStyleHintReturn and its subclasses are used to pass information
3802 from a style back to the querying widget. This is most useful
3803 when the return value from QStyle::styleHint() does not provide enough
3804 detail; for example, when a mask is to be returned.
3805
3806 \omit
3807 ### --Sam
3808 \endomit
3809*/
3810
3811/*!
3812 \enum QStyleHintReturn::HintReturnType
3813
3814 \value SH_Default QStyleHintReturn
3815 \value SH_Mask \l QStyle::SH_RubberBand_Mask QStyle::SH_FocusFrame_Mask
3816 \value SH_Variant \l QStyle::SH_TextControl_FocusIndicatorTextCharFormat
3817*/
3818
3819/*!
3820 \enum QStyleHintReturn::StyleOptionType
3821
3822 This enum is used to hold information about the type of the style option, and
3823 is defined for each QStyleHintReturn subclass.
3824
3825 \value Type The type of style option provided (\l SH_Default for
3826 this class).
3827
3828 The type is used internally by QStyleHintReturn, its subclasses, and
3829 qstyleoption_cast() to determine the type of style option. In
3830 general you do not need to worry about this unless you want to
3831 create your own QStyleHintReturn subclass and your own styles.
3832
3833 \sa StyleOptionVersion
3834*/
3835
3836/*!
3837 \enum QStyleHintReturn::StyleOptionVersion
3838
3839 This enum is used to hold information about the version of the style option, and
3840 is defined for each QStyleHintReturn subclass.
3841
3842 \value Version 1
3843
3844 The version is used by QStyleHintReturn subclasses to implement
3845 extensions without breaking compatibility. If you use
3846 qstyleoption_cast(), you normally do not need to check it.
3847
3848 \sa StyleOptionType
3849*/
3850
3851/*!
3852 \variable QStyleHintReturn::type
3853 \brief the type of the style hint container
3854
3855 \sa HintReturnType
3856*/
3857
3858/*!
3859 \variable QStyleHintReturn::version
3860 \brief the version of the style hint return container
3861
3862 This value can be used by subclasses to implement extensions
3863 without breaking compatibility. If you use qstyleoption_cast<T>(), you
3864 normally do not need to check it.
3865*/
3866
3867/*!
3868 Constructs a QStyleHintReturn with version \a version and type \a
3869 type.
3870
3871 The version has no special meaning for QStyleHintReturn; it can be
3872 used by subclasses to distinguish between different version of
3873 the same hint type.
3874
3875 \sa QStyleOption::version, QStyleOption::type
3876*/
3877
3878QStyleHintReturn::QStyleHintReturn(int version, int type)
3879 : version(version), type(type)
3880{
3881}
3882
3883/*!
3884 \internal
3885*/
3886
3887QStyleHintReturn::~QStyleHintReturn()
3888{
3889
3890}
3891
3892/*!
3893 \class QStyleHintReturnMask
3894 \brief The QStyleHintReturnMask class provides style hints that return a QRegion.
3895
3896 \ingroup appearance
3897 \inmodule QtWidgets
3898
3899 \omit
3900 ### --Sam
3901 \endomit
3902*/
3903
3904/*!
3905 \variable QStyleHintReturnMask::region
3906 \brief the region for style hints that return a QRegion
3907*/
3908
3909/*!
3910 Constructs a QStyleHintReturnMask. The member variables are
3911 initialized to default values.
3912*/
3913QStyleHintReturnMask::QStyleHintReturnMask() : QStyleHintReturn(Version, Type)
3914{
3915}
3916
3917/*!
3918 Destructor.
3919*/
3920QStyleHintReturnMask::~QStyleHintReturnMask()
3921{
3922}
3923
3924/*!
3925 \enum QStyleHintReturnMask::StyleOptionType
3926
3927 This enum is used to hold information about the type of the style option, and
3928 is defined for each QStyleHintReturn subclass.
3929
3930 \value Type The type of style option provided (\l{SH_Mask} for
3931 this class).
3932
3933 The type is used internally by QStyleHintReturn, its subclasses, and
3934 qstyleoption_cast() to determine the type of style option. In
3935 general you do not need to worry about this unless you want to
3936 create your own QStyleHintReturn subclass and your own styles.
3937
3938 \sa StyleOptionVersion
3939*/
3940
3941/*!
3942 \enum QStyleHintReturnMask::StyleOptionVersion
3943
3944 This enum is used to hold information about the version of the style option, and
3945 is defined for each QStyleHintReturn subclass.
3946
3947 \value Version 1
3948
3949 The version is used by QStyleHintReturn subclasses to implement
3950 extensions without breaking compatibility. If you use
3951 qstyleoption_cast(), you normally do not need to check it.
3952
3953 \sa StyleOptionType
3954*/
3955
3956/*!
3957 \class QStyleHintReturnVariant
3958 \brief The QStyleHintReturnVariant class provides style hints that return a QVariant.
3959 \since 4.3
3960 \ingroup appearance
3961 \inmodule QtWidgets
3962*/
3963
3964/*!
3965 \variable QStyleHintReturnVariant::variant
3966 \brief the variant for style hints that return a QVariant
3967*/
3968
3969/*!
3970 Constructs a QStyleHintReturnVariant. The member variables are
3971 initialized to default values.
3972*/
3973QStyleHintReturnVariant::QStyleHintReturnVariant() : QStyleHintReturn(Version, Type)
3974{
3975}
3976
3977/*!
3978 Destructor.
3979*/
3980QStyleHintReturnVariant::~QStyleHintReturnVariant()
3981{
3982}
3983
3984/*!
3985 \enum QStyleHintReturnVariant::StyleOptionType
3986
3987 This enum is used to hold information about the type of the style option, and
3988 is defined for each QStyleHintReturn subclass.
3989
3990 \value Type The type of style option provided (\l{SH_Variant} for
3991 this class).
3992
3993 The type is used internally by QStyleHintReturn, its subclasses, and
3994 qstyleoption_cast() to determine the type of style option. In
3995 general you do not need to worry about this unless you want to
3996 create your own QStyleHintReturn subclass and your own styles.
3997
3998 \sa StyleOptionVersion
3999*/
4000
4001/*!
4002 \enum QStyleHintReturnVariant::StyleOptionVersion
4003
4004 This enum is used to hold information about the version of the style option, and
4005 is defined for each QStyleHintReturn subclass.
4006
4007 \value Version 1
4008
4009 The version is used by QStyleHintReturn subclasses to implement
4010 extensions without breaking compatibility. If you use
4011 qstyleoption_cast(), you normally do not need to check it.
4012
4013 \sa StyleOptionType
4014*/
4015
4016/*!
4017 \fn template <typename T> T qstyleoption_cast<T>(const QStyleHintReturn *hint)
4018 \relates QStyleHintReturn
4019
4020 Returns a T or \nullptr depending on the \l{QStyleHintReturn::type}{type}
4021 and \l{QStyleHintReturn::version}{version} of \a hint.
4022
4023 Example:
4024
4025 \snippet code/src_gui_styles_qstyleoption.cpp 0
4026
4027 \sa QStyleHintReturn::type, QStyleHintReturn::version
4028*/
4029
4030/*!
4031 \fn template <typename T> T qstyleoption_cast<T>(QStyleHintReturn *hint)
4032 \overload
4033 \relates QStyleHintReturn
4034
4035 Returns a T or \nullptr depending on the type of \a hint.
4036*/
4037
4038#if !defined(QT_NO_DEBUG_STREAM)
4039QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType)
4040{
4041#if !defined(QT_NO_DEBUG)
4042 switch (optionType) {
4043 case QStyleOption::SO_Default:
4044 debug << "SO_Default"; break;
4045 case QStyleOption::SO_FocusRect:
4046 debug << "SO_FocusRect"; break;
4047 case QStyleOption::SO_Button:
4048 debug << "SO_Button"; break;
4049 case QStyleOption::SO_Tab:
4050 debug << "SO_Tab"; break;
4051 case QStyleOption::SO_MenuItem:
4052 debug << "SO_MenuItem"; break;
4053 case QStyleOption::SO_Frame:
4054 debug << "SO_Frame"; break;
4055 case QStyleOption::SO_ProgressBar:
4056 debug << "SO_ProgressBar"; break;
4057 case QStyleOption::SO_ToolBox:
4058 debug << "SO_ToolBox"; break;
4059 case QStyleOption::SO_Header:
4060 debug << "SO_Header"; break;
4061 case QStyleOption::SO_DockWidget:
4062 debug << "SO_DockWidget"; break;
4063 case QStyleOption::SO_ViewItem:
4064 debug << "SO_ViewItem"; break;
4065 case QStyleOption::SO_TabWidgetFrame:
4066 debug << "SO_TabWidgetFrame"; break;
4067 case QStyleOption::SO_TabBarBase:
4068 debug << "SO_TabBarBase"; break;
4069 case QStyleOption::SO_RubberBand:
4070 debug << "SO_RubberBand"; break;
4071 case QStyleOption::SO_Complex:
4072 debug << "SO_Complex"; break;
4073 case QStyleOption::SO_Slider:
4074 debug << "SO_Slider"; break;
4075 case QStyleOption::SO_SpinBox:
4076 debug << "SO_SpinBox"; break;
4077 case QStyleOption::SO_ToolButton:
4078 debug << "SO_ToolButton"; break;
4079 case QStyleOption::SO_ComboBox:
4080 debug << "SO_ComboBox"; break;
4081 case QStyleOption::SO_TitleBar:
4082 debug << "SO_TitleBar"; break;
4083 case QStyleOption::SO_CustomBase:
4084 debug << "SO_CustomBase"; break;
4085 case QStyleOption::SO_GroupBox:
4086 debug << "SO_GroupBox"; break;
4087 case QStyleOption::SO_ToolBar:
4088 debug << "SO_ToolBar"; break;
4089 case QStyleOption::SO_ComplexCustomBase:
4090 debug << "SO_ComplexCustomBase"; break;
4091 case QStyleOption::SO_SizeGrip:
4092 debug << "SO_SizeGrip"; break;
4093 case QStyleOption::SO_GraphicsItem:
4094 debug << "SO_GraphicsItem"; break;
4095 }
4096#else
4097 Q_UNUSED(optionType);
4098#endif
4099 return debug;
4100}
4101
4102QDebug operator<<(QDebug debug, const QStyleOption &option)
4103{
4104#if !defined(QT_NO_DEBUG)
4105 debug << "QStyleOption(";
4106 debug << QStyleOption::OptionType(option.type);
4107 debug << ',' << (option.direction == Qt::RightToLeft ? "RightToLeft" : "LeftToRight");
4108 debug << ',' << option.state;
4109 debug << ',' << option.rect;
4110 debug << ',' << option.styleObject;
4111 debug << ')';
4112#else
4113 Q_UNUSED(option);
4114#endif
4115 return debug;
4116}
4117#endif
4118
4119QT_END_NAMESPACE
4120

source code of qtbase/src/widgets/styles/qstyleoption.cpp