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