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

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