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 \value [since 6.9] MinimumSizeHint The tab button's minimum size hint is being measured,
1405 in contrast to its regular size hint.
1406
1407 \sa QStyleOptionToolBar::features
1408*/
1409
1410/*!
1411 \variable QStyleOptionTab::leftButtonSize
1412 \brief the size for the left widget on the tab.
1413
1414 The default value is QSize(-1, -1), i.e. an invalid size;
1415*/
1416
1417/*!
1418 \variable QStyleOptionTab::rightButtonSize
1419 \brief the size for the right widget on the tab.
1420
1421 The default value is QSize(-1, -1), i.e. an invalid size;
1422*/
1423
1424/*!
1425 \variable QStyleOptionTab::tabIndex
1426 \brief the index for the tab being represented.
1427
1428 The default value is -1, i.e. a tab not on a tabbar;
1429 */
1430
1431#endif // QT_CONFIG(tabbar)
1432
1433/*!
1434 \class QStyleOptionProgressBar
1435 \brief The QStyleOptionProgressBar class is used to describe the
1436 parameters necessary for drawing a progress bar.
1437
1438 \inmodule QtWidgets
1439
1440 An instance of the QStyleOptionProgressBar class has type
1441 SO_ProgressBar and version 2.
1442
1443 The type is used internally by QStyleOption, its subclasses, and
1444 qstyleoption_cast() to determine the type of style option. In
1445 general you do not need to worry about this unless you want to
1446 create your own QStyleOption subclass and your own styles. The
1447 version is used by QStyleOption subclasses to implement extensions
1448 without breaking compatibility. If you use qstyleoption_cast(),
1449 you normally do not need to check it.
1450
1451 For performance reasons, there are few member functions and the
1452 access to the member variables is direct (i.e., using the \c . or
1453 \c -> operator). This makes the structures straightforward to use
1454 and emphasizes that these are simply parameters used by the style
1455 functions.
1456
1457 \sa QStyleOption
1458*/
1459
1460/*!
1461 Constructs a QStyleOptionProgressBar, initializing the members
1462 variables to their default values.
1463*/
1464
1465QStyleOptionProgressBar::QStyleOptionProgressBar()
1466 : QStyleOptionProgressBar(QStyleOptionProgressBar::Version)
1467{
1468}
1469
1470/*!
1471 \internal
1472*/
1473QStyleOptionProgressBar::QStyleOptionProgressBar(int version)
1474 : QStyleOption(version, SO_ProgressBar),
1475 minimum(0), maximum(0), progress(0), textAlignment(Qt::AlignLeft), textVisible(false),
1476 invertedAppearance(false), bottomToTop(false)
1477{
1478 state |= QStyle::State_Horizontal;
1479}
1480
1481/*!
1482 \fn QStyleOptionProgressBar::QStyleOptionProgressBar(const QStyleOptionProgressBar &other)
1483
1484 Constructs a copy of the \a other style option.
1485*/
1486
1487/*!
1488 \enum QStyleOptionProgressBar::StyleOptionType
1489
1490 This enum is used to hold information about the type of the style option, and
1491 is defined for each QStyleOption subclass.
1492
1493 \value Type The type of style option provided (\l{SO_ProgressBar} for this class).
1494
1495 The type is used internally by QStyleOption, its subclasses, and
1496 qstyleoption_cast() to determine the type of style option. In
1497 general you do not need to worry about this unless you want to
1498 create your own QStyleOption subclass and your own styles.
1499
1500 \sa StyleOptionVersion
1501*/
1502
1503/*!
1504 \enum QStyleOptionProgressBar::StyleOptionVersion
1505
1506 This enum is used to hold information about the version of the style option, and
1507 is defined for each QStyleOption subclass.
1508
1509 \value Version 2
1510
1511 The version is used by QStyleOption subclasses to implement
1512 extensions without breaking compatibility. If you use
1513 qstyleoption_cast(), you normally do not need to check it.
1514
1515 \sa StyleOptionType
1516*/
1517
1518/*!
1519 \variable QStyleOptionProgressBar::minimum
1520 \brief the minimum value for the progress bar
1521
1522 This is the minimum value in the progress bar. The default value
1523 is 0.
1524
1525 \sa QProgressBar::minimum
1526*/
1527
1528/*!
1529 \variable QStyleOptionProgressBar::maximum
1530 \brief the maximum value for the progress bar
1531
1532 This is the maximum value in the progress bar. The default value
1533 is 0.
1534
1535 \sa QProgressBar::maximum
1536*/
1537
1538/*!
1539 \variable QStyleOptionProgressBar::text
1540 \brief the text for the progress bar
1541
1542 The progress bar text is usually just the progress expressed as a
1543 string. An empty string indicates that the progress bar has not
1544 started yet. The default value is an empty string.
1545
1546 \sa QProgressBar::text
1547*/
1548
1549/*!
1550 \variable QStyleOptionProgressBar::textVisible
1551 \brief a flag indicating whether or not text is visible
1552
1553 If this flag is true then the text is visible. Otherwise, the text
1554 is not visible. The default value is false.
1555
1556 \sa QProgressBar::textVisible
1557*/
1558
1559
1560/*!
1561 \variable QStyleOptionProgressBar::textAlignment
1562 \brief the text alignment for the text in the QProgressBar.
1563
1564 This can be used as a guide on where the text should be in the
1565 progress bar. The default value is Qt::AlignLeft.
1566*/
1567
1568/*!
1569 \variable QStyleOptionProgressBar::progress
1570 \brief the current progress for the progress bar
1571
1572 The current progress. A value of QStyleOptionProgressBar::minimum
1573 - 1 indicates that the progress hasn't started yet. The default
1574 value is 0.
1575
1576 \sa QProgressBar::value
1577*/
1578
1579/*!
1580 \variable QStyleOptionProgressBar::invertedAppearance
1581 \brief whether the progress bar's appearance is inverted
1582
1583 The default value is false.
1584
1585 \sa QProgressBar::invertedAppearance
1586*/
1587
1588/*!
1589 \variable QStyleOptionProgressBar::bottomToTop
1590 \brief whether the text reads from bottom to top when the progress
1591 bar is vertical
1592
1593 The default value is false.
1594
1595 \sa QProgressBar::textDirection
1596*/
1597
1598/*!
1599 \class QStyleOptionMenuItem
1600 \brief The QStyleOptionMenuItem class is used to describe the
1601 parameter necessary for drawing a menu item.
1602
1603 \inmodule QtWidgets
1604
1605 QStyleOptionMenuItem contains all the information that QStyle
1606 functions need to draw the menu items from \l QMenu. It is also
1607 used for drawing other menu-related widgets.
1608
1609 For performance reasons, there are few member functions and the
1610 access to the member variables is direct (i.e., using the \c . or
1611 \c -> operator). This makes the structures straightforward to use
1612 and emphasizes that these are simply parameters used by the style
1613 functions.
1614
1615 \sa QStyleOption
1616*/
1617
1618/*!
1619 Constructs a QStyleOptionMenuItem, initializing the members
1620 variables to their default values.
1621*/
1622
1623QStyleOptionMenuItem::QStyleOptionMenuItem()
1624 : QStyleOptionMenuItem(QStyleOptionMenuItem::Version)
1625{
1626}
1627
1628/*!
1629 \internal
1630*/
1631QStyleOptionMenuItem::QStyleOptionMenuItem(int version)
1632 : QStyleOption(version, SO_MenuItem), menuItemType(Normal),
1633 checkType(NotCheckable), checked(false), menuHasCheckableItems(true), maxIconWidth(0),
1634 reservedShortcutWidth(0)
1635{
1636}
1637
1638/*!
1639 \fn QStyleOptionMenuItem::QStyleOptionMenuItem(const QStyleOptionMenuItem &other)
1640
1641 Constructs a copy of the \a other style option.
1642*/
1643
1644/*!
1645 \enum QStyleOptionMenuItem::StyleOptionType
1646
1647 This enum is used to hold information about the type of the style option, and
1648 is defined for each QStyleOption subclass.
1649
1650 \value Type The type of style option provided (\l{SO_MenuItem} for this class).
1651
1652 The type is used internally by QStyleOption, its subclasses, and
1653 qstyleoption_cast() to determine the type of style option. In
1654 general you do not need to worry about this unless you want to
1655 create your own QStyleOption subclass and your own styles.
1656
1657 \sa StyleOptionVersion
1658*/
1659
1660/*!
1661 \enum QStyleOptionMenuItem::StyleOptionVersion
1662
1663 This enum is used to hold information about the version of the style option, and
1664 is defined for each QStyleOption subclass.
1665
1666 \value Version 1
1667
1668 The version is used by QStyleOption subclasses to implement
1669 extensions without breaking compatibility. If you use
1670 qstyleoption_cast(), you normally do not need to check it.
1671
1672 \sa StyleOptionType
1673*/
1674
1675/*!
1676 \enum QStyleOptionMenuItem::MenuItemType
1677
1678 This enum indicates the type of menu item that the structure describes.
1679
1680 \value Normal A normal menu item.
1681 \value DefaultItem A menu item that is the default action as specified with \l QMenu::defaultAction().
1682 \value Separator A menu separator.
1683 \value SubMenu Indicates the menu item points to a sub-menu.
1684 \value Scroller A popup menu scroller (currently only used on \macos).
1685 \value TearOff A tear-off handle for the menu.
1686 \value Margin The margin of the menu.
1687 \value EmptyArea The empty area of the menu.
1688
1689 \sa menuItemType
1690*/
1691
1692/*!
1693 \enum QStyleOptionMenuItem::CheckType
1694
1695 This enum is used to indicate whether or not a check mark should be
1696 drawn for the item, or even if it should be drawn at all.
1697
1698 \value NotCheckable The item is not checkable.
1699 \value Exclusive The item is an exclusive check item (like a radio button).
1700 \value NonExclusive The item is a non-exclusive check item (like a check box).
1701
1702 \sa checkType, QAction::checkable, QAction::checked, QActionGroup::exclusionPolicy
1703*/
1704
1705/*!
1706 \variable QStyleOptionMenuItem::menuItemType
1707 \brief the type of menu item
1708
1709 The default value is \l Normal.
1710
1711 \sa MenuItemType
1712*/
1713
1714/*!
1715 \variable QStyleOptionMenuItem::checkType
1716 \brief the type of checkmark of the menu item
1717
1718 The default value is \l NotCheckable.
1719
1720 \sa CheckType
1721*/
1722
1723/*!
1724 \variable QStyleOptionMenuItem::checked
1725 \brief whether the menu item is checked or not
1726
1727 The default value is false.
1728*/
1729
1730/*!
1731 \variable QStyleOptionMenuItem::menuHasCheckableItems
1732 \brief whether the menu as a whole has checkable items or not
1733
1734 The default value is true.
1735
1736 If this option is set to false, then the menu has no checkable
1737 items. This makes it possible for GUI styles to save some
1738 horizontal space that would normally be used for the check column.
1739*/
1740
1741/*!
1742 \variable QStyleOptionMenuItem::menuRect
1743 \brief the rectangle for the entire menu
1744
1745 The default value is a null rectangle, i.e. a rectangle with both
1746 the width and the height set to 0.
1747*/
1748
1749/*!
1750 \variable QStyleOptionMenuItem::text
1751 \brief the text for the menu item
1752
1753 Note that the text format is something like this "Menu
1754 text\b{\\t}Shortcut".
1755
1756 If the menu item doesn't have a shortcut, it will just contain the
1757 menu item's text. The default value is an empty string.
1758*/
1759
1760/*!
1761 \variable QStyleOptionMenuItem::icon
1762 \brief the icon for the menu item
1763
1764 The default value is an empty icon, i.e. an icon with neither a
1765 pixmap nor a filename.
1766*/
1767
1768/*!
1769 \variable QStyleOptionMenuItem::maxIconWidth
1770 \brief the maximum icon width for the icon in the menu item
1771
1772 This can be used for drawing the icon into the correct place or
1773 properly aligning items. The variable must be set regardless of
1774 whether or not the menu item has an icon. The default value is 0.
1775*/
1776
1777/*!
1778 \variable QStyleOptionMenuItem::reservedShortcutWidth
1779 \brief the reserved width for the menu item's shortcut
1780
1781 QMenu sets it to the width occupied by the widest shortcut among
1782 all visible items within the menu.
1783
1784 The default value is 0.
1785*/
1786
1787
1788/*!
1789 \variable QStyleOptionMenuItem::font
1790 \brief the font used for the menu item text
1791
1792 This is the font that should be used for drawing the menu text
1793 minus the shortcut. The shortcut is usually drawn using the
1794 painter's font. By default, the application's default font is
1795 used.
1796*/
1797
1798/*!
1799 \class QStyleOptionComplex
1800 \brief The QStyleOptionComplex class is used to hold parameters that are
1801 common to all complex controls.
1802
1803 \inmodule QtWidgets
1804
1805 This class is not used on its own. Instead it is used to derive
1806 other complex control options, for example QStyleOptionSlider and
1807 QStyleOptionSpinBox.
1808
1809 For performance reasons, there are few member functions and the
1810 access to the member variables is direct (i.e., using the \c . or
1811 \c -> operator). This makes the structures straightforward to use
1812 and emphasizes that these are simply parameters used by the style
1813 functions.
1814
1815 \sa QStyleOption
1816*/
1817
1818/*!
1819 Constructs a QStyleOptionComplex of the specified \a type and \a
1820 version, initializing the member variables to their default
1821 values. This constructor is usually called by subclasses.
1822*/
1823
1824QStyleOptionComplex::QStyleOptionComplex(int version, int type)
1825 : QStyleOption(version, type), subControls(QStyle::SC_All), activeSubControls(QStyle::SC_None)
1826{
1827}
1828
1829/*!
1830 \fn QStyleOptionComplex::QStyleOptionComplex(const QStyleOptionComplex &other)
1831
1832 Constructs a copy of the \a other style option.
1833*/
1834
1835/*!
1836 \enum QStyleOptionComplex::StyleOptionType
1837
1838 This enum is used to hold information about the type of the style option, and
1839 is defined for each QStyleOption subclass.
1840
1841 \value Type The type of style option provided (\l{SO_Complex} for this class).
1842
1843 The type is used internally by QStyleOption, its subclasses, and
1844 qstyleoption_cast() to determine the type of style option. In
1845 general you do not need to worry about this unless you want to
1846 create your own QStyleOption subclass and your own styles.
1847
1848 \sa StyleOptionVersion
1849*/
1850
1851/*!
1852 \enum QStyleOptionComplex::StyleOptionVersion
1853
1854 This enum is used to hold information about the version of the style option, and
1855 is defined for each QStyleOption subclass.
1856
1857 \value Version 1
1858
1859 The version is used by QStyleOption subclasses to implement
1860 extensions without breaking compatibility. If you use
1861 qstyleoption_cast(), you normally do not need to check it.
1862
1863 \sa StyleOptionType
1864*/
1865
1866/*!
1867 \variable QStyleOptionComplex::subControls
1868
1869 This variable holds a bitwise OR of the \l{QStyle::SubControl}
1870 {sub-controls} to be drawn for the complex control.
1871
1872 The default value is QStyle::SC_All.
1873
1874 \sa QStyle::SubControl
1875*/
1876
1877/*!
1878 \variable QStyleOptionComplex::activeSubControls
1879
1880 This variable holds a bitwise OR of the \l{QStyle::SubControl}
1881 {sub-controls} that are active for the complex control.
1882
1883 The default value is QStyle::SC_None.
1884
1885 \sa QStyle::SubControl
1886*/
1887
1888#if QT_CONFIG(slider)
1889/*!
1890 \class QStyleOptionSlider
1891 \brief The QStyleOptionSlider class is used to describe the
1892 parameters needed for drawing a slider.
1893
1894 \inmodule QtWidgets
1895
1896 QStyleOptionSlider contains all the information that QStyle
1897 functions need to draw QSlider and QScrollBar.
1898
1899 For performance reasons, there are few member functions and the
1900 access to the member variables is direct (i.e., using the \c . or
1901 \c -> operator). This makes the structures straightforward to use
1902 and emphasizes that these are simply parameters used by the style
1903 functions.
1904
1905 \sa QStyleOptionComplex, QSlider, QScrollBar
1906*/
1907
1908/*!
1909 Constructs a QStyleOptionSlider, initializing the members
1910 variables to their default values.
1911*/
1912
1913QStyleOptionSlider::QStyleOptionSlider()
1914 : QStyleOptionSlider(Version)
1915{
1916}
1917
1918/*!
1919 \internal
1920*/
1921QStyleOptionSlider::QStyleOptionSlider(int version)
1922 : QStyleOptionComplex(version, SO_Slider), orientation(Qt::Horizontal), minimum(0), maximum(0),
1923 tickPosition(QSlider::NoTicks), tickInterval(0), upsideDown(false),
1924 sliderPosition(0), sliderValue(0), singleStep(0), pageStep(0), notchTarget(0.0),
1925 dialWrapping(false), keyboardModifiers{}
1926{
1927}
1928
1929/*!
1930 \fn QStyleOptionSlider::QStyleOptionSlider(const QStyleOptionSlider &other)
1931
1932 Constructs a copy of the \a other style option.
1933*/
1934
1935/*!
1936 \enum QStyleOptionSlider::StyleOptionType
1937
1938 This enum is used to hold information about the type of the style option, and
1939 is defined for each QStyleOption subclass.
1940
1941 \value Type The type of style option provided (\l{SO_Slider} for this class).
1942
1943 The type is used internally by QStyleOption, its subclasses, and
1944 qstyleoption_cast() to determine the type of style option. In
1945 general you do not need to worry about this unless you want to
1946 create your own QStyleOption subclass and your own styles.
1947
1948 \sa StyleOptionVersion
1949*/
1950
1951/*!
1952 \enum QStyleOptionSlider::StyleOptionVersion
1953
1954 This enum is used to hold information about the version of the style option, and
1955 is defined for each QStyleOption subclass.
1956
1957 \value Version 1
1958
1959 The version is used by QStyleOption subclasses to implement
1960 extensions without breaking compatibility. If you use
1961 qstyleoption_cast(), you normally do not need to check it.
1962
1963 \sa StyleOptionType
1964*/
1965
1966/*!
1967 \variable QStyleOptionSlider::orientation
1968 \brief the slider's orientation (horizontal or vertical)
1969
1970 The default orientation is Qt::Horizontal.
1971
1972 \sa Qt::Orientation
1973*/
1974
1975/*!
1976 \variable QStyleOptionSlider::minimum
1977 \brief the minimum value for the slider
1978
1979 The default value is 0.
1980*/
1981
1982/*!
1983 \variable QStyleOptionSlider::maximum
1984 \brief the maximum value for the slider
1985
1986 The default value is 0.
1987*/
1988
1989/*!
1990 \variable QStyleOptionSlider::tickPosition
1991 \brief the position of the slider's tick marks, if any
1992
1993 The default value is QSlider::NoTicks.
1994
1995 \sa QSlider::TickPosition
1996*/
1997
1998/*!
1999 \variable QStyleOptionSlider::tickInterval
2000 \brief the interval that should be drawn between tick marks
2001
2002 The default value is 0.
2003*/
2004
2005/*!
2006 \variable QStyleOptionSlider::notchTarget
2007 \brief the number of pixel between notches
2008
2009 The default value is 0.0.
2010
2011 \sa QDial::notchTarget()
2012*/
2013
2014/*!
2015 \variable QStyleOptionSlider::dialWrapping
2016 \brief whether the dial should wrap or not
2017
2018 The default value is false, i.e. the dial is not wrapped.
2019
2020 \sa QDial::wrapping()
2021*/
2022
2023/*!
2024 \variable QStyleOptionSlider::upsideDown
2025 \brief the slider control orientation
2026
2027 Normally a slider increases as it moves up or to the right;
2028 upsideDown indicates that it should do the opposite (increase as
2029 it moves down or to the left). The default value is false,
2030 i.e. the slider increases as it moves up or to the right.
2031
2032 \sa QStyle::sliderPositionFromValue(),
2033 QStyle::sliderValueFromPosition(),
2034 QAbstractSlider::invertedAppearance
2035*/
2036
2037/*!
2038 \variable QStyleOptionSlider::sliderPosition
2039 \brief the position of the slider handle
2040
2041 If the slider has active feedback (i.e.,
2042 QAbstractSlider::tracking is true), this value will be the same as
2043 \l sliderValue. Otherwise, it will have the current position of
2044 the handle. The default value is 0.
2045
2046 \sa QAbstractSlider::tracking, sliderValue
2047*/
2048
2049/*!
2050 \variable QStyleOptionSlider::sliderValue
2051 \brief the value of the slider
2052
2053 If the slider has active feedback (i.e.,
2054 QAbstractSlider::tracking is true), this value will be the same
2055 as \l sliderPosition. Otherwise, it will have the value the
2056 slider had before the mouse was pressed.
2057
2058 The default value is 0.
2059
2060 \sa QAbstractSlider::tracking, sliderPosition
2061*/
2062
2063/*!
2064 \variable QStyleOptionSlider::singleStep
2065 \brief the size of the single step of the slider
2066
2067 The default value is 0.
2068
2069 \sa QAbstractSlider::singleStep
2070*/
2071
2072/*!
2073 \variable QStyleOptionSlider::pageStep
2074 \brief the size of the page step of the slider
2075
2076 The default value is 0.
2077
2078 \sa QAbstractSlider::pageStep
2079*/
2080#endif // QT_CONFIG(slider)
2081
2082#if QT_CONFIG(spinbox)
2083/*!
2084 \class QStyleOptionSpinBox
2085 \brief The QStyleOptionSpinBox class is used to describe the
2086 parameters necessary for drawing a spin box.
2087
2088 \inmodule QtWidgets
2089
2090 QStyleOptionSpinBox contains all the information that QStyle
2091 functions need to draw QSpinBox and QDateTimeEdit.
2092
2093 For performance reasons, there are few member functions and the
2094 access to the member variables is direct (i.e., using the \c . or
2095 \c -> operator). This makes the structures straightforward to use
2096 and emphasizes that these are simply parameters used by the style
2097 functions.
2098
2099 \sa QStyleOption, QStyleOptionComplex
2100*/
2101
2102/*!
2103 Constructs a QStyleOptionSpinBox, initializing the members
2104 variables to their default values.
2105*/
2106
2107QStyleOptionSpinBox::QStyleOptionSpinBox()
2108 : QStyleOptionSpinBox(Version)
2109{
2110}
2111
2112/*!
2113 \internal
2114*/
2115QStyleOptionSpinBox::QStyleOptionSpinBox(int version)
2116 : QStyleOptionComplex(version, SO_SpinBox), buttonSymbols(QAbstractSpinBox::UpDownArrows),
2117 stepEnabled(QAbstractSpinBox::StepNone), frame(false)
2118{
2119}
2120
2121/*!
2122 \fn QStyleOptionSpinBox::QStyleOptionSpinBox(const QStyleOptionSpinBox &other)
2123
2124 Constructs a copy of the \a other style option.
2125*/
2126
2127/*!
2128 \enum QStyleOptionSpinBox::StyleOptionType
2129
2130 This enum is used to hold information about the type of the style option, and
2131 is defined for each QStyleOption subclass.
2132
2133 \value Type The type of style option provided (\l{SO_SpinBox} for this class).
2134
2135 The type is used internally by QStyleOption, its subclasses, and
2136 qstyleoption_cast() to determine the type of style option. In
2137 general you do not need to worry about this unless you want to
2138 create your own QStyleOption subclass and your own styles.
2139
2140 \sa StyleOptionVersion
2141*/
2142
2143/*!
2144 \enum QStyleOptionSpinBox::StyleOptionVersion
2145
2146 This enum is used to hold information about the version of the style option, and
2147 is defined for each QStyleOption subclass.
2148
2149 \value Version 1
2150
2151 The version is used by QStyleOption subclasses to implement
2152 extensions without breaking compatibility. If you use
2153 qstyleoption_cast(), you normally do not need to check it.
2154
2155 \sa StyleOptionType
2156*/
2157
2158/*!
2159 \variable QStyleOptionSpinBox::buttonSymbols
2160 \brief the type of button symbols to draw for the spin box
2161
2162 The default value is QAbstractSpinBox::UpDownArrows specufying
2163 little arrows in the classic style.
2164
2165 \sa QAbstractSpinBox::ButtonSymbols
2166*/
2167
2168/*!
2169 \variable QStyleOptionSpinBox::stepEnabled
2170 \brief which buttons of the spin box that are enabled
2171
2172 The default value is QAbstractSpinBox::StepNone.
2173
2174 \sa QAbstractSpinBox::StepEnabled
2175*/
2176
2177/*!
2178 \variable QStyleOptionSpinBox::frame
2179 \brief whether the spin box has a frame
2180
2181 The default value is false, i.e. the spin box has no frame.
2182*/
2183#endif // QT_CONFIG(spinbox)
2184
2185/*!
2186 \class QStyleOptionDockWidget
2187 \brief The QStyleOptionDockWidget class is used to describe the
2188 parameters for drawing a dock widget.
2189
2190 \inmodule QtWidgets
2191
2192 QStyleOptionDockWidget contains all the information that QStyle
2193 functions need to draw graphical elements like QDockWidget.
2194
2195 For performance reasons, there are few member functions and the
2196 access to the member variables is direct (i.e., using the \c . or
2197 \c -> operator). This makes the structures straightforward to use
2198 and emphasizes that these are simply parameters used by the style
2199 functions.
2200
2201 \sa QStyleOption
2202*/
2203
2204/*!
2205 Constructs a QStyleOptionDockWidget, initializing the member
2206 variables to their default values.
2207*/
2208
2209QStyleOptionDockWidget::QStyleOptionDockWidget()
2210 : QStyleOptionDockWidget(Version)
2211{
2212}
2213
2214/*!
2215 \internal
2216*/
2217QStyleOptionDockWidget::QStyleOptionDockWidget(int version)
2218 : QStyleOption(version, SO_DockWidget), closable(false),
2219 movable(false), floatable(false), verticalTitleBar(false)
2220{
2221}
2222
2223/*!
2224 \fn QStyleOptionDockWidget::QStyleOptionDockWidget(const QStyleOptionDockWidget &other)
2225
2226 Constructs a copy of the \a other style option.
2227*/
2228
2229/*!
2230 \enum QStyleOptionDockWidget::StyleOptionType
2231
2232 This enum is used to hold information about the type of the style option, and
2233 is defined for each QStyleOption subclass.
2234
2235 \value Type The type of style option provided (\l{SO_DockWidget} for this class).
2236
2237 The type is used internally by QStyleOption, its subclasses, and
2238 qstyleoption_cast() to determine the type of style option. In
2239 general you do not need to worry about this unless you want to
2240 create your own QStyleOption subclass and your own styles.
2241
2242 \sa StyleOptionVersion
2243*/
2244
2245/*!
2246 \enum QStyleOptionDockWidget::StyleOptionVersion
2247
2248 This enum is used to hold information about the version of the style option, and
2249 is defined for each QStyleOption subclass.
2250
2251 \value Version 2
2252
2253 The version is used by QStyleOption subclasses to implement
2254 extensions without breaking compatibility. If you use
2255 qstyleoption_cast(), you normally do not need to check it.
2256
2257 \sa StyleOptionType
2258*/
2259
2260/*!
2261 \variable QStyleOptionDockWidget::title
2262 \brief the title of the dock window
2263
2264 The default value is an empty string.
2265*/
2266
2267/*!
2268 \variable QStyleOptionDockWidget::closable
2269 \brief whether the dock window is closable
2270
2271 The default value is true.
2272*/
2273
2274/*!
2275 \variable QStyleOptionDockWidget::movable
2276 \brief whether the dock window is movable
2277
2278 The default value is false.
2279*/
2280
2281/*!
2282 \variable QStyleOptionDockWidget::floatable
2283 \brief whether the dock window is floatable
2284
2285 The default value is true.
2286*/
2287
2288#if QT_CONFIG(toolbutton)
2289/*!
2290 \class QStyleOptionToolButton
2291 \brief The QStyleOptionToolButton class is used to describe the
2292 parameters for drawing a tool button.
2293
2294 \inmodule QtWidgets
2295
2296 QStyleOptionToolButton contains all the information that QStyle
2297 functions need to draw QToolButton.
2298
2299 For performance reasons, there are few member functions and the
2300 access to the member variables is direct (i.e., using the \c . or
2301 \c -> operator). This makes the structures straightforward to use
2302 and emphasizes that these are simply parameters used by the style
2303 functions.
2304
2305 \sa QStyleOption, QStyleOptionComplex, QStyleOptionButton
2306*/
2307
2308/*!
2309 \enum QStyleOptionToolButton::ToolButtonFeature
2310 Describes the various features that a tool button can have.
2311
2312 \value None A normal tool button.
2313 \value Arrow The tool button is an arrow.
2314 \value Menu The tool button has a menu.
2315 \value PopupDelay There is a delay to showing the menu.
2316 \value HasMenu The button has a popup menu.
2317 \value MenuButtonPopup The button should display an arrow to
2318 indicate that a menu is present.
2319
2320 \sa features, QToolButton::toolButtonStyle(), QToolButton::popupMode()
2321*/
2322
2323/*!
2324 Constructs a QStyleOptionToolButton, initializing the members
2325 variables to their default values.
2326*/
2327
2328QStyleOptionToolButton::QStyleOptionToolButton()
2329 : QStyleOptionToolButton(Version)
2330{
2331}
2332
2333/*!
2334 \internal
2335*/
2336QStyleOptionToolButton::QStyleOptionToolButton(int version)
2337 : QStyleOptionComplex(version, SO_ToolButton), features(None), arrowType(Qt::DownArrow)
2338 , toolButtonStyle(Qt::ToolButtonIconOnly)
2339
2340{
2341}
2342
2343/*!
2344 \fn QStyleOptionToolButton::QStyleOptionToolButton(const QStyleOptionToolButton &other)
2345
2346 Constructs a copy of the \a other style option.
2347*/
2348
2349/*!
2350 \enum QStyleOptionToolButton::StyleOptionType
2351
2352 This enum is used to hold information about the type of the style option, and
2353 is defined for each QStyleOption subclass.
2354
2355 \value Type The type of style option provided (\l{SO_ToolButton} for this class).
2356
2357 The type is used internally by QStyleOption, its subclasses, and
2358 qstyleoption_cast() to determine the type of style option. In
2359 general you do not need to worry about this unless you want to
2360 create your own QStyleOption subclass and your own styles.
2361
2362 \sa StyleOptionVersion
2363*/
2364
2365/*!
2366 \enum QStyleOptionToolButton::StyleOptionVersion
2367
2368 This enum is used to hold information about the version of the style option, and
2369 is defined for each QStyleOption subclass.
2370
2371 \value Version 1
2372
2373 The version is used by QStyleOption subclasses to implement
2374 extensions without breaking compatibility. If you use
2375 qstyleoption_cast(), you normally do not need to check it.
2376
2377 \sa StyleOptionType
2378*/
2379
2380/*!
2381 \variable QStyleOptionToolButton::features
2382 \brief an OR combination of the tool button's features
2383
2384 The default value is \l None.
2385
2386 \sa ToolButtonFeature
2387*/
2388
2389/*!
2390 \variable QStyleOptionToolButton::icon
2391 \brief the icon for the tool button
2392
2393 The default value is an empty icon, i.e. an icon with neither a
2394 pixmap nor a filename.
2395
2396 \sa iconSize
2397*/
2398
2399/*!
2400 \variable QStyleOptionToolButton::iconSize
2401 \brief the size of the icon for the tool button
2402
2403 The default value is QSize(-1, -1), i.e. an invalid size.
2404*/
2405
2406/*!
2407 \variable QStyleOptionToolButton::text
2408 \brief the text of the tool button
2409
2410 This value is only used if toolButtonStyle is
2411 Qt::ToolButtonTextUnderIcon, Qt::ToolButtonTextBesideIcon, or
2412 Qt::ToolButtonTextOnly. The default value is an empty string.
2413*/
2414
2415/*!
2416 \variable QStyleOptionToolButton::arrowType
2417 \brief the direction of the arrow for the tool button
2418
2419 This value is only used if \l features includes \l Arrow. The
2420 default value is Qt::DownArrow.
2421*/
2422
2423/*!
2424 \variable QStyleOptionToolButton::toolButtonStyle
2425 \brief a Qt::ToolButtonStyle value describing the appearance of
2426 the tool button
2427
2428 The default value is Qt::ToolButtonIconOnly.
2429
2430 \sa QToolButton::toolButtonStyle()
2431*/
2432
2433/*!
2434 \variable QStyleOptionToolButton::pos
2435 \brief the position of the tool button
2436
2437 The default value is a null point, i.e. (0, 0)
2438*/
2439
2440/*!
2441 \variable QStyleOptionToolButton::font
2442 \brief the font that is used for the text
2443
2444 This value is only used if toolButtonStyle is
2445 Qt::ToolButtonTextUnderIcon, Qt::ToolButtonTextBesideIcon, or
2446 Qt::ToolButtonTextOnly. By default, the application's default font
2447 is used.
2448*/
2449#endif // QT_CONFIG(toolbutton)
2450
2451/*!
2452 \class QStyleOptionComboBox
2453 \brief The QStyleOptionComboBox class is used to describe the
2454 parameter for drawing a combobox.
2455
2456 \inmodule QtWidgets
2457
2458 QStyleOptionButton contains all the information that QStyle
2459 functions need to draw QComboBox.
2460
2461 For performance reasons, there are few member functions and the
2462 access to the member variables is direct (i.e., using the \c . or
2463 \c -> operator). This makes the structures straightforward to use
2464 and emphasizes that these are simply parameters used by the style
2465 functions.
2466
2467 \sa QStyleOption, QStyleOptionComplex, QComboBox
2468*/
2469
2470/*!
2471 Creates a QStyleOptionComboBox, initializing the members variables
2472 to their default values.
2473*/
2474
2475QStyleOptionComboBox::QStyleOptionComboBox()
2476 : QStyleOptionComboBox(Version)
2477{
2478}
2479
2480/*!
2481 \internal
2482*/
2483QStyleOptionComboBox::QStyleOptionComboBox(int version)
2484 : QStyleOptionComplex(version, SO_ComboBox), editable(false), frame(true)
2485{
2486}
2487
2488/*!
2489 \fn QStyleOptionComboBox::QStyleOptionComboBox(const QStyleOptionComboBox &other)
2490
2491 Constructs a copy of the \a other style option.
2492*/
2493
2494/*!
2495 \enum QStyleOptionComboBox::StyleOptionType
2496
2497 This enum is used to hold information about the type of the style option, and
2498 is defined for each QStyleOption subclass.
2499
2500 \value Type The type of style option provided (\l{SO_ComboBox} for this class).
2501
2502 The type is used internally by QStyleOption, its subclasses, and
2503 qstyleoption_cast() to determine the type of style option. In
2504 general you do not need to worry about this unless you want to
2505 create your own QStyleOption subclass and your own styles.
2506
2507 \sa StyleOptionVersion
2508*/
2509
2510/*!
2511 \enum QStyleOptionComboBox::StyleOptionVersion
2512
2513 This enum is used to hold information about the version of the style option, and
2514 is defined for each QStyleOption subclass.
2515
2516 \value Version 2
2517
2518 The version is used by QStyleOption subclasses to implement
2519 extensions without breaking compatibility. If you use
2520 qstyleoption_cast(), you normally do not need to check it.
2521
2522 \sa StyleOptionType
2523*/
2524
2525/*!
2526 \variable QStyleOptionComboBox::editable
2527 \brief whether or not the combobox is editable or not
2528
2529 the default
2530 value is false
2531
2532 \sa QComboBox::isEditable()
2533*/
2534
2535
2536/*!
2537 \variable QStyleOptionComboBox::frame
2538 \brief whether the combo box has a frame
2539
2540 The default value is true.
2541*/
2542
2543/*!
2544 \variable QStyleOptionComboBox::currentText
2545 \brief the text for the current item of the combo box
2546
2547 The default value is an empty string.
2548*/
2549
2550/*!
2551 \variable QStyleOptionComboBox::currentIcon
2552 \brief the icon for the current item of the combo box
2553
2554 The default value is an empty icon, i.e. an icon with neither a
2555 pixmap nor a filename.
2556*/
2557
2558/*!
2559 \variable QStyleOptionComboBox::iconSize
2560 \brief the icon size for the current item of the combo box
2561
2562 The default value is QSize(-1, -1), i.e. an invalid size.
2563*/
2564
2565/*!
2566 \variable QStyleOptionComboBox::popupRect
2567 \brief the popup rectangle for the combobox
2568
2569 The default value is a null rectangle, i.e. a rectangle with both
2570 the width and the height set to 0.
2571
2572 This variable is currently unused. You can safely ignore it.
2573
2574 \sa QStyle::SC_ComboBoxListBoxPopup
2575*/
2576
2577/*!
2578 \variable QStyleOptionComboBox::textAlignment
2579 \brief the alignment of the current text in the combo box
2580
2581 The default value is Qt::AlignLeft | Qt::AlignVCenter.
2582*/
2583
2584/*!
2585 \class QStyleOptionToolBox
2586 \brief The QStyleOptionToolBox class is used to describe the
2587 parameters needed for drawing a tool box.
2588
2589 \inmodule QtWidgets
2590
2591 QStyleOptionToolBox contains all the information that QStyle
2592 functions need to draw QToolBox.
2593
2594 For performance reasons, there are few member functions and the
2595 access to the member variables is direct (i.e., using the \c . or
2596 \c -> operator). This makes the structures straightforward to use
2597 and emphasizes that these are simply parameters used by the style
2598 functions.
2599
2600 \sa QStyleOption, QToolBox
2601*/
2602
2603/*!
2604 Creates a QStyleOptionToolBox, initializing the members variables
2605 to their default values.
2606*/
2607
2608QStyleOptionToolBox::QStyleOptionToolBox()
2609 : QStyleOptionToolBox(Version)
2610{
2611}
2612
2613/*!
2614 \internal
2615*/
2616QStyleOptionToolBox::QStyleOptionToolBox(int version)
2617 : QStyleOption(version, SO_ToolBox), position(Beginning), selectedPosition(NotAdjacent)
2618{
2619}
2620
2621/*!
2622 \fn QStyleOptionToolBox::QStyleOptionToolBox(const QStyleOptionToolBox &other)
2623
2624 Constructs a copy of the \a other style option.
2625*/
2626
2627/*!
2628 \enum QStyleOptionToolBox::StyleOptionType
2629
2630 This enum is used to hold information about the type of the style option, and
2631 is defined for each QStyleOption subclass.
2632
2633 \value Type The type of style option provided (\l{SO_ToolBox} for this class).
2634
2635 The type is used internally by QStyleOption, its subclasses, and
2636 qstyleoption_cast() to determine the type of style option. In
2637 general you do not need to worry about this unless you want to
2638 create your own QStyleOption subclass and your own styles.
2639
2640 \sa StyleOptionVersion
2641*/
2642
2643/*!
2644 \enum QStyleOptionToolBox::StyleOptionVersion
2645
2646 This enum is used to hold information about the version of the style option, and
2647 is defined for each QStyleOption subclass.
2648
2649 \value Version 2
2650
2651 The version is used by QStyleOption subclasses to implement
2652 extensions without breaking compatibility. If you use
2653 qstyleoption_cast(), you normally do not need to check it.
2654
2655 \sa StyleOptionType
2656*/
2657
2658/*!
2659 \variable QStyleOptionToolBox::icon
2660 \brief the icon for the tool box tab
2661
2662 The default value is an empty icon, i.e. an icon with neither a
2663 pixmap nor a filename.
2664*/
2665
2666/*!
2667 \variable QStyleOptionToolBox::text
2668 \brief the text for the tool box tab
2669
2670 The default value is an empty string.
2671*/
2672
2673/*!
2674 \enum QStyleOptionToolBox::SelectedPosition
2675
2676 This enum describes the position of the selected tab. Some styles
2677 need to draw a tab differently depending on whether or not it is
2678 adjacent to the selected tab.
2679
2680 \value NotAdjacent The tab is not adjacent to a selected tab (or is the selected tab).
2681 \value NextIsSelected The next tab (typically the tab on the right) is selected.
2682 \value PreviousIsSelected The previous tab (typically the tab on the left) is selected.
2683
2684 \sa selectedPosition
2685*/
2686
2687/*!
2688 \enum QStyleOptionToolBox::TabPosition
2689
2690 This enum describes tab positions relative to other tabs.
2691
2692 \value Beginning The tab is the first (i.e., top-most) tab in
2693 the toolbox.
2694 \value Middle The tab is placed in the middle of the toolbox.
2695 \value End The tab is placed at the bottom of the toolbox.
2696 \value OnlyOneTab There is only one tab in the toolbox.
2697*/
2698
2699/*!
2700 \variable QStyleOptionToolBox::selectedPosition
2701 \brief the position of the selected tab in relation to this tab
2702
2703 The default value is NotAdjacent, i.e. the tab is not adjacent to
2704 a selected tab nor is it the selected tab.
2705*/
2706
2707#if QT_CONFIG(rubberband)
2708/*!
2709 \class QStyleOptionRubberBand
2710 \brief The QStyleOptionRubberBand class is used to describe the
2711 parameters needed for drawing a rubber band.
2712
2713 \inmodule QtWidgets
2714
2715 QStyleOptionRubberBand contains all the information that
2716 QStyle functions need to draw QRubberBand.
2717
2718 For performance reasons, there are few member functions and the
2719 access to the member variables is direct (i.e., using the \c . or
2720 \c -> operator). This makes the structures straightforward to use
2721 and emphasizes that these are simply parameters used by the style
2722 functions.
2723
2724 \sa QStyleOption, QRubberBand
2725*/
2726
2727/*!
2728 Creates a QStyleOptionRubberBand, initializing the members
2729 variables to their default values.
2730*/
2731
2732QStyleOptionRubberBand::QStyleOptionRubberBand()
2733 : QStyleOptionRubberBand(Version)
2734{
2735}
2736
2737/*!
2738 \internal
2739*/
2740QStyleOptionRubberBand::QStyleOptionRubberBand(int version)
2741 : QStyleOption(version, SO_RubberBand), shape(QRubberBand::Line), opaque(false)
2742{
2743}
2744
2745/*!
2746 \fn QStyleOptionRubberBand::QStyleOptionRubberBand(const QStyleOptionRubberBand &other)
2747
2748 Constructs a copy of the \a other style option.
2749*/
2750
2751/*!
2752 \enum QStyleOptionRubberBand::StyleOptionType
2753
2754 This enum is used to hold information about the type of the style option, and
2755 is defined for each QStyleOption subclass.
2756
2757 \value Type The type of style option provided (\l{SO_RubberBand} for this class).
2758
2759 The type is used internally by QStyleOption, its subclasses, and
2760 qstyleoption_cast() to determine the type of style option. In
2761 general you do not need to worry about this unless you want to
2762 create your own QStyleOption subclass and your own styles.
2763
2764 \sa StyleOptionVersion
2765*/
2766
2767/*!
2768 \enum QStyleOptionRubberBand::StyleOptionVersion
2769
2770 This enum is used to hold information about the version of the style option, and
2771 is defined for each QStyleOption subclass.
2772
2773 \value Version 1
2774
2775 The version is used by QStyleOption subclasses to implement
2776 extensions without breaking compatibility. If you use
2777 qstyleoption_cast(), you normally do not need to check it.
2778
2779 \sa StyleOptionType
2780*/
2781
2782/*!
2783 \variable QStyleOptionRubberBand::shape
2784 \brief the shape of the rubber band
2785
2786 The default shape is QRubberBand::Line.
2787*/
2788
2789/*!
2790 \variable QStyleOptionRubberBand::opaque
2791 \brief whether the rubber band is required to be drawn in an opaque style
2792
2793 The default value is true.
2794*/
2795#endif // QT_CONFIG(rubberband)
2796
2797/*!
2798 \class QStyleOptionTitleBar
2799 \brief The QStyleOptionTitleBar class is used to describe the
2800 parameters for drawing a title bar.
2801
2802 \inmodule QtWidgets
2803
2804 QStyleOptionTitleBar contains all the information that QStyle
2805 functions need to draw the title bar of a QMdiSubWindow.
2806
2807 For performance reasons, there are few member functions and the
2808 access to the member variables is direct (i.e., using the \c . or
2809 \c -> operator). This makes the structures straightforward to use
2810 and emphasizes that these are simply parameters used by the style
2811 functions.
2812
2813 \sa QStyleOption, QStyleOptionComplex, QMdiSubWindow
2814*/
2815
2816/*!
2817 Constructs a QStyleOptionTitleBar, initializing the members
2818 variables to their default values.
2819*/
2820
2821QStyleOptionTitleBar::QStyleOptionTitleBar()
2822 : QStyleOptionTitleBar(Version)
2823{
2824}
2825
2826/*!
2827 \fn QStyleOptionTitleBar::QStyleOptionTitleBar(const QStyleOptionTitleBar &other)
2828
2829 Constructs a copy of the \a other style option.
2830*/
2831
2832/*!
2833 \enum QStyleOptionTitleBar::StyleOptionType
2834
2835 This enum is used to hold information about the type of the style option, and
2836 is defined for each QStyleOption subclass.
2837
2838 \value Type The type of style option provided (\l{SO_TitleBar} for this class).
2839
2840 The type is used internally by QStyleOption, its subclasses, and
2841 qstyleoption_cast() to determine the type of style option. In
2842 general you do not need to worry about this unless you want to
2843 create your own QStyleOption subclass and your own styles.
2844
2845 \sa StyleOptionVersion
2846*/
2847
2848/*!
2849 \enum QStyleOptionTitleBar::StyleOptionVersion
2850
2851 This enum is used to hold information about the version of the style option, and
2852 is defined for each QStyleOption subclass.
2853
2854 \value Version 1
2855
2856 The version is used by QStyleOption subclasses to implement
2857 extensions without breaking compatibility. If you use
2858 qstyleoption_cast(), you normally do not need to check it.
2859
2860 \sa StyleOptionType
2861*/
2862
2863/*!
2864 \internal
2865*/
2866QStyleOptionTitleBar::QStyleOptionTitleBar(int version)
2867 : QStyleOptionComplex(version, SO_TitleBar), titleBarState(0)
2868{
2869}
2870
2871
2872/*!
2873 \variable QStyleOptionTitleBar::text
2874 \brief the text of the title bar
2875
2876 The default value is an empty string.
2877*/
2878
2879/*!
2880 \variable QStyleOptionTitleBar::icon
2881 \brief the icon for the title bar
2882
2883 The default value is an empty icon, i.e. an icon with neither a
2884 pixmap nor a filename.
2885*/
2886
2887/*!
2888 \variable QStyleOptionTitleBar::titleBarState
2889 \brief the state of the title bar
2890
2891 This is basically the window state of the underlying widget. The
2892 default value is 0.
2893
2894 \sa QWidget::windowState()
2895*/
2896
2897/*!
2898 \variable QStyleOptionTitleBar::titleBarFlags
2899 \brief the widget flags for the title bar
2900
2901 The default value is Qt::Widget.
2902
2903 \sa Qt::WindowFlags
2904*/
2905
2906#if QT_CONFIG(itemviews)
2907/*!
2908 \class QStyleOptionViewItem
2909 \brief The QStyleOptionViewItem class is used to describe the
2910 parameters used to draw an item in a view widget.
2911
2912 \inmodule QtWidgets
2913
2914 QStyleOptionViewItem contains all the information that QStyle
2915 functions need to draw the items for Qt's model/view classes.
2916
2917 For performance reasons, there are few member functions and the
2918 access to the member variables is direct (i.e., using the \c . or
2919 \c -> operator). This makes the structures straightforward to use
2920 and emphasizes that these are simply parameters used by the style
2921 functions.
2922
2923 \sa QStyleOption, {model-view-programming.html}{Model/View
2924 Programming}
2925*/
2926
2927/*!
2928 \enum QStyleOptionViewItem::Position
2929
2930 This enum describes the position of the item's decoration.
2931
2932 \value Left On the left of the text.
2933 \value Right On the right of the text.
2934 \value Top Above the text.
2935 \value Bottom Below the text.
2936
2937 \sa decorationPosition
2938*/
2939
2940/*!
2941 \variable QStyleOptionViewItem::showDecorationSelected
2942 \brief whether the decoration should be highlighted on selected
2943 items
2944
2945 If this option is true, the branch and any decorations on selected items
2946 should be highlighted, indicating that the item is selected; otherwise, no
2947 highlighting is required. The default value is false.
2948
2949 \sa QStyle::SH_ItemView_ShowDecorationSelected, QAbstractItemView
2950*/
2951
2952/*!
2953 \variable QStyleOptionViewItem::locale
2954 \brief the locale to use for displaying text, numbers and dates.
2955
2956 This allows the style to display e.g. dates in a different locale than
2957 the default locale of the application.
2958*/
2959
2960/*!
2961 \variable QStyleOptionViewItem::widget
2962 \brief the parent widget of the item
2963
2964 This member contains the parent widget (itemview) of the item to
2965 be able to e.g. access some properties within the QStyledItemDelegate
2966 methods.
2967*/
2968
2969/*!
2970 \variable QStyleOptionViewItem::textElideMode
2971 \brief where ellipsis should be added for text that is too long to fit
2972 into an item
2973
2974 The default value is Qt::ElideMiddle, i.e. the ellipsis appears in
2975 the middle of the text.
2976
2977 \sa Qt::TextElideMode, QStyle::SH_ItemView_EllipsisLocation
2978*/
2979
2980/*!
2981 Constructs a QStyleOptionViewItem, initializing the members
2982 variables to their default values.
2983*/
2984
2985QStyleOptionViewItem::QStyleOptionViewItem()
2986 : QStyleOptionViewItem(Version)
2987{
2988}
2989
2990/*!
2991 \internal
2992*/
2993QStyleOptionViewItem::QStyleOptionViewItem(int version)
2994 : QStyleOption(version, SO_ViewItem),
2995 displayAlignment(Qt::AlignLeft), decorationAlignment(Qt::AlignLeft),
2996 textElideMode(Qt::ElideMiddle), decorationPosition(Left),
2997 showDecorationSelected(false), features(None), widget(nullptr),
2998 checkState(Qt::Unchecked), viewItemPosition(QStyleOptionViewItem::Invalid)
2999{
3000}
3001
3002/*!
3003 \fn QStyleOptionViewItem::QStyleOptionViewItem(const QStyleOptionViewItem &other)
3004
3005 Constructs a copy of the \a other style option.
3006*/
3007
3008/*!
3009 \enum QStyleOptionViewItem::StyleOptionType
3010
3011 This enum is used to hold information about the type of the style option, and
3012 is defined for each QStyleOption subclass.
3013
3014 \value Type The type of style option provided (\l{SO_ViewItem} for this class).
3015
3016 The type is used internally by QStyleOption, its subclasses, and
3017 qstyleoption_cast() to determine the type of style option. In
3018 general you do not need to worry about this unless you want to
3019 create your own QStyleOption subclass and your own styles.
3020
3021 \sa StyleOptionVersion
3022*/
3023
3024/*!
3025 \enum QStyleOptionViewItem::StyleOptionVersion
3026
3027 This enum is used to hold information about the version of the style option, and
3028 is defined for each QStyleOption subclass.
3029
3030 \value Version 4
3031
3032 The version is used by QStyleOption subclasses to implement
3033 extensions without breaking compatibility. If you use
3034 qstyleoption_cast(), you normally do not need to check it.
3035
3036 \sa StyleOptionType
3037*/
3038
3039/*!
3040 \variable QStyleOptionViewItem::displayAlignment
3041 \brief the alignment of the display value for the item
3042
3043 The default value is Qt::AlignLeft.
3044*/
3045
3046/*!
3047 \variable QStyleOptionViewItem::decorationAlignment
3048 \brief the alignment of the decoration for the item
3049
3050 The default value is Qt::AlignLeft.
3051*/
3052
3053/*!
3054 \variable QStyleOptionViewItem::decorationPosition
3055 \brief the position of the decoration for the item
3056
3057 The default value is \l Left.
3058
3059 \sa Position
3060*/
3061
3062/*!
3063 \variable QStyleOptionViewItem::decorationSize
3064 \brief the size of the decoration for the item
3065
3066 The default value is QSize(-1, -1), i.e. an invalid size.
3067
3068 \sa decorationAlignment, decorationPosition
3069*/
3070
3071/*!
3072 \variable QStyleOptionViewItem::font
3073 \brief the font used for the item
3074
3075 By default, the application's default font is used.
3076
3077 \sa QFont
3078*/
3079
3080/*!
3081 \variable QStyleOptionViewItem::features
3082 \brief a bitwise OR of the features that describe this view item
3083
3084 \sa ViewItemFeature
3085*/
3086
3087/*!
3088 \enum QStyleOptionViewItem::ViewItemFeature
3089
3090 This enum describes the different types of features an item can have.
3091
3092 \value None Indicates a normal item.
3093 \value WrapText Indicates an item with wrapped text.
3094 \value Alternate Indicates that the item's background is rendered using alternateBase.
3095 \value HasCheckIndicator Indicates that the item has a check state indicator.
3096 \value HasDisplay Indicates that the item has a display role.
3097 \value HasDecoration Indicates that the item has a decoration role.
3098 \value [since 6.9] IsDecoratedRootColumn Indicates that the item has a tree view branch
3099 part for painting.
3100 \value [since 6.9] IsDecorationForRootColumn Indicates that the item contains the
3101 information to draw the tree view branch part.
3102*/
3103
3104/*!
3105 \variable QStyleOptionViewItem::index
3106
3107 The model index that is to be drawn.
3108*/
3109
3110/*!
3111 \variable QStyleOptionViewItem::checkState
3112
3113 If this view item is checkable, i.e.,
3114 ViewItemFeature::HasCheckIndicator is true, \c checkState is true
3115 if the item is checked; otherwise, it is false.
3116
3117*/
3118
3119/*!
3120 \variable QStyleOptionViewItem::icon
3121
3122 The icon (if any) to be drawn in the view item.
3123*/
3124
3125
3126/*!
3127 \variable QStyleOptionViewItem::text
3128
3129 The text (if any) to be drawn in the view item.
3130*/
3131
3132/*!
3133 \variable QStyleOptionViewItem::backgroundBrush
3134
3135 The QBrush that should be used to paint the view items
3136 background.
3137*/
3138
3139/*!
3140 \variable QStyleOptionViewItem::viewItemPosition
3141
3142 Gives the position of this view item relative to other items. See
3143 the \l{QStyleOptionViewItem::}{ViewItemPosition} enum for the
3144 details.
3145*/
3146
3147/*!
3148 \enum QStyleOptionViewItem::ViewItemPosition
3149
3150 This enum is used to represent the placement of the item on
3151 a row. This can be used to draw items differently depending
3152 on their placement, for example by putting rounded edges at
3153 the beginning and end, and straight edges in between.
3154
3155 \value Invalid The ViewItemPosition is unknown and should be
3156 disregarded.
3157 \value Beginning The item appears at the beginning of the row.
3158 \value Middle The item appears in the middle of the row.
3159 \value End The item appears at the end of the row.
3160 \value OnlyOne The item is the only one on the row, and is
3161 therefore both at the beginning and the end.
3162*/
3163
3164#endif // QT_CONFIG(itemviews)
3165/*!
3166 \fn template <typename T> T qstyleoption_cast<T>(const QStyleOption *option)
3167 \relates QStyleOption
3168
3169 Returns a T or \nullptr depending on the \l{QStyleOption::type}{type} and
3170 \l{QStyleOption::version}{version} of the given \a option.
3171
3172 Example:
3173
3174 \snippet qstyleoption/main.cpp 4
3175
3176 \sa QStyleOption::type, QStyleOption::version
3177*/
3178
3179/*!
3180 \fn template <typename T> T qstyleoption_cast<T>(QStyleOption *option)
3181 \overload
3182 \relates QStyleOption
3183
3184 Returns a T or \nullptr depending on the type of the given \a option.
3185*/
3186
3187#if QT_CONFIG(tabwidget)
3188/*!
3189 \class QStyleOptionTabWidgetFrame
3190 \brief The QStyleOptionTabWidgetFrame class is used to describe the
3191 parameters for drawing the frame around a tab widget.
3192
3193 \inmodule QtWidgets
3194
3195 QStyleOptionTabWidgetFrame contains all the information that
3196 QStyle functions need to draw the frame around QTabWidget.
3197
3198 For performance reasons, there are few member functions and the
3199 access to the member variables is direct (i.e., using the \c . or
3200 \c -> operator). This makes the structures straightforward to use
3201 and emphasizes that these are simply parameters used by the style
3202 functions.
3203
3204 \sa QStyleOption, QTabWidget
3205*/
3206
3207/*!
3208 Constructs a QStyleOptionTabWidgetFrame, initializing the members
3209 variables to their default values.
3210*/
3211QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame()
3212 : QStyleOptionTabWidgetFrame(Version)
3213{
3214}
3215
3216/*!
3217 \fn QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(const QStyleOptionTabWidgetFrame &other)
3218
3219 Constructs a copy of \a other.
3220*/
3221
3222/*! \internal */
3223QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(int version)
3224 : QStyleOption(version, SO_TabWidgetFrame), lineWidth(0), midLineWidth(0),
3225 shape(QTabBar::RoundedNorth)
3226{
3227}
3228
3229/*!
3230 \enum QStyleOptionTabWidgetFrame::StyleOptionType
3231
3232 This enum is used to hold information about the type of the style option, and
3233 is defined for each QStyleOption subclass.
3234
3235 \value Type The type of style option provided (\l{SO_TabWidgetFrame} for this class).
3236
3237 The type is used internally by QStyleOption, its subclasses, and
3238 qstyleoption_cast() to determine the type of style option. In
3239 general you do not need to worry about this unless you want to
3240 create your own QStyleOption subclass and your own styles.
3241
3242 \sa StyleOptionVersion
3243*/
3244
3245/*!
3246 \enum QStyleOptionTabWidgetFrame::StyleOptionVersion
3247
3248 This enum is used to hold information about the version of the style option, and
3249 is defined for each QStyleOption subclass.
3250
3251 \value Version 2
3252
3253 The version is used by QStyleOption subclasses to implement
3254 extensions without breaking compatibility. If you use
3255 qstyleoption_cast(), you normally do not need to check it.
3256
3257 \sa StyleOptionType
3258*/
3259
3260/*!
3261 \variable QStyleOptionTabWidgetFrame::lineWidth
3262 \brief the line width for drawing the panel
3263
3264 The default value is 0.
3265*/
3266
3267/*!
3268 \variable QStyleOptionTabWidgetFrame::midLineWidth
3269 \brief the mid-line width for drawing the panel
3270
3271 The mid line width is usually used in drawing sunken or raised
3272 frames. The default value is 0.
3273*/
3274
3275/*!
3276 \variable QStyleOptionTabWidgetFrame::shape
3277 \brief the tab shape used to draw the tabs
3278
3279 The default value is QTabBar::RoundedNorth.
3280*/
3281
3282/*!
3283 \variable QStyleOptionTabWidgetFrame::tabBarSize
3284 \brief the size of the tab bar
3285
3286 The default value is QSize(-1, -1), i.e. an invalid size.
3287*/
3288
3289/*!
3290 \variable QStyleOptionTabWidgetFrame::rightCornerWidgetSize
3291 \brief the size of the right-corner widget
3292
3293 The default value is QSize(-1, -1), i.e. an invalid size.
3294*/
3295
3296/*! \variable QStyleOptionTabWidgetFrame::leftCornerWidgetSize
3297 \brief the size of the left-corner widget
3298
3299 The default value is QSize(-1, -1), i.e. an invalid size.
3300*/
3301
3302
3303/*!
3304 \variable QStyleOptionTabWidgetFrame::tabBarRect
3305 \brief the rectangle containing all the tabs
3306
3307 The default value is a null rectangle, i.e. a rectangle with both
3308 the width and the height set to 0.
3309*/
3310
3311/*!
3312 \variable QStyleOptionTabWidgetFrame::selectedTabRect
3313 \brief the rectangle containing the selected tab
3314
3315 This rectangle is contained within the tabBarRect. The default
3316 value is a null rectangle, i.e. a rectangle with both the width
3317 and the height set to 0.
3318*/
3319
3320#endif // QT_CONFIG(tabwidget)
3321
3322#if QT_CONFIG(tabbar)
3323
3324/*!
3325 \class QStyleOptionTabBarBase
3326 \brief The QStyleOptionTabBarBase class is used to describe
3327 the base of a tab bar, i.e. the part that the tab bar usually
3328 overlaps with.
3329
3330 \inmodule QtWidgets
3331
3332 QStyleOptionTabBarBase contains all the information that QStyle
3333 functions need to draw the tab bar base. Note that this is only
3334 drawn for a standalone QTabBar (one that isn't part of a
3335 QTabWidget).
3336
3337 For performance reasons, there are few member functions and the
3338 access to the member variables is direct (i.e., using the \c . or
3339 \c -> operator). This makes the structures straightforward to use
3340 and emphasizes that these are simply parameters used by the style
3341 functions.
3342
3343 \sa QStyleOption, QTabBar::drawBase()
3344*/
3345
3346/*!
3347 Construct a QStyleOptionTabBarBase, initializing the members
3348 variables to their default values.
3349*/
3350QStyleOptionTabBarBase::QStyleOptionTabBarBase()
3351 : QStyleOptionTabBarBase(Version)
3352{
3353}
3354
3355/*! \internal */
3356QStyleOptionTabBarBase::QStyleOptionTabBarBase(int version)
3357 : QStyleOption(version, SO_TabBarBase), shape(QTabBar::RoundedNorth),
3358 documentMode(false)
3359{
3360}
3361
3362/*!
3363 \fn QStyleOptionTabBarBase::QStyleOptionTabBarBase(const QStyleOptionTabBarBase &other)
3364
3365 Constructs a copy of \a other.
3366*/
3367
3368/*!
3369 \enum QStyleOptionTabBarBase::StyleOptionType
3370
3371 This enum is used to hold information about the type of the style option, and
3372 is defined for each QStyleOption subclass.
3373
3374 \value Type The type of style option provided (\l{SO_TabBarBase} for this class).
3375
3376 The type is used internally by QStyleOption, its subclasses, and
3377 qstyleoption_cast() to determine the type of style option. In
3378 general you do not need to worry about this unless you want to
3379 create your own QStyleOption subclass and your own styles.
3380
3381 \sa StyleOptionVersion
3382*/
3383
3384/*!
3385 \enum QStyleOptionTabBarBase::StyleOptionVersion
3386
3387 This enum is used to hold information about the version of the style option, and
3388 is defined for each QStyleOption subclass.
3389
3390 \value Version 2
3391
3392 The version is used by QStyleOption subclasses to implement
3393 extensions without breaking compatibility. If you use
3394 qstyleoption_cast(), you normally do not need to check it.
3395
3396 \sa StyleOptionType
3397*/
3398
3399/*!
3400 \variable QStyleOptionTabBarBase::shape
3401 \brief the shape of the tab bar
3402
3403 The default value is QTabBar::RoundedNorth.
3404*/
3405
3406/*!
3407 \variable QStyleOptionTabBarBase::tabBarRect
3408 \brief the rectangle containing all the tabs
3409
3410 The default value is a null rectangle, i.e. a rectangle with both
3411 the width and the height set to 0.
3412*/
3413
3414/*!
3415 \variable QStyleOptionTabBarBase::selectedTabRect
3416 \brief the rectangle containing the selected tab
3417
3418 This rectangle is contained within the tabBarRect. The default
3419 value is a null rectangle, i.e. a rectangle with both the width
3420 and the height set to 0.
3421*/
3422
3423
3424/*!
3425 \variable QStyleOptionTabBarBase::documentMode
3426 \brief whether the tabbar is in document mode.
3427
3428 The default value is false;
3429*/
3430
3431#endif // QT_CONFIG(tabbar)
3432
3433#if QT_CONFIG(sizegrip)
3434/*!
3435 \class QStyleOptionSizeGrip
3436 \brief The QStyleOptionSizeGrip class is used to describe the
3437 parameter for drawing a size grip.
3438 \since 4.2
3439 \inmodule QtWidgets
3440
3441 QStyleOptionButton contains all the information that QStyle
3442 functions need to draw QSizeGrip.
3443
3444 For performance reasons, there are few member functions and the
3445 access to the member variables is direct (i.e., using the \c . or
3446 \c -> operator). This makes the structures straightforward to use
3447 and emphasizes that these are simply parameters used by the style
3448 functions.
3449
3450 \sa QStyleOption, QStyleOptionComplex, QSizeGrip
3451*/
3452
3453/*!
3454 Constructs a QStyleOptionSizeGrip.
3455*/
3456QStyleOptionSizeGrip::QStyleOptionSizeGrip()
3457 : QStyleOptionSizeGrip(Version)
3458{
3459}
3460
3461/*!
3462 \fn QStyleOptionSizeGrip::QStyleOptionSizeGrip(const QStyleOptionSizeGrip &other)
3463
3464 Constructs a copy of the \a other style option.
3465*/
3466
3467/*!
3468 \internal
3469*/
3470QStyleOptionSizeGrip::QStyleOptionSizeGrip(int version)
3471 : QStyleOptionComplex(version, Type), corner(Qt::BottomRightCorner)
3472{
3473}
3474
3475/*!
3476 \variable QStyleOptionSizeGrip::corner
3477
3478 The corner in which the size grip is located.
3479*/
3480
3481/*!
3482 \enum QStyleOptionSizeGrip::StyleOptionType
3483
3484 This enum is used to hold information about the type of the style option, and
3485 is defined for each QStyleOption subclass.
3486
3487 \value Type The type of style option provided (\l{SO_TabBarBase} for this class).
3488
3489 The type is used internally by QStyleOption, its subclasses, and
3490 qstyleoption_cast() to determine the type of style option. In
3491 general you do not need to worry about this unless you want to
3492 create your own QStyleOption subclass and your own styles.
3493
3494 \sa StyleOptionVersion
3495*/
3496
3497/*!
3498 \enum QStyleOptionSizeGrip::StyleOptionVersion
3499
3500 This enum is used to hold information about the version of the style option, and
3501 is defined for each QStyleOption subclass.
3502
3503 \value Version 1
3504
3505 The version is used by QStyleOption subclasses to implement
3506 extensions without breaking compatibility. If you use
3507 qstyleoption_cast(), you normally do not need to check it.
3508
3509 \sa StyleOptionType
3510*/
3511#endif // QT_CONFIG(sizegrip)
3512
3513/*!
3514 \class QStyleOptionGraphicsItem
3515 \brief The QStyleOptionGraphicsItem class is used to describe
3516 the parameters needed to draw a QGraphicsItem.
3517 \since 4.2
3518 \ingroup graphicsview-api
3519 \inmodule QtWidgets
3520
3521 For performance reasons, there are few member functions and the
3522 access to the member variables is direct (i.e., using the \c . or
3523 \c -> operator). This makes the structures straightforward to use
3524 and emphasizes that these are simply parameters used by the style
3525 functions.
3526
3527 \sa QStyleOption, QGraphicsItem::paint()
3528*/
3529
3530/*!
3531 \enum QStyleOptionGraphicsItem::StyleOptionType
3532
3533 This enum is used to hold information about the type of the style option, and
3534 is defined for each QStyleOption subclass.
3535
3536 \value Type The type of style option provided (\l SO_GraphicsItem for this class).
3537
3538 The type is used internally by QStyleOption, its subclasses, and
3539 qstyleoption_cast() to determine the type of style option. In
3540 general you do not need to worry about this unless you want to
3541 create your own QStyleOption subclass and your own styles.
3542
3543 \sa StyleOptionVersion
3544*/
3545
3546/*!
3547 \enum QStyleOptionGraphicsItem::StyleOptionVersion
3548
3549 This enum is used to hold information about the version of the style option, and
3550 is defined for each QStyleOption subclass.
3551
3552 \value Version 1
3553
3554 The version is used by QStyleOption subclasses to implement
3555 extensions without breaking compatibility. If you use
3556 qstyleoption_cast(), you normally do not need to check it.
3557
3558 \sa StyleOptionType
3559*/
3560
3561/*!
3562 Constructs a QStyleOptionGraphicsItem.
3563*/
3564QStyleOptionGraphicsItem::QStyleOptionGraphicsItem()
3565 : QStyleOptionGraphicsItem(Version)
3566{
3567}
3568
3569/*!
3570 \internal
3571*/
3572QStyleOptionGraphicsItem::QStyleOptionGraphicsItem(int version)
3573 : QStyleOption(version, Type)
3574{
3575}
3576
3577/*!
3578 \since 4.6
3579
3580 Returns the level of detail from the \a worldTransform.
3581
3582 Its value represents the maximum value of the height and
3583 width of a unity rectangle, mapped using the \a worldTransform
3584 of the painter used to draw the item. By default, if no
3585 transformations are applied, its value is 1. If zoomed out 1:2, the level
3586 of detail will be 0.5, and if zoomed in 2:1, its value is 2.
3587
3588 \sa QGraphicsScene::minimumRenderSize()
3589*/
3590qreal QStyleOptionGraphicsItem::levelOfDetailFromTransform(const QTransform &worldTransform)
3591{
3592 if (worldTransform.type() <= QTransform::TxTranslate)
3593 return 1; // Translation only? The LOD is 1.
3594
3595 // Two unit vectors.
3596 QLineF v1(0, 0, 1, 0);
3597 QLineF v2(0, 0, 0, 1);
3598 // LOD is the transformed area of a 1x1 rectangle.
3599 return qSqrt(v: worldTransform.map(l: v1).length() * worldTransform.map(l: v2).length());
3600}
3601
3602/*!
3603 \fn QStyleOptionGraphicsItem::QStyleOptionGraphicsItem(const QStyleOptionGraphicsItem &other)
3604
3605 Constructs a copy of \a other.
3606*/
3607
3608/*!
3609 \variable QStyleOptionGraphicsItem::exposedRect
3610 \brief the exposed rectangle, in item coordinates
3611
3612 Make use of this rectangle to speed up item drawing when only parts of the
3613 item are exposed. If the whole item is exposed, this rectangle will be the
3614 same as QGraphicsItem::boundingRect().
3615
3616 This member is only initialized for items that have the
3617 QGraphicsItem::ItemUsesExtendedStyleOption flag set.
3618*/
3619
3620/*!
3621 \class QStyleHintReturn
3622 \brief The QStyleHintReturn class provides style hints that return more
3623 than basic data types.
3624
3625 \ingroup appearance
3626 \inmodule QtWidgets
3627
3628 QStyleHintReturn and its subclasses are used to pass information
3629 from a style back to the querying widget. This is most useful
3630 when the return value from QStyle::styleHint() does not provide enough
3631 detail; for example, when a mask is to be returned.
3632*/
3633
3634/*!
3635 \enum QStyleHintReturn::HintReturnType
3636
3637 \value SH_Default QStyleHintReturn
3638 \value SH_Mask \l QStyle::SH_RubberBand_Mask QStyle::SH_FocusFrame_Mask
3639 \value SH_Variant \l QStyle::SH_TextControl_FocusIndicatorTextCharFormat
3640*/
3641
3642/*!
3643 \enum QStyleHintReturn::StyleOptionType
3644
3645 This enum is used to hold information about the type of the style option, and
3646 is defined for each QStyleHintReturn subclass.
3647
3648 \value Type The type of style option provided (\l SH_Default for
3649 this class).
3650
3651 The type is used internally by QStyleHintReturn, its subclasses, and
3652 qstyleoption_cast() to determine the type of style option. In
3653 general you do not need to worry about this unless you want to
3654 create your own QStyleHintReturn subclass and your own styles.
3655
3656 \sa StyleOptionVersion
3657*/
3658
3659/*!
3660 \enum QStyleHintReturn::StyleOptionVersion
3661
3662 This enum is used to hold information about the version of the style option, and
3663 is defined for each QStyleHintReturn subclass.
3664
3665 \value Version 1
3666
3667 The version is used by QStyleHintReturn subclasses to implement
3668 extensions without breaking compatibility. If you use
3669 qstyleoption_cast(), you normally do not need to check it.
3670
3671 \sa StyleOptionType
3672*/
3673
3674/*!
3675 \variable QStyleHintReturn::type
3676 \brief the type of the style hint container
3677
3678 \sa HintReturnType
3679*/
3680
3681/*!
3682 \variable QStyleHintReturn::version
3683 \brief the version of the style hint return container
3684
3685 This value can be used by subclasses to implement extensions
3686 without breaking compatibility. If you use qstyleoption_cast<T>(), you
3687 normally do not need to check it.
3688*/
3689
3690/*!
3691 Constructs a QStyleHintReturn with version \a version and type \a
3692 type.
3693
3694 The version has no special meaning for QStyleHintReturn; it can be
3695 used by subclasses to distinguish between different version of
3696 the same hint type.
3697
3698 \sa QStyleOption::version, QStyleOption::type
3699*/
3700
3701QStyleHintReturn::QStyleHintReturn(int version, int type)
3702 : version(version), type(type)
3703{
3704}
3705
3706/*!
3707 \internal
3708*/
3709
3710QStyleHintReturn::~QStyleHintReturn()
3711{
3712
3713}
3714
3715/*!
3716 \class QStyleHintReturnMask
3717 \brief The QStyleHintReturnMask class provides style hints that return a QRegion.
3718
3719 \ingroup appearance
3720 \inmodule QtWidgets
3721*/
3722
3723/*!
3724 \variable QStyleHintReturnMask::region
3725 \brief the region for style hints that return a QRegion
3726*/
3727
3728/*!
3729 Constructs a QStyleHintReturnMask. The member variables are
3730 initialized to default values.
3731*/
3732QStyleHintReturnMask::QStyleHintReturnMask() : QStyleHintReturn(Version, Type)
3733{
3734}
3735
3736/*!
3737 Destructor.
3738*/
3739QStyleHintReturnMask::~QStyleHintReturnMask()
3740{
3741}
3742
3743/*!
3744 \enum QStyleHintReturnMask::StyleOptionType
3745
3746 This enum is used to hold information about the type of the style option, and
3747 is defined for each QStyleHintReturn subclass.
3748
3749 \value Type The type of style option provided (\l{SH_Mask} for
3750 this class).
3751
3752 The type is used internally by QStyleHintReturn, its subclasses, and
3753 qstyleoption_cast() to determine the type of style option. In
3754 general you do not need to worry about this unless you want to
3755 create your own QStyleHintReturn subclass and your own styles.
3756
3757 \sa StyleOptionVersion
3758*/
3759
3760/*!
3761 \enum QStyleHintReturnMask::StyleOptionVersion
3762
3763 This enum is used to hold information about the version of the style option, and
3764 is defined for each QStyleHintReturn subclass.
3765
3766 \value Version 1
3767
3768 The version is used by QStyleHintReturn subclasses to implement
3769 extensions without breaking compatibility. If you use
3770 qstyleoption_cast(), you normally do not need to check it.
3771
3772 \sa StyleOptionType
3773*/
3774
3775/*!
3776 \class QStyleHintReturnVariant
3777 \brief The QStyleHintReturnVariant class provides style hints that return a QVariant.
3778 \since 4.3
3779 \ingroup appearance
3780 \inmodule QtWidgets
3781*/
3782
3783/*!
3784 \variable QStyleHintReturnVariant::variant
3785 \brief the variant for style hints that return a QVariant
3786*/
3787
3788/*!
3789 Constructs a QStyleHintReturnVariant. The member variables are
3790 initialized to default values.
3791*/
3792QStyleHintReturnVariant::QStyleHintReturnVariant() : QStyleHintReturn(Version, Type)
3793{
3794}
3795
3796/*!
3797 Destructor.
3798*/
3799QStyleHintReturnVariant::~QStyleHintReturnVariant()
3800{
3801}
3802
3803/*!
3804 \enum QStyleHintReturnVariant::StyleOptionType
3805
3806 This enum is used to hold information about the type of the style option, and
3807 is defined for each QStyleHintReturn subclass.
3808
3809 \value Type The type of style option provided (\l{SH_Variant} for
3810 this class).
3811
3812 The type is used internally by QStyleHintReturn, its subclasses, and
3813 qstyleoption_cast() to determine the type of style option. In
3814 general you do not need to worry about this unless you want to
3815 create your own QStyleHintReturn subclass and your own styles.
3816
3817 \sa StyleOptionVersion
3818*/
3819
3820/*!
3821 \enum QStyleHintReturnVariant::StyleOptionVersion
3822
3823 This enum is used to hold information about the version of the style option, and
3824 is defined for each QStyleHintReturn subclass.
3825
3826 \value Version 1
3827
3828 The version is used by QStyleHintReturn subclasses to implement
3829 extensions without breaking compatibility. If you use
3830 qstyleoption_cast(), you normally do not need to check it.
3831
3832 \sa StyleOptionType
3833*/
3834
3835/*!
3836 \fn template <typename T> T qstyleoption_cast<T>(const QStyleHintReturn *hint)
3837 \relates QStyleHintReturn
3838
3839 Returns a T or \nullptr depending on the \l{QStyleHintReturn::type}{type}
3840 and \l{QStyleHintReturn::version}{version} of \a hint.
3841
3842 Example:
3843
3844 \snippet code/src_gui_styles_qstyleoption.cpp 0
3845
3846 \sa QStyleHintReturn::type, QStyleHintReturn::version
3847*/
3848
3849/*!
3850 \fn template <typename T> T qstyleoption_cast<T>(QStyleHintReturn *hint)
3851 \overload
3852 \relates QStyleHintReturn
3853
3854 Returns a T or \nullptr depending on the type of \a hint.
3855*/
3856
3857#if !defined(QT_NO_DEBUG_STREAM)
3858QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType)
3859{
3860#if !defined(QT_NO_DEBUG)
3861 switch (optionType) {
3862 case QStyleOption::SO_Default:
3863 debug << "SO_Default"; break;
3864 case QStyleOption::SO_FocusRect:
3865 debug << "SO_FocusRect"; break;
3866 case QStyleOption::SO_Button:
3867 debug << "SO_Button"; break;
3868 case QStyleOption::SO_Tab:
3869 debug << "SO_Tab"; break;
3870 case QStyleOption::SO_MenuItem:
3871 debug << "SO_MenuItem"; break;
3872 case QStyleOption::SO_Frame:
3873 debug << "SO_Frame"; break;
3874 case QStyleOption::SO_ProgressBar:
3875 debug << "SO_ProgressBar"; break;
3876 case QStyleOption::SO_ToolBox:
3877 debug << "SO_ToolBox"; break;
3878 case QStyleOption::SO_Header:
3879 debug << "SO_Header"; break;
3880 case QStyleOption::SO_DockWidget:
3881 debug << "SO_DockWidget"; break;
3882 case QStyleOption::SO_ViewItem:
3883 debug << "SO_ViewItem"; break;
3884 case QStyleOption::SO_TabWidgetFrame:
3885 debug << "SO_TabWidgetFrame"; break;
3886 case QStyleOption::SO_TabBarBase:
3887 debug << "SO_TabBarBase"; break;
3888 case QStyleOption::SO_RubberBand:
3889 debug << "SO_RubberBand"; break;
3890 case QStyleOption::SO_Complex:
3891 debug << "SO_Complex"; break;
3892 case QStyleOption::SO_Slider:
3893 debug << "SO_Slider"; break;
3894 case QStyleOption::SO_SpinBox:
3895 debug << "SO_SpinBox"; break;
3896 case QStyleOption::SO_ToolButton:
3897 debug << "SO_ToolButton"; break;
3898 case QStyleOption::SO_ComboBox:
3899 debug << "SO_ComboBox"; break;
3900 case QStyleOption::SO_TitleBar:
3901 debug << "SO_TitleBar"; break;
3902 case QStyleOption::SO_CustomBase:
3903 debug << "SO_CustomBase"; break;
3904 case QStyleOption::SO_GroupBox:
3905 debug << "SO_GroupBox"; break;
3906 case QStyleOption::SO_ToolBar:
3907 debug << "SO_ToolBar"; break;
3908 case QStyleOption::SO_ComplexCustomBase:
3909 debug << "SO_ComplexCustomBase"; break;
3910 case QStyleOption::SO_SizeGrip:
3911 debug << "SO_SizeGrip"; break;
3912 case QStyleOption::SO_GraphicsItem:
3913 debug << "SO_GraphicsItem"; break;
3914 }
3915#else
3916 Q_UNUSED(optionType);
3917#endif
3918 return debug;
3919}
3920
3921QDebug operator<<(QDebug debug, const QStyleOption &option)
3922{
3923#if !defined(QT_NO_DEBUG)
3924 debug << "QStyleOption(";
3925 debug << QStyleOption::OptionType(option.type);
3926 debug << ',' << (option.direction == Qt::RightToLeft ? "RightToLeft" : "LeftToRight");
3927 debug << ',' << option.state;
3928 debug << ',' << option.rect;
3929 debug << ',' << option.styleObject;
3930 debug << ')';
3931#else
3932 Q_UNUSED(option);
3933#endif
3934 return debug;
3935}
3936#endif
3937
3938QT_END_NAMESPACE
3939

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