source: trunk/src/gui/styles/qstyleoption.cpp@ 348

Last change on this file since 348 was 2, checked in by Dmitry A. Kuminov, 16 years ago

Initially imported qt-all-opensource-src-4.5.1 from Trolltech.

File size: 155.9 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4** Contact: Qt Software Information ([email protected])
5**
6** This file is part of the QtGui module of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:LGPL$
9** Commercial Usage
10** Licensees holding valid Qt Commercial licenses may use this file in
11** accordance with the Qt Commercial License Agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and Nokia.
14**
15** GNU Lesser General Public License Usage
16** Alternatively, this file may be used under the terms of the GNU Lesser
17** General Public License version 2.1 as published by the Free Software
18** Foundation and appearing in the file LICENSE.LGPL included in the
19** packaging of this file. Please review the following information to
20** ensure the GNU Lesser General Public License version 2.1 requirements
21** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
22**
23** In addition, as a special exception, Nokia gives you certain
24** additional rights. These rights are described in the Nokia Qt LGPL
25** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
26** package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you are unsure which license is appropriate for your use, please
37** contact the sales department at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#include "qstyleoption.h"
43#include "qapplication.h"
44#ifdef Q_WS_MAC
45# include "private/qt_mac_p.h"
46# include "qmacstyle_mac.h"
47#endif
48#ifndef QT_NO_DEBUG
49#include <qdebug.h>
50#endif
51
52QT_BEGIN_NAMESPACE
53
54/*!
55 \class QStyleOption
56 \brief The QStyleOption class stores the parameters used by QStyle functions.
57
58 \ingroup appearance
59
60 QStyleOption and its subclasses contain all the information that
61 QStyle functions need to draw a graphical element.
62
63 For performance reasons, there are few member functions and the
64 access to the member variables is direct (i.e., using the \c . or
65 \c -> operator). This low-level feel makes the structures
66 straightforward to use and emphasizes that these are simply
67 parameters used by the style functions.
68
69 The caller of a QStyle function usually creates QStyleOption
70 objects on the stack. This combined with Qt's extensive use of
71 \l{implicit sharing} for types such as QString, QPalette, and
72 QColor ensures that no memory allocation needlessly takes place.
73
74 The following code snippet shows how to use a specific
75 QStyleOption subclass to paint a push button:
76
77 \snippet doc/src/snippets/qstyleoption/main.cpp 0
78
79 In our example, the control is a QStyle::CE_PushButton, and
80 according to the QStyle::drawControl() documentation the
81 corresponding class is QStyleOptionButton.
82
83 When reimplementing QStyle functions that take a QStyleOption
84 parameter, you often need to cast the QStyleOption to a subclass.
85 For safety, you can use qstyleoption_cast() to ensure that the
86 pointer type is correct. For example:
87
88 \snippet doc/src/snippets/qstyleoption/main.cpp 4
89
90 The qstyleoption_cast() function will return 0 if the object to
91 which \c option points is not of the correct type.
92
93 For an example demonstrating how style options can be used, see
94 the \l {widgets/styles}{Styles} example.
95
96 \sa QStyle, QStylePainter
97*/
98
99/*!
100 \enum QStyleOption::OptionType
101
102 This enum is used internally by QStyleOption, its subclasses, and
103 qstyleoption_cast() to determine the type of style option. In
104 general you do not need to worry about this unless you want to
105 create your own QStyleOption subclass and your own styles.
106
107 \value SO_Button \l QStyleOptionButton
108 \value SO_ComboBox \l QStyleOptionComboBox
109 \value SO_Complex \l QStyleOptionComplex
110 \value SO_Default QStyleOption
111 \value SO_DockWidget \l QStyleOptionDockWidget
112 \value SO_FocusRect \l QStyleOptionFocusRect
113 \value SO_Frame \l QStyleOptionFrame \l QStyleOptionFrameV2
114 \value SO_GraphicsItem \l QStyleOptionGraphicsItem
115 \value SO_GroupBox \l QStyleOptionGroupBox
116 \value SO_Header \l QStyleOptionHeader
117 \value SO_MenuItem \l QStyleOptionMenuItem
118 \value SO_ProgressBar \l QStyleOptionProgressBar \l QStyleOptionProgressBarV2
119 \value SO_RubberBand \l QStyleOptionRubberBand
120 \value SO_SizeGrip \l QStyleOptionSizeGrip
121 \value SO_Slider \l QStyleOptionSlider
122 \value SO_SpinBox \l QStyleOptionSpinBox
123 \value SO_Tab \l QStyleOptionTab
124 \value SO_TabBarBase \l QStyleOptionTabBarBase
125 \value SO_TabWidgetFrame \l QStyleOptionTabWidgetFrame
126 \value SO_TitleBar \l QStyleOptionTitleBar
127 \value SO_ToolBar \l QStyleOptionToolBar
128 \value SO_ToolBox \l QStyleOptionToolBox
129 \value SO_ToolButton \l QStyleOptionToolButton
130 \value SO_ViewItem \l QStyleOptionViewItem (used in Interviews)
131
132 The following values are used for custom controls:
133
134 \value SO_CustomBase Reserved for custom QStyleOptions;
135 all custom controls values must be above this value
136 \value SO_ComplexCustomBase Reserved for custom QStyleOptions;
137 all custom complex controls values must be above this value
138
139 Some style options are defined for various Qt3Support controls:
140
141 \value SO_Q3DockWindow \l QStyleOptionQ3DockWindow
142 \value SO_Q3ListView \l QStyleOptionQ3ListView
143 \value SO_Q3ListViewItem \l QStyleOptionQ3ListViewItem
144
145 \sa type
146*/
147
148/*!
149 Constructs a QStyleOption with the specified \a version and \a
150 type.
151
152 The version has no special meaning for QStyleOption; it can be
153 used by subclasses to distinguish between different version of
154 the same option type.
155
156 The \l state member variable is initialized to
157 QStyle::State_None.
158
159 \sa version, type
160*/
161
162QStyleOption::QStyleOption(int version, int type)
163 : version(version), type(type), state(QStyle::State_None),
164 direction(QApplication::layoutDirection()), fontMetrics(QFont())
165{
166}
167
168
169/*!
170 Destroys this style option object.
171*/
172QStyleOption::~QStyleOption()
173{
174}
175
176/*!
177 \fn void QStyleOption::initFrom(const QWidget *widget)
178 \since 4.1
179
180 Initializes the \l state, \l direction, \l rect, \l palette, and
181 \l fontMetrics member variables based on the specified \a widget.
182
183 This is a convenience function; the member variables can also be
184 initialized manually.
185
186 \sa QWidget::layoutDirection(), QWidget::rect(),
187 QWidget::palette(), QWidget::fontMetrics()
188*/
189
190/*!
191 \obsolete
192
193 Use initFrom(\a widget) instead.
194*/
195void QStyleOption::init(const QWidget *widget)
196{
197 QWidget *window = widget->window();
198 state = QStyle::State_None;
199 if (widget->isEnabled())
200 state |= QStyle::State_Enabled;
201 if (widget->hasFocus())
202 state |= QStyle::State_HasFocus;
203 if (window->testAttribute(Qt::WA_KeyboardFocusChange))
204 state |= QStyle::State_KeyboardFocusChange;
205 if (widget->underMouse())
206 state |= QStyle::State_MouseOver;
207 if (window->isActiveWindow())
208 state |= QStyle::State_Active;
209 if (widget->isWindow())
210 state |= QStyle::State_Window;
211#ifdef Q_WS_MAC
212 extern bool qt_mac_can_clickThrough(const QWidget *w); //qwidget_mac.cpp
213 if (!(state & QStyle::State_Active) && !qt_mac_can_clickThrough(widget))
214 state &= ~QStyle::State_Enabled;
215
216 switch (QMacStyle::widgetSizePolicy(widget)) {
217 case QMacStyle::SizeSmall:
218 state |= QStyle::State_Small;
219 break;
220 case QMacStyle::SizeMini:
221 state |= QStyle::State_Mini;
222 break;
223 default:
224 ;
225 }
226#endif
227#ifdef QT_KEYPAD_NAVIGATION
228 if (widget->hasEditFocus())
229 state |= QStyle::State_HasEditFocus;
230#endif
231
232 direction = widget->layoutDirection();
233 rect = widget->rect();
234 palette = widget->palette();
235 fontMetrics = widget->fontMetrics();
236}
237
238/*!
239 Constructs a copy of \a other.
240*/
241QStyleOption::QStyleOption(const QStyleOption &other)
242 : version(Version), type(Type), state(other.state),
243 direction(other.direction), rect(other.rect), fontMetrics(other.fontMetrics),
244 palette(other.palette)
245{
246}
247
248/*!
249 Assign \a other to this QStyleOption.
250*/
251QStyleOption &QStyleOption::operator=(const QStyleOption &other)
252{
253 state = other.state;
254 direction = other.direction;
255 rect = other.rect;
256 fontMetrics = other.fontMetrics;
257 palette = other.palette;
258 return *this;
259}
260
261/*!
262 \enum QStyleOption::StyleOptionType
263
264 This enum is used to hold information about the type of the style option, and
265 is defined for each QStyleOption subclass.
266
267 \value Type The type of style option provided (\l{SO_Default} for
268 this class).
269
270 The type is used internally by QStyleOption, its subclasses, and
271 qstyleoption_cast() to determine the type of style option. In
272 general you do not need to worry about this unless you want to
273 create your own QStyleOption subclass and your own styles.
274
275 \sa StyleOptionVersion
276*/
277
278/*!
279 \enum QStyleOption::StyleOptionVersion
280
281 This enum is used to hold information about the version of the style option, and
282 is defined for each QStyleOption subclass.
283
284 \value Version 1
285
286 The version is used by QStyleOption subclasses to implement
287 extensions without breaking compatibility. If you use
288 qstyleoption_cast(), you normally do not need to check it.
289
290 \sa StyleOptionType
291*/
292
293/*!
294 \variable QStyleOption::palette
295 \brief the palette that should be used when painting the control
296
297 By default, the application's default palette is used.
298
299 \sa initFrom()
300*/
301
302/*!
303 \variable QStyleOption::direction
304 \brief the text layout direction that should be used when drawing text in the control
305
306 By default, the layout direction is Qt::LeftToRight.
307
308 \sa initFrom()
309*/
310
311/*!
312 \variable QStyleOption::fontMetrics
313 \brief the font metrics that should be used when drawing text in the control
314
315 By default, the application's default font is used.
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 For performance reasons, the access to the member variables is
372 direct (i.e., using the \c . or \c -> operator). This low-level feel
373 makes the structures straightforward to use and emphasizes that
374 these are simply parameters used by the style functions.
375
376 For an example demonstrating how style options can be used, see
377 the \l {widgets/styles}{Styles} example.
378
379 \sa QStyleOption
380*/
381
382/*!
383 Constructs a QStyleOptionFocusRect, initializing the members
384 variables to their default values.
385*/
386
387QStyleOptionFocusRect::QStyleOptionFocusRect()
388 : QStyleOption(Version, SO_FocusRect)
389{
390 state |= QStyle::State_KeyboardFocusChange; // assume we had one, will be corrected in initFrom()
391}
392
393/*!
394 \internal
395*/
396QStyleOptionFocusRect::QStyleOptionFocusRect(int version)
397 : QStyleOption(version, SO_FocusRect)
398{
399 state |= QStyle::State_KeyboardFocusChange; // assume we had one, will be corrected in initFrom()
400}
401
402/*!
403 \enum QStyleOptionFocusRect::StyleOptionType
404
405 This enum is used to hold information about the type of the style option, and
406 is defined for each QStyleOption subclass.
407
408 \value Type The type of style option provided (\l{SO_FocusRect} for this class).
409
410 The type is used internally by QStyleOption, its subclasses, and
411 qstyleoption_cast() to determine the type of style option. In
412 general you do not need to worry about this unless you want to
413 create your own QStyleOption subclass and your own styles.
414
415 \sa StyleOptionVersion
416*/
417
418/*!
419 \enum QStyleOptionFocusRect::StyleOptionVersion
420
421 This enum is used to hold information about the version of the style option, and
422 is defined for each QStyleOption subclass.
423
424 \value Version 1
425
426 The version is used by QStyleOption subclasses to implement
427 extensions without breaking compatibility. If you use
428 qstyleoption_cast(), you normally do not need to check it.
429
430 \sa StyleOptionType
431*/
432
433/*!
434 \fn QStyleOptionFocusRect::QStyleOptionFocusRect(const QStyleOptionFocusRect &other)
435
436 Constructs a copy of the \a other style option.
437*/
438
439/*!
440 \variable QStyleOptionFocusRect::backgroundColor
441 \brief the background color on which the focus rectangle is being drawn
442
443 The default value is an invalid color with the RGB value (0, 0,
444 0). An invalid color is a color that is not properly set up for
445 the underlying window system.
446*/
447
448/*!
449 \class QStyleOptionFrame
450 \brief The QStyleOptionFrame class is used to describe the
451 parameters for drawing a frame.
452
453 QStyleOptionFrame is used for drawing several built-in Qt widgets,
454 including QFrame, QGroupBox, QLineEdit, and QMenu. Note that to
455 describe the parameters necessary for drawing a frame in Qt 4.1 or
456 above, you must use the QStyleOptionFrameV2 subclass.
457
458 An instance of the QStyleOptionFrame class has
459 \l{QStyleOption::type} {type} SO_Frame and \l{QStyleOption::version}
460 {version} 1.
461
462 The type is used internally by QStyleOption, its subclasses, and
463 qstyleoption_cast() to determine the type of style option. In
464 general you do not need to worry about this unless you want to
465 create your own QStyleOption subclass and your own styles. The
466 version is used by QStyleOption subclasses to implement extensions
467 without breaking compatibility. If you use qstyleoption_cast(),
468 you normally do not need to check it.
469
470 If you create your own QStyle subclass, you should handle both
471 QStyleOptionFrame and QStyleOptionFrameV2.
472
473 For an example demonstrating how style options can be used, see
474 the \l {widgets/styles}{Styles} example.
475
476 \sa QStyleOptionFrameV2, QStyleOption
477*/
478
479/*!
480 Constructs a QStyleOptionFrame, initializing the members
481 variables to their default values.
482*/
483
484QStyleOptionFrame::QStyleOptionFrame()
485 : QStyleOption(Version, SO_Frame), lineWidth(0), midLineWidth(0)
486{
487}
488
489/*!
490 \internal
491*/
492QStyleOptionFrame::QStyleOptionFrame(int version)
493 : QStyleOption(version, SO_Frame), lineWidth(0), midLineWidth(0)
494{
495}
496
497/*!
498 \fn QStyleOptionFrame::QStyleOptionFrame(const QStyleOptionFrame &other)
499
500 Constructs a copy of the \a other style option.
501*/
502
503/*!
504 \enum QStyleOptionFrame::StyleOptionType
505
506 This enum is used to hold information about the type of the style option, and
507 is defined for each QStyleOption subclass.
508
509 \value Type The type of style option provided (\l{SO_Frame} for this class).
510
511 The type is used internally by QStyleOption, its subclasses, and
512 qstyleoption_cast() to determine the type of style option. In
513 general you do not need to worry about this unless you want to
514 create your own QStyleOption subclass and your own styles.
515
516 \sa StyleOptionVersion
517*/
518
519/*!
520 \enum QStyleOptionFrame::StyleOptionVersion
521
522 This enum is used to hold information about the version of the style option, and
523 is defined for each QStyleOption subclass.
524
525 \value Version 1
526
527 The version is used by QStyleOption subclasses to implement
528 extensions without breaking compatibility. If you use
529 qstyleoption_cast(), you normally do not need to check it.
530
531 \sa StyleOptionType
532*/
533
534/*!
535 \variable QStyleOptionFrame::lineWidth
536 \brief the line width for drawing the frame
537
538 The default value is 0.
539
540 \sa QFrame::lineWidth
541*/
542
543/*!
544 \variable QStyleOptionFrame::midLineWidth
545 \brief the mid-line width for drawing the frame
546
547 This is usually used in drawing sunken or raised frames.
548
549 The default value is 0.
550
551 \sa QFrame::midLineWidth
552*/
553
554/*!
555 \class QStyleOptionFrameV2
556 \brief The QStyleOptionFrameV2 class is used to describe the
557 parameters necessary for drawing a frame in Qt 4.1 or above.
558
559 \since 4.1
560
561 QStyleOptionFrameV2 inherits QStyleOptionFrame which is used for
562 drawing several built-in Qt widgets, including QFrame, QGroupBox,
563 QLineEdit, and QMenu.
564
565 An instance of the QStyleOptionFrameV2 class has
566 \l{QStyleOption::type} {type} SO_Frame and
567 \l{QStyleOption::version} {version} 2. The type is used
568 internally by QStyleOption, its subclasses, and
569 qstyleoption_cast() to determine the type of style option. In
570 general you do not need to worry about this unless you want to
571 create your own QStyleOption subclass and your own styles. The
572 version is used by QStyleOption subclasses to implement extensions
573 without breaking compatibility. If you use qstyleoption_cast(),
574 you normally do not need to check it.
575
576 If you create your own QStyle subclass, you should handle both
577 QStyleOptionFrame and QStyleOptionFrameV2. One way to achieve this
578 is to use the QStyleOptionFrameV2 copy constructor. For example:
579
580 \snippet doc/src/snippets/qstyleoption/main.cpp 1
581
582 In the example above: If the \c frameOption's version is 1, \l
583 FrameFeature is set to \l None for \c frameOptionV2. If \c
584 frameOption's version is 2, the constructor will simply copy the
585 \c frameOption's \l FrameFeature value.
586
587 For an example demonstrating how style options can be used, see
588 the \l {widgets/styles}{Styles} example.
589
590 \sa QStyleOptionFrame, QStyleOption
591*/
592
593/*!
594 Constructs a QStyleOptionFrameV2 object.
595*/
596QStyleOptionFrameV2::QStyleOptionFrameV2()
597 : QStyleOptionFrame(Version), features(None)
598{
599}
600
601/*!
602 \fn QStyleOptionFrameV2::QStyleOptionFrameV2(const QStyleOptionFrameV2 &other)
603
604 Constructs a QStyleOptionFrameV2 copy of the \a other style option.
605*/
606
607/*!
608 \internal
609*/
610QStyleOptionFrameV2::QStyleOptionFrameV2(int version)
611 : QStyleOptionFrame(version), features(None)
612{
613}
614
615/*!
616 Constructs a QStyleOptionFrameV2 copy of the \a other style option
617 which can be either of the QStyleOptionFrameV2 or
618 QStyleOptionFrame types.
619
620 If the \a other style option's version is 1, the new style option's \l
621 FrameFeature value is set to \l QStyleOptionFrameV2::None. If its
622 version is 2, its \l FrameFeature value is simply copied to the
623 new style option.
624
625 \sa version
626*/
627QStyleOptionFrameV2::QStyleOptionFrameV2(const QStyleOptionFrame &other)
628{
629 QStyleOptionFrame::operator=(other);
630
631 const QStyleOptionFrameV2 *f2 = qstyleoption_cast<const QStyleOptionFrameV2 *>(&other);
632 features = f2 ? f2->features : FrameFeatures(QStyleOptionFrameV2::None);
633 version = Version;
634}
635
636/*!
637 Assigns the \a other style option to this style option. The \a
638 other style option can be either of the QStyleOptionFrameV2 or
639 QStyleOptionFrame types.
640
641 If the \a{other} style option's version is 1, this style option's
642 \l FrameFeature value is set to \l QStyleOptionFrameV2::None. If
643 its version is 2, its \l FrameFeature value is simply copied to
644 this style option.
645*/
646QStyleOptionFrameV2 &QStyleOptionFrameV2::operator=(const QStyleOptionFrame &other)
647{
648 QStyleOptionFrame::operator=(other);
649
650 const QStyleOptionFrameV2 *f2 = qstyleoption_cast<const QStyleOptionFrameV2 *>(&other);
651 features = f2 ? f2->features : FrameFeatures(QStyleOptionFrameV2::None);
652 version = Version;
653 return *this;
654}
655
656/*!
657 \enum QStyleOptionFrameV2::FrameFeature
658
659 This enum describles the different types of features a frame can have.
660
661 \value None Indicates a normal frame.
662 \value Flat Indicates a flat frame.
663*/
664
665/*!
666 \variable QStyleOptionFrameV2::features
667 \brief a bitwise OR of the features that describe this frame.
668
669 \sa FrameFeature
670*/
671
672/*!
673 \enum QStyleOptionFrameV2::StyleOptionVersion
674
675 This enum is used to hold information about the version of the
676 style option, and is defined for each QStyleOption subclass.
677
678 \value Version 2
679
680 The version is used by QStyleOption subclasses to implement
681 extensions without breaking compatibility. If you use
682 qstyleoption_cast(), you normally do not need to check it.
683
684 \sa StyleOptionType
685*/
686
687/*!
688 \class QStyleOptionFrameV3
689 \brief The QStyleOptionFrameV3 class is used to describe the
690 parameters necessary for drawing a frame in Qt 4.1 or above.
691
692 \since 4.5
693
694 QStyleOptionFrameV3 inherits QStyleOptionFrameV2
695
696 An instance of the QStyleOptionFrameV3 class has
697 \l{QStyleOption::type} {type} SO_Frame and
698 \l{QStyleOption::version} {version} 3. The type is used
699 internally by QStyleOption, its subclasses, and
700 qstyleoption_cast() to determine the type of style option. In
701 general you do not need to worry about this unless you want to
702 create your own QStyleOption subclass and your own styles. The
703 version is used by QStyleOption subclasses to implement extensions
704 without breaking compatibility. If you use qstyleoption_cast(),
705 you normally do not need to check it.
706
707 \sa QStyleOptionFrameV2, QStyleOption
708*/
709
710/*!
711 Constructs a QStyleOptionFrameV3 object.
712*/
713QStyleOptionFrameV3::QStyleOptionFrameV3()
714 : QStyleOptionFrameV2(Version), frameShape(QFrame::NoFrame)
715{
716}
717
718/*!
719 \fn QStyleOptionFrameV3::QStyleOptionFrameV3(const QStyleOptionFrameV3 &other)
720
721 Constructs a QStyleOptionFrameV3 copy of the \a other style option.
722*/
723
724/*!
725 \internal
726*/
727QStyleOptionFrameV3::QStyleOptionFrameV3(int version)
728 : QStyleOptionFrameV2(version), frameShape(QFrame::NoFrame)
729{
730}
731
732/*!
733 Constructs a QStyleOptionFrameV3 copy of the \a other style option
734 which can be either of the QStyleOptionFrameV3 or
735 QStyleOptionFrame types.
736
737 If the \a other style option's version is 1, the new style
738 option's \l FrameFeature value is set to
739 \l{QStyleOptionFrameV2::None}. If its version is 2 or lower,
740 \l{QStyleOptionFrameV3::frameShape} value is QFrame::NoFrame
741
742 \sa version
743*/
744QStyleOptionFrameV3::QStyleOptionFrameV3(const QStyleOptionFrame &other)
745{
746 operator=(other);
747}
748
749/*!
750 Assigns the \a other style option to this style option. The \a
751 other style option can be either of the QStyleOptionFrameV3,
752 QStyleOptionFrameV2 or QStyleOptionFrame types.
753
754 If the \a other style option's version is 1, the new style
755 option's \l FrameFeature value is set to
756 \l{QStyleOptionFrameV2::None}. If its version is 2 or lower,
757 \l{QStyleOptionFrameV3::frameShape} value is QFrame::NoFrame
758*/
759QStyleOptionFrameV3 &QStyleOptionFrameV3::operator=(const QStyleOptionFrame &other)
760{
761 QStyleOptionFrameV2::operator=(other);
762
763 const QStyleOptionFrameV3 *f3 = qstyleoption_cast<const QStyleOptionFrameV3 *>(&other);
764 frameShape = f3 ? f3->frameShape : QFrame::NoFrame;
765 version = Version;
766 return *this;
767}
768
769
770/*!
771 \variable QStyleOptionFrameV3::frameShape
772 \brief This property holds the frame shape value of the frame.
773
774 \sa QFrame::frameShape
775*/
776
777/*!
778 \enum QStyleOptionFrameV3::StyleOptionVersion
779
780 This enum is used to hold information about the version of the style option, and
781 is defined for each QStyleOption subclass.
782
783 \value Version 3
784
785 The version is used by QStyleOption subclasses to implement
786 extensions without breaking compatibility. If you use
787 qstyleoption_cast(), you normally do not need to check it.
788
789 \sa StyleOptionType
790*/
791
792/*!
793 \class QStyleOptionViewItemV2
794 \brief The QStyleOptionViewItemV2 class is used to describe the
795 parameters necessary for drawing a frame in Qt 4.2 or above.
796 \since 4.2
797
798 QStyleOptionViewItemV2 inherits QStyleOptionViewItem.
799
800 An instance of the QStyleOptionViewItemV2 class has
801 \l{QStyleOption::type} {type} SO_ViewItem and
802 \l{QStyleOption::version} {version} 2. The type is used internally
803 by QStyleOption, its subclasses, and qstyleoption_cast() to
804 determine the type of style option. In general you do not need to
805 worry about this unless you want to create your own QStyleOption
806 subclass and your own styles. The version is used by QStyleOption
807 subclasses to implement extensions without breaking
808 compatibility. If you use qstyleoption_cast(), you normally do not
809 need to check it.
810
811 See QStyleOptionFrameV2's detailed description for a discussion
812 of how to handle "V2" classes.
813
814 \sa QStyleOptionViewItem, QStyleOption
815*/
816
817/*!
818 \enum QStyleOptionViewItemV2::StyleOptionVersion
819
820 This enum is used to hold information about the version of the
821 style option, and is defined for each QStyleOption subclass.
822
823 \value Version 2
824
825 The version is used by QStyleOption subclasses to implement
826 extensions without breaking compatibility. If you use
827 qstyleoption_cast(), you normally do not need to check it.
828
829 \sa StyleOptionType
830*/
831
832/*!
833 \variable QStyleOptionViewItemV2::features
834 \brief a bitwise OR of the features that describe this view item
835
836 \sa ViewItemFeature
837*/
838
839/*!
840 Constructs a QStyleOptionViewItemV2 object.
841*/
842QStyleOptionViewItemV2::QStyleOptionViewItemV2()
843 : QStyleOptionViewItem(Version), features(None)
844{
845}
846
847/*!
848 \fn QStyleOptionViewItemV2::QStyleOptionViewItemV2(const QStyleOptionViewItemV2 &other)
849
850 Constructs a copy of \a other.
851*/
852
853/*!
854 Constructs a QStyleOptionViewItemV2 copy of the \a other style option
855 which can be either of the QStyleOptionViewItemV2 or
856 QStyleOptionViewItem types.
857
858 If the \a other style option's version is 1, the new style option's \l
859 ViewItemFeature value is set to \l QStyleOptionViewItemV2::None. If its
860 version is 2, its \l ViewItemFeature value is simply copied to the
861 new style option.
862
863 \sa version
864*/
865QStyleOptionViewItemV2::QStyleOptionViewItemV2(const QStyleOptionViewItem &other)
866 : QStyleOptionViewItem(Version)
867{
868 (void)QStyleOptionViewItemV2::operator=(other);
869}
870
871/*!
872 \internal
873*/
874QStyleOptionViewItemV2::QStyleOptionViewItemV2(int version)
875 : QStyleOptionViewItem(version)
876{
877
878}
879
880/*!
881 Assigns the \a other style option to this style option. The \a
882 other style option can be either of the QStyleOptionViewItemV2 or
883 QStyleOptionViewItem types.
884
885 If the \a{other} style option's version is 1, this style option's
886 \l ViewItemFeature value is set to \l QStyleOptionViewItemV2::None.
887 If its version is 2, its \l ViewItemFeature value is simply copied
888 to this style option.
889*/
890QStyleOptionViewItemV2 &QStyleOptionViewItemV2::operator=(const QStyleOptionViewItem &other)
891{
892 QStyleOptionViewItem::operator=(other);
893 const QStyleOptionViewItemV2 *v2 = qstyleoption_cast<const QStyleOptionViewItemV2 *>(&other);
894 features = v2 ? v2->features : ViewItemFeatures(QStyleOptionViewItemV2::None);
895 return *this;
896}
897
898/*!
899 \enum QStyleOptionViewItemV2::ViewItemFeature
900
901 This enum describles the different types of features an item can have.
902
903 \value None Indicates a normal item.
904 \value WrapText Indicates an item with wrapped text.
905 \value Alternate Indicates that the item's background is rendered using alternateBase.
906 \value HasCheckIndicator Indicates that the item has a check state indicator.
907 \value HasDisplay Indicates that the item has a display role.
908 \value HasDecoration Indicates that the item has a decoration role.
909*/
910
911
912
913/*!
914 \class QStyleOptionViewItemV3
915 \brief The QStyleOptionViewItemV3 class is used to describe the
916 parameters necessary for drawing a frame in Qt 4.3 or above.
917 \since 4.3
918
919 QStyleOptionViewItemV3 inherits QStyleOptionViewItem.
920
921 An instance of the QStyleOptionViewItemV3 class has
922 \l{QStyleOption::type} {type} SO_ViewItem and \l{QStyleOption::version}
923 {version} 3. The type is used internally by QStyleOption, its subclasses,
924 and qstyleoption_cast() to determine the type of style option. In general
925 you do not need to worry about this unless you want to create your own
926 QStyleOption subclass and your own styles. The version is used by
927 QStyleOption subclasses to implement extensions without breaking
928 compatibility. If you use qstyleoption_cast(), you normally do not need to
929 check it.
930
931 See QStyleOptionFrameV2's detailed description for a discussion
932 of how to handle "V2" and other versioned classes.
933
934 \sa QStyleOptionViewItem, QStyleOption
935*/
936
937/*!
938 \enum QStyleOptionViewItemV3::StyleOptionVersion
939
940 This enum is used to hold information about the version of the
941 style option, and is defined for each QStyleOption subclass.
942
943 \value Version 3
944
945 The version is used by QStyleOption subclasses to implement
946 extensions without breaking compatibility. If you use
947 qstyleoption_cast(), you normally do not need to check it.
948
949 \sa StyleOptionType
950*/
951
952/*!
953 Constructs a QStyleOptionViewItemV3 object.
954*/
955QStyleOptionViewItemV3::QStyleOptionViewItemV3()
956 : QStyleOptionViewItemV2(Version)
957{
958}
959
960/*!
961 Constructs a copy of \a other.
962*/
963QStyleOptionViewItemV3::QStyleOptionViewItemV3(const QStyleOptionViewItem &other)
964 : QStyleOptionViewItemV2(Version)
965{
966 (void)QStyleOptionViewItemV3::operator=(other);
967}
968
969/*!
970 \fn QStyleOptionViewItemV3::QStyleOptionViewItemV3(const QStyleOptionViewItemV3 &other)
971
972 Constructs a copy of \a other.
973*/
974
975/*!
976 Assigns the \a other style option to this style option. The \a
977 other style option can be an instance of the QStyleOptionViewItemV2,
978 QStyleOptionViewItemV3 or QStyleOptionViewItem types.
979*/
980QStyleOptionViewItemV3 &QStyleOptionViewItemV3::operator = (const QStyleOptionViewItem &other)
981{
982 QStyleOptionViewItemV2::operator=(other);
983 const QStyleOptionViewItemV3 *v3 = qstyleoption_cast<const QStyleOptionViewItemV3*>(&other);
984 locale = v3 ? v3->locale : QLocale();
985 widget = v3 ? v3->widget : 0;
986 return *this;
987}
988
989/*!
990 \internal
991*/
992QStyleOptionViewItemV3::QStyleOptionViewItemV3(int version)
993 : QStyleOptionViewItemV2(version)
994{
995}
996
997#ifndef QT_NO_ITEMVIEWS
998
999/*!
1000 \class QStyleOptionViewItemV4
1001 \brief The QStyleOptionViewItemV4 class is used to describe the
1002 parameters necessary for drawing a frame in Qt 4.4 or above.
1003 \since 4.4
1004
1005 QStyleOptionViewItemV4 inherits QStyleOptionViewItemV3.
1006
1007 An instance of the QStyleOptionViewItemV4 class has
1008 \l{QStyleOption::type} {type} SO_ViewItem and
1009 \l{QStyleOption::version} {version} 4. The type is used internally
1010 by QStyleOption, its subclasses, and qstyleoption_cast() to
1011 determine the type of style option. In general you do not need to
1012 worry about this unless you want to create your own QStyleOption
1013 subclass and your own styles. The version is used by QStyleOption
1014 subclasses to implement extensions without breaking
1015 compatibility. If you use qstyleoption_cast(), you normally do not
1016 need to check it.
1017
1018 See QStyleOptionViewItemV3's detailed description for a discussion
1019 of how to handle "V3" classes.
1020
1021 \sa QStyleOptionViewItem, QStyleOption
1022*/
1023
1024/*!
1025 \variable QStyleOptionViewItemV4::index
1026
1027 The model index that is to be drawn.
1028*/
1029
1030/*!
1031 \variable QStyleOptionViewItemV4::checkState
1032
1033 If this view item is checkable, i.e.,
1034 ViewItemFeature::HasCheckIndicator is true, \c checkState is true
1035 if the item is checked; otherwise, it is false.
1036
1037*/
1038
1039/*!
1040 \variable QStyleOptionViewItemV4::icon
1041
1042 The icon (if any) to be drawn in the view item.
1043*/
1044
1045
1046/*!
1047 \variable QStyleOptionViewItemV4::text
1048
1049 The text (if any) to be drawn in the view item.
1050*/
1051
1052/*!
1053 \variable QStyleOptionViewItemV4::backgroundBrush
1054
1055 The QBrush that should be used to paint the view items
1056 background.
1057*/
1058
1059/*!
1060 \variable QStyleOptionViewItemV4::viewItemPosition
1061
1062 Gives the position of this view item relative to other items. See
1063 the \l{QStyleOptionViewItemV4::}{ViewItemPosition} enum for the
1064 details.
1065*/
1066
1067/*!
1068 \enum QStyleOptionViewItemV4::StyleOptionVersion
1069
1070 This enum is used to hold information about the version of the
1071 style option, and is defined for each QStyleOption subclass.
1072
1073 \value Version 4
1074
1075 The version is used by QStyleOption subclasses to implement
1076 extensions without breaking compatibility. If you use
1077 qstyleoption_cast(), you normally do not need to check it.
1078
1079 \sa StyleOptionType
1080*/
1081
1082/*!
1083 \enum QStyleOptionViewItemV4::ViewItemPosition
1084
1085 This enum is used to represent the placement of the item on
1086 a row. This can be used to draw items differently depending
1087 on their placement, for example by putting rounded edges at
1088 the beginning and end, and straight edges in between.
1089
1090 \value Invalid The ViewItemPosition is unknown and should be
1091 disregarded.
1092 \value Beginning The item appears at the beginning of the row.
1093 \value Middle The item appears in the middle of the row.
1094 \value End The item appears at the end of the row.
1095 \value OnlyOne The item is the only one on the row, and is
1096 therefore both at the beginning and the end.
1097*/
1098
1099
1100/*!
1101 Constructs a QStyleOptionViewItemV4 object.
1102*/
1103QStyleOptionViewItemV4::QStyleOptionViewItemV4()
1104: QStyleOptionViewItemV3(Version), checkState(Qt::Unchecked), viewItemPosition(QStyleOptionViewItemV4::Invalid)
1105{
1106}
1107
1108/*!
1109 \fn QStyleOptionViewItemV4::QStyleOptionViewItemV4(const QStyleOptionViewItemV4 &other)
1110
1111 Constructs a copy of \a other.
1112*/
1113
1114/*!
1115 Constructs a QStyleOptionViewItemV4 copy of the \a other style option
1116 which can be either of the QStyleOptionViewItemV3 or
1117 QStyleOptionViewItem types.
1118
1119 \sa version
1120*/
1121QStyleOptionViewItemV4::QStyleOptionViewItemV4(const QStyleOptionViewItem &other)
1122 : QStyleOptionViewItemV3(Version)
1123{
1124 (void)QStyleOptionViewItemV4::operator=(other);
1125}
1126
1127/*!
1128 Assigns the \a other style option to this style option. The \a
1129 other style option can be either of the QStyleOptionViewItemV3 or
1130 QStyleOptionViewItem types.
1131*/
1132QStyleOptionViewItemV4 &QStyleOptionViewItemV4::operator = (const QStyleOptionViewItem &other)
1133{
1134 QStyleOptionViewItemV3::operator=(other);
1135 if (const QStyleOptionViewItemV4 *v4 = qstyleoption_cast<const QStyleOptionViewItemV4*>(&other)) {
1136 index = v4->index;
1137 checkState = v4->checkState;
1138 text = v4->text;
1139 viewItemPosition = v4->viewItemPosition;
1140 backgroundBrush = v4->backgroundBrush;
1141 icon = v4->icon;
1142 } else {
1143 viewItemPosition = QStyleOptionViewItemV4::Invalid;
1144 checkState = Qt::Unchecked;
1145 }
1146 return *this;
1147}
1148
1149/*!
1150 \internal
1151*/
1152QStyleOptionViewItemV4::QStyleOptionViewItemV4(int version)
1153 : QStyleOptionViewItemV3(version)
1154{
1155}
1156#endif // QT_NO_ITEMVIEWS
1157
1158/*!
1159 \class QStyleOptionGroupBox
1160 \brief The QStyleOptionGroupBox class describes the parameters for
1161 drawing a group box.
1162
1163 \since 4.1
1164
1165 QStyleOptionButton contains all the information that QStyle
1166 functions need the various graphical elements of a group box.
1167
1168 It holds the lineWidth and the midLineWidth for drawing the panel,
1169 the group box's \l {text}{title} and the title's \l
1170 {textAlignment}{alignment} and \l {textColor}{color}.
1171
1172 For performance reasons, the access to the member variables is
1173 direct (i.e., using the \c . or \c -> operator). This low-level feel
1174 makes the structures straightforward to use and emphasizes that
1175 these are simply parameters used by the style functions.
1176
1177 For an example demonstrating how style options can be used, see
1178 the \l {widgets/styles}{Styles} example.
1179
1180 \sa QStyleOption, QStyleOptionComplex, QGroupBox
1181*/
1182
1183/*!
1184 \enum QStyleOptionGroupBox::StyleOptionType
1185
1186 This enum is used to hold information about the type of the style option, and
1187 is defined for each QStyleOption subclass.
1188
1189 \value Type The type of style option provided (\l{SO_GroupBox} for this class).
1190
1191 The type is used internally by QStyleOption, its subclasses, and
1192 qstyleoption_cast() to determine the type of style option. In
1193 general you do not need to worry about this unless you want to
1194 create your own QStyleOption subclass and your own styles.
1195
1196 \sa StyleOptionVersion
1197*/
1198
1199/*!
1200 \enum QStyleOptionGroupBox::StyleOptionVersion
1201
1202 This enum is used to hold information about the version of the style option, and
1203 is defined for each QStyleOption subclass.
1204
1205 \value Version 1
1206
1207 The version is used by QStyleOption subclasses to implement
1208 extensions without breaking compatibility. If you use
1209 qstyleoption_cast(), you normally do not need to check it.
1210
1211 \sa StyleOptionType
1212*/
1213
1214/*!
1215 \variable QStyleOptionGroupBox::lineWidth
1216 \brief the line width for drawing the panel
1217
1218 The value of this variable is, currently, always 1.
1219
1220 \sa QFrame::lineWidth
1221*/
1222
1223/*!
1224 \variable QStyleOptionGroupBox::midLineWidth
1225 \brief the mid-line width for drawing the panel
1226
1227 The mid-line width is usually used when drawing sunken or raised
1228 group box frames. The value of this variable is, currently, always 0.
1229
1230 \sa QFrame::midLineWidth
1231*/
1232
1233/*!
1234 \variable QStyleOptionGroupBox::text
1235 \brief the text of the group box
1236
1237 The default value is an empty string.
1238
1239 \sa QGroupBox::title
1240*/
1241
1242/*!
1243 \variable QStyleOptionGroupBox::textAlignment
1244 \brief the alignment of the group box title
1245
1246 The default value is Qt::AlignLeft.
1247
1248 \sa QGroupBox::alignment
1249*/
1250
1251/*!
1252 \variable QStyleOptionGroupBox::features
1253 \brief the features of the group box frame
1254
1255 The frame is flat by default.
1256
1257 \sa QStyleOptionFrameV2::FrameFeature
1258*/
1259
1260/*!
1261 \variable QStyleOptionGroupBox::textColor
1262 \brief the color of the group box title
1263
1264 The default value is an invalid color with the RGB value (0, 0,
1265 0). An invalid color is a color that is not properly set up for
1266 the underlying window system.
1267*/
1268
1269/*!
1270 Constructs a QStyleOptionGroupBox, initializing the members
1271 variables to their default values.
1272*/
1273QStyleOptionGroupBox::QStyleOptionGroupBox()
1274 : QStyleOptionComplex(Version, Type), features(QStyleOptionFrameV2::None),
1275 textAlignment(Qt::AlignLeft), lineWidth(0), midLineWidth(0)
1276{
1277}
1278
1279/*!
1280 \fn QStyleOptionGroupBox::QStyleOptionGroupBox(const QStyleOptionGroupBox &other)
1281
1282 Constructs a copy of the \a other style option.
1283*/
1284
1285/*!
1286 \internal
1287*/
1288QStyleOptionGroupBox::QStyleOptionGroupBox(int version)
1289 : QStyleOptionComplex(version, Type), features(QStyleOptionFrameV2::None),
1290 textAlignment(Qt::AlignLeft), lineWidth(0), midLineWidth(0)
1291{
1292}
1293
1294/*!
1295 \class QStyleOptionHeader
1296 \brief The QStyleOptionHeader class is used to describe the
1297 parameters for drawing a header.
1298
1299 QStyleOptionHeader contains all the information that QStyle
1300 functions need to draw the item views' header pane, header sort
1301 arrow, and header label.
1302
1303 For performance reasons, the access to the member variables is
1304 direct (i.e., using the \c . or \c -> operator). This low-level feel
1305 makes the structures straightforward to use and emphasizes that
1306 these are simply parameters used by the style functions.
1307
1308 For an example demonstrating how style options can be used, see
1309 the \l {widgets/styles}{Styles} example.
1310
1311 \sa QStyleOption
1312*/
1313
1314/*!
1315 Constructs a QStyleOptionHeader, initializing the members
1316 variables to their default values.
1317*/
1318
1319QStyleOptionHeader::QStyleOptionHeader()
1320 : QStyleOption(QStyleOptionHeader::Version, SO_Header),
1321 section(0), textAlignment(Qt::AlignLeft), iconAlignment(Qt::AlignLeft),
1322 position(QStyleOptionHeader::Beginning),
1323 selectedPosition(QStyleOptionHeader::NotAdjacent), sortIndicator(None),
1324 orientation(Qt::Horizontal)
1325{
1326}
1327
1328/*!
1329 \internal
1330*/
1331QStyleOptionHeader::QStyleOptionHeader(int version)
1332 : QStyleOption(version, SO_Header),
1333 section(0), textAlignment(Qt::AlignLeft), iconAlignment(Qt::AlignLeft),
1334 position(QStyleOptionHeader::Beginning),
1335 selectedPosition(QStyleOptionHeader::NotAdjacent), sortIndicator(None),
1336 orientation(Qt::Horizontal)
1337{
1338}
1339
1340/*!
1341 \variable QStyleOptionHeader::orientation
1342 \brief the header's orientation (horizontal or vertical)
1343
1344 The default orientation is Qt::Horizontal
1345*/
1346
1347/*!
1348 \fn QStyleOptionHeader::QStyleOptionHeader(const QStyleOptionHeader &other)
1349
1350 Constructs a copy of the \a other style option.
1351*/
1352
1353/*!
1354 \enum QStyleOptionHeader::StyleOptionType
1355
1356 This enum is used to hold information about the type of the style option, and
1357 is defined for each QStyleOption subclass.
1358
1359 \value Type The type of style option provided (\l{SO_Header} for this class).
1360
1361 The type is used internally by QStyleOption, its subclasses, and
1362 qstyleoption_cast() to determine the type of style option. In
1363 general you do not need to worry about this unless you want to
1364 create your own QStyleOption subclass and your own styles.
1365
1366 \sa StyleOptionVersion
1367*/
1368
1369/*!
1370 \enum QStyleOptionHeader::StyleOptionVersion
1371
1372 This enum is used to hold information about the version of the style option, and
1373 is defined for each QStyleOption subclass.
1374
1375 \value Version 1
1376
1377 The version is used by QStyleOption subclasses to implement
1378 extensions without breaking compatibility. If you use
1379 qstyleoption_cast(), you normally do not need to check it.
1380
1381 \sa StyleOptionType
1382*/
1383
1384/*!
1385 \variable QStyleOptionHeader::section
1386 \brief which section of the header is being painted
1387
1388 The default value is 0.
1389*/
1390
1391/*!
1392 \variable QStyleOptionHeader::text
1393 \brief the text of the header
1394
1395 The default value is an empty string.
1396*/
1397
1398/*!
1399 \variable QStyleOptionHeader::textAlignment
1400 \brief the alignment flags for the text of the header
1401
1402 The default value is Qt::AlignLeft.
1403*/
1404
1405/*!
1406 \variable QStyleOptionHeader::icon
1407 \brief the icon of the header
1408
1409 The default value is an empty icon, i.e. an icon with neither a
1410 pixmap nor a filename.
1411*/
1412
1413/*!
1414 \variable QStyleOptionHeader::iconAlignment
1415 \brief the alignment flags for the icon of the header
1416
1417 The default value is Qt::AlignLeft.
1418*/
1419
1420/*!
1421 \variable QStyleOptionHeader::position
1422 \brief the section's position in relation to the other sections
1423
1424 The default value is QStyleOptionHeader::Beginning.
1425*/
1426
1427/*!
1428 \variable QStyleOptionHeader::selectedPosition
1429 \brief the section's position in relation to the selected section
1430
1431 The default value is QStyleOptionHeader::NotAdjacent
1432*/
1433
1434/*!
1435 \variable QStyleOptionHeader::sortIndicator
1436 \brief the direction the sort indicator should be drawn
1437
1438 The default value is QStyleOptionHeader::None.
1439*/
1440
1441/*!
1442 \enum QStyleOptionHeader::SectionPosition
1443
1444 This enum lets you know where the section's position is in relation to the other sections.
1445
1446 \value Beginning At the beginining of the header
1447 \value Middle In the middle of the header
1448 \value End At the end of the header
1449 \value OnlyOneSection Only one header section
1450
1451 \sa position
1452*/
1453
1454/*!
1455 \enum QStyleOptionHeader::SelectedPosition
1456
1457 This enum lets you know where the section's position is in relation to the selected section.
1458
1459 \value NotAdjacent Not adjacent to the selected section
1460 \value NextIsSelected The next section is selected
1461 \value PreviousIsSelected The previous section is selected
1462 \value NextAndPreviousAreSelected Both the next and previous section are selected
1463
1464 \sa selectedPosition
1465*/
1466
1467/*!
1468 \enum QStyleOptionHeader::SortIndicator
1469
1470 Indicates which direction the sort indicator should be drawn
1471
1472 \value None No sort indicator is needed
1473 \value SortUp Draw an up indicator
1474 \value SortDown Draw a down indicator
1475
1476 \sa sortIndicator
1477*/
1478
1479/*!
1480 \class QStyleOptionButton
1481 \brief The QStyleOptionButton class is used to describe the
1482 parameters for drawing buttons.
1483
1484 QStyleOptionButton contains all the information that QStyle
1485 functions need to draw graphical elements like QPushButton,
1486 QCheckBox, and QRadioButton.
1487
1488 For performance reasons, the access to the member variables is
1489 direct (i.e., using the \c . or \c -> operator). This low-level feel
1490 makes the structures straightforward to use and emphasizes that
1491 these are simply parameters used by the style functions.
1492
1493 For an example demonstrating how style options can be used, see
1494 the \l {widgets/styles}{Styles} example.
1495
1496 \sa QStyleOption, QStyleOptionToolButton
1497*/
1498
1499/*!
1500 \enum QStyleOptionButton::ButtonFeature
1501
1502 This enum describes the different types of features a push button can have.
1503
1504 \value None Indicates a normal push button.
1505 \value Flat Indicates a flat push button.
1506 \value HasMenu Indicates that the button has a drop down menu.
1507 \value DefaultButton Indicates that the button is a default button.
1508 \value AutoDefaultButton Indicates that the button is an auto default button.
1509 \value CommandLinkButton Indicates that the button is a Windows Vista type command link.
1510
1511 \sa features
1512*/
1513
1514/*!
1515 Constructs a QStyleOptionButton, initializing the members
1516 variables to their default values.
1517*/
1518
1519QStyleOptionButton::QStyleOptionButton()
1520 : QStyleOption(QStyleOptionButton::Version, SO_Button), features(None)
1521{
1522}
1523
1524/*!
1525 \internal
1526*/
1527QStyleOptionButton::QStyleOptionButton(int version)
1528 : QStyleOption(version, SO_Button), features(None)
1529{
1530}
1531
1532/*!
1533 \fn QStyleOptionButton::QStyleOptionButton(const QStyleOptionButton &other)
1534
1535 Constructs a copy of the \a other style option.
1536*/
1537
1538/*!
1539 \enum QStyleOptionButton::StyleOptionType
1540
1541 This enum is used to hold information about the type of the style option, and
1542 is defined for each QStyleOption subclass.
1543
1544 \value Type The type of style option provided (\l{SO_Button} for this class).
1545
1546 The type is used internally by QStyleOption, its subclasses, and
1547 qstyleoption_cast() to determine the type of style option. In
1548 general you do not need to worry about this unless you want to
1549 create your own QStyleOption subclass and your own styles.
1550
1551 \sa StyleOptionVersion
1552*/
1553
1554/*!
1555 \enum QStyleOptionButton::StyleOptionVersion
1556
1557 This enum is used to hold information about the version of the style option, and
1558 is defined for each QStyleOption subclass.
1559
1560 \value Version 1
1561
1562 The version is used by QStyleOption subclasses to implement
1563 extensions without breaking compatibility. If you use
1564 qstyleoption_cast(), you normally do not need to check it.
1565
1566 \sa StyleOptionType
1567*/
1568
1569/*!
1570 \variable QStyleOptionButton::features
1571 \brief a bitwise OR of the features that describe this button
1572
1573 \sa ButtonFeature
1574*/
1575
1576/*!
1577 \variable QStyleOptionButton::text
1578 \brief the text of the button
1579
1580 The default value is an empty string.
1581*/
1582
1583/*!
1584 \variable QStyleOptionButton::icon
1585 \brief the icon of the button
1586
1587 The default value is an empty icon, i.e. an icon with neither a
1588 pixmap nor a filename.
1589
1590 \sa iconSize
1591*/
1592
1593/*!
1594 \variable QStyleOptionButton::iconSize
1595 \brief the size of the icon for the button
1596
1597 The default value is QSize(-1, -1), i.e. an invalid size.
1598*/
1599
1600
1601#ifndef QT_NO_TOOLBAR
1602/*!
1603 \class QStyleOptionToolBar
1604 \brief The QStyleOptionToolBar class is used to describe the
1605 parameters for drawing a toolbar.
1606
1607 \since 4.1
1608
1609 QStyleOptionToolBar contains all the information that QStyle
1610 functions need to draw QToolBar.
1611
1612 For performance reasons, the access to the member variables is
1613 direct (i.e., using the \c . or \c -> operator). This low-level feel
1614 makes the structures straightforward to use and emphasizes that
1615 these are simply parameters used by the style functions.
1616
1617 The QStyleOptionToolBar class holds the lineWidth and the
1618 midLineWidth for drawing the widget. It also stores information
1619 about which \l {toolBarArea}{area} the toolbar should be located
1620 in, whether it is movable or not, which position the toolbar line
1621 should have (positionOfLine), and the toolbar's position within
1622 the line (positionWithinLine).
1623
1624 In addition, the class provides a couple of enums: The
1625 ToolBarFeature enum is used to describe whether a toolbar is
1626 movable or not, and the ToolBarPosition enum is used to describe
1627 the position of a toolbar line, as well as the toolbar's position
1628 within the line.
1629
1630 For an example demonstrating how style options can be used, see
1631 the \l {widgets/styles}{Styles} example.
1632
1633 \sa QStyleOption
1634*/
1635
1636/*!
1637 Constructs a QStyleOptionToolBar, initializing the members
1638 variables to their default values.
1639*/
1640
1641QStyleOptionToolBar::QStyleOptionToolBar()
1642 : QStyleOption(Version, SO_ToolBar), positionOfLine(OnlyOne), positionWithinLine(OnlyOne),
1643 toolBarArea(Qt::TopToolBarArea), features(None), lineWidth(0), midLineWidth(0)
1644{
1645}
1646
1647/*!
1648 \fn QStyleOptionToolBar::QStyleOptionToolBar(const QStyleOptionToolBar &other)
1649
1650 Constructs a copy of the \a other style option.
1651*/
1652
1653/*!
1654 \internal
1655*/
1656QStyleOptionToolBar::QStyleOptionToolBar(int version)
1657: QStyleOption(version, SO_ToolBar), positionOfLine(OnlyOne), positionWithinLine(OnlyOne),
1658 toolBarArea(Qt::TopToolBarArea), features(None), lineWidth(0), midLineWidth(0)
1659{
1660
1661}
1662
1663/*!
1664 \enum QStyleOptionToolBar::ToolBarPosition
1665
1666 \image qstyleoptiontoolbar-position.png
1667
1668 This enum is used to describe the position of a toolbar line, as
1669 well as the toolbar's position within the line.
1670
1671 The order of the positions within a line starts at the top of a
1672 vertical line, and from the left within a horizontal line. The
1673 order of the positions for the lines is always from the the
1674 parent widget's boundary edges.
1675
1676 \value Beginning The toolbar is located at the beginning of the line,
1677 or the toolbar line is the first of several lines. There can
1678 only be one toolbar (and only one line) with this position.
1679 \value Middle The toolbar is located in the middle of the line,
1680 or the toolbar line is in the middle of several lines. There can
1681 several toolbars (and lines) with this position.
1682 \value End The toolbar is located at the end of the line,
1683 or the toolbar line is the last of several lines. There can
1684 only be one toolbar (and only one line) with this position.
1685 \value OnlyOne There is only one toolbar or line. This is the default value
1686 of the positionOfLine and positionWithinLine variables.
1687
1688 \sa positionWithinLine, positionOfLine
1689*/
1690
1691/*!
1692 \enum QStyleOptionToolBar::ToolBarFeature
1693
1694 This enum is used to describe whether a toolbar is movable or not.
1695
1696 \value None The toolbar cannot be moved. The default value.
1697 \value Movable The toolbar is movable, and a handle will appear when
1698 holding the cursor over the toolbar's boundary.
1699
1700 \sa features, QToolBar::isMovable()
1701*/
1702
1703/*!
1704 \variable QStyleOptionToolBar::positionOfLine
1705
1706 This variable holds the position of the toolbar line.
1707
1708 The default value is QStyleOptionToolBar::OnlyOne.
1709*/
1710
1711/*!
1712 \variable QStyleOptionToolBar::positionWithinLine
1713
1714 This variable holds the position of the toolbar within a line.
1715
1716 The default value is QStyleOptionToolBar::OnlyOne.
1717*/
1718
1719/*!
1720 \variable QStyleOptionToolBar::toolBarArea
1721
1722 This variable holds the location for drawing the toolbar.
1723
1724 The default value is Qt::TopToolBarArea.
1725
1726 \sa Qt::ToolBarArea
1727*/
1728
1729/*!
1730 \variable QStyleOptionToolBar::features
1731
1732 This variable holds whether the toolbar is movable or not.
1733
1734 The default value is \l None.
1735*/
1736
1737/*!
1738 \variable QStyleOptionToolBar::lineWidth
1739
1740 This variable holds the line width for drawing the toolbar.
1741
1742 The default value is 0.
1743*/
1744
1745/*!
1746 \variable QStyleOptionToolBar::midLineWidth
1747
1748 This variable holds the mid-line width for drawing the toolbar.
1749
1750 The default value is 0.
1751*/
1752
1753/*!
1754 \enum QStyleOptionToolBar::StyleOptionType
1755
1756 This enum is used to hold information about the type of the style
1757 option, and is defined for each QStyleOption subclass.
1758
1759 \value Type The type of style option provided (\l{SO_ToolBar} for
1760 this class).
1761
1762 The type is used internally by QStyleOption, its subclasses, and
1763 qstyleoption_cast() to determine the type of style option. In
1764 general you do not need to worry about this unless you want to
1765 create your own QStyleOption subclass and your own styles.
1766
1767 \sa StyleOptionVersion
1768*/
1769
1770/*!
1771 \enum QStyleOptionToolBar::StyleOptionVersion
1772
1773 This enum is used to hold information about the version of the
1774 style option, and is defined for each QStyleOption subclass.
1775
1776 \value Version 1
1777
1778 The version is used by QStyleOption subclasses to implement
1779 extensions without breaking compatibility. If you use
1780 qstyleoption_cast(), you normally do not need to check it.
1781
1782 \sa StyleOptionType
1783*/
1784
1785#endif
1786
1787#ifndef QT_NO_TABBAR
1788/*!
1789 \class QStyleOptionTab
1790 \brief The QStyleOptionTab class is used to describe the
1791 parameters for drawing a tab bar.
1792
1793 The QStyleOptionTab class is used for drawing several built-in Qt
1794 widgets including \l QTabBar and the panel for \l QTabWidget. Note
1795 that to describe the parameters necessary for drawing a frame in
1796 Qt 4.1 or above, you must use the QStyleOptionFrameV2 subclass.
1797
1798 An instance of the QStyleOptiontabV2 class has
1799 \l{QStyleOption::type} {type} \l SO_Tab and
1800 \l{QStyleOption::version} {version} 1. The type is used internally
1801 by QStyleOption, its subclasses, and qstyleoption_cast() to
1802 determine the type of style option. In general you do not need to
1803 worry about this unless you want to create your own QStyleOption
1804 subclass and your own styles. The version is used by QStyleOption
1805 subclasses to implement extensions without breaking
1806 compatibility. If you use qstyleoption_cast(), you normally do not
1807 need to check it.
1808
1809 If you create your own QStyle subclass, you should handle both
1810 QStyleOptionTab and QStyleOptionTabV2.
1811
1812 For an example demonstrating how style options can be used, see
1813 the \l {widgets/styles}{Styles} example.
1814
1815 \sa QStyleOptionTabV2, QStyleOption
1816*/
1817
1818/*!
1819 Constructs a QStyleOptionTab object, initializing the members
1820 variables to their default values.
1821*/
1822
1823QStyleOptionTab::QStyleOptionTab()
1824 : QStyleOption(QStyleOptionTab::Version, SO_Tab),
1825 shape(QTabBar::RoundedNorth),
1826 row(0),
1827 position(Beginning),
1828 selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets)
1829{
1830}
1831
1832/*!
1833 \internal
1834*/
1835QStyleOptionTab::QStyleOptionTab(int version)
1836 : QStyleOption(version, SO_Tab),
1837 shape(QTabBar::RoundedNorth),
1838 row(0),
1839 position(Beginning),
1840 selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets)
1841{
1842}
1843
1844/*!
1845 \fn QStyleOptionTab::QStyleOptionTab(const QStyleOptionTab &other)
1846
1847 Constructs a copy of the \a other style option.
1848*/
1849
1850/*!
1851 \enum QStyleOptionTab::StyleOptionType
1852
1853 This enum is used to hold information about the type of the style option, and
1854 is defined for each QStyleOption subclass.
1855
1856 \value Type The type of style option provided (\l{SO_Tab} for this class).
1857
1858 The type is used internally by QStyleOption, its subclasses, and
1859 qstyleoption_cast() to determine the type of style option. In
1860 general you do not need to worry about this unless you want to
1861 create your own QStyleOption subclass and your own styles.
1862
1863 \sa StyleOptionVersion
1864*/
1865
1866/*!
1867 \enum QStyleOptionTab::StyleOptionVersion
1868
1869 This enum is used to hold information about the version of the style option, and
1870 is defined for each QStyleOption subclass.
1871
1872 \value Version 1
1873
1874 The version is used by QStyleOption subclasses to implement
1875 extensions without breaking compatibility. If you use
1876 qstyleoption_cast(), you normally do not need to check it.
1877
1878 \sa StyleOptionType
1879*/
1880
1881/*!
1882 \enum QStyleOptionTab::TabPosition
1883
1884 This enum describes the position of the tab.
1885
1886 \value Beginning The tab is the first tab in the tab bar.
1887 \value Middle The tab is neither the first nor the last tab in the tab bar.
1888 \value End The tab is the last tab in the tab bar.
1889 \value OnlyOneTab The tab is both the first and the last tab in the tab bar.
1890
1891 \sa position
1892*/
1893
1894/*!
1895 \enum QStyleOptionTab::CornerWidget
1896
1897 These flags indicate the corner widgets in a tab.
1898
1899 \value NoCornerWidgets There are no corner widgets
1900 \value LeftCornerWidget Left corner widget
1901 \value RightCornerWidget Right corner widget
1902
1903 \sa cornerWidgets
1904*/
1905
1906/*! \enum QStyleOptionTab::SelectedPosition
1907
1908 This enum describes the position of the selected tab. Some styles
1909 need to draw a tab differently depending on whether or not it is
1910 adjacent to the selected tab.
1911
1912 \value NotAdjacent The tab is not adjacent to a selected tab (or is the selected tab).
1913 \value NextIsSelected The next tab (typically the tab on the right) is selected.
1914 \value PreviousIsSelected The previous tab (typically the tab on the left) is selected.
1915
1916 \sa selectedPosition
1917*/
1918
1919/*!
1920 \variable QStyleOptionTab::selectedPosition
1921 \brief the position of the selected tab in relation to this tab
1922
1923 The default value is NotAdjacent, i.e. the tab is not adjacent to
1924 a selected tab nor is it the selected tab.
1925*/
1926
1927/*!
1928 \variable QStyleOptionTab::cornerWidgets
1929 \brief an OR combination of CornerWidget values indicating the
1930 corner widgets of the tab bar
1931
1932 The default value is NoCornerWidgets.
1933
1934 \sa CornerWidget
1935*/
1936
1937
1938/*!
1939 \variable QStyleOptionTab::shape
1940 \brief the tab shape used to draw the tab; by default
1941 QTabBar::RoundedNorth
1942
1943 \sa QTabBar::Shape
1944*/
1945
1946/*!
1947 \variable QStyleOptionTab::text
1948 \brief the text of the tab
1949
1950 The default value is an empty string.
1951*/
1952
1953/*!
1954 \variable QStyleOptionTab::icon
1955 \brief the icon for the tab
1956
1957 The default value is an empty icon, i.e. an icon with neither a
1958 pixmap nor a filename.
1959*/
1960
1961/*!
1962 \variable QStyleOptionTab::row
1963 \brief which row the tab is currently in
1964
1965 The default value is 0, indicating the front row. Currently this
1966 property can only be 0.
1967*/
1968
1969/*!
1970 \variable QStyleOptionTab::position
1971 \brief the position of the tab in the tab bar
1972
1973 The default value is \l Beginning, i.e. the tab is the first tab
1974 in the tab bar.
1975*/
1976
1977/*!
1978 \class QStyleOptionTabV2
1979 \brief The QStyleOptionTabV2 class is used to describe the
1980 parameters necessary for drawing a tabs in Qt 4.1 or above.
1981
1982 \since 4.1
1983
1984 An instance of the QStyleOptionTabV2 class has
1985 \l{QStyleOption::type} {type} \l SO_Tab and
1986 \l{QStyleOption::version} {version} 2. The type is used internally
1987 by QStyleOption, its subclasses, and qstyleoption_cast() to
1988 determine the type of style option. In general you do not need to
1989 worry about this unless you want to create your own QStyleOption
1990 subclass and your own styles. The version is used by QStyleOption
1991 subclasses to implement extensions without breaking
1992 compatibility. If you use qstyleoption_cast(), you normally do not
1993 need to check it.
1994
1995 If you create your own QStyle subclass, you should handle both
1996 QStyleOptionTab and QStyleOptionTabV2. One way to achieve this is
1997 to use the QStyleOptionTabV2 copy constructor. For example:
1998
1999 \snippet doc/src/snippets/qstyleoption/main.cpp 3
2000
2001 In the example above: If \c tabOption's version is 1, the extra
2002 member (\l iconSize) will be set to an invalid size for \c tabV2.
2003 If \c tabOption's version is 2, the constructor will simply copy
2004 the \c tab's iconSize.
2005
2006 For an example demonstrating how style options can be used, see
2007 the \l {widgets/styles}{Styles} example.
2008
2009 \sa QStyleOptionTab, QStyleOption
2010*/
2011
2012/*!
2013 \enum QStyleOptionTabV2::StyleOptionVersion
2014
2015 This enum is used to hold information about the version of the style option, and
2016 is defined for each QStyleOption subclass.
2017
2018 \value Version 2
2019
2020 The version is used by QStyleOption subclasses to implement
2021 extensions without breaking compatibility. If you use
2022 qstyleoption_cast(), you normally do not need to check it.
2023
2024 \sa StyleOptionType
2025*/
2026
2027/*!
2028 \variable QStyleOptionTabV2::iconSize
2029 \brief the size for the icons
2030
2031 The default value is QSize(-1, -1), i.e. an invalid size; use
2032 QStyle::pixelMetric() to find the default icon size for tab bars.
2033
2034 \sa QTabBar::iconSize()
2035*/
2036
2037/*!
2038 Constructs a QStyleOptionTabV2.
2039*/
2040QStyleOptionTabV2::QStyleOptionTabV2()
2041 : QStyleOptionTab(Version)
2042{
2043}
2044
2045/*!
2046 \internal
2047*/
2048QStyleOptionTabV2::QStyleOptionTabV2(int version)
2049 : QStyleOptionTab(version)
2050{
2051}
2052
2053/*!
2054 \fn QStyleOptionTabV2::QStyleOptionTabV2(const QStyleOptionTabV2 &other)
2055
2056 Constructs a copy of the \a other style option.
2057*/
2058
2059/*!
2060 Constructs a QStyleOptionTabV2 copy of the \a other style option
2061 which can be either of the QStyleOptionTabV2 or QStyleOptionTab
2062 types.
2063
2064 If the other style option's version is 1, the new style option's
2065 \c iconSize is set to an invalid value. If its version is 2, its
2066 \c iconSize value is simply copied to the new style option.
2067*/
2068QStyleOptionTabV2::QStyleOptionTabV2(const QStyleOptionTab &other)
2069 : QStyleOptionTab(Version)
2070{
2071 if (const QStyleOptionTabV2 *tab = qstyleoption_cast<const QStyleOptionTabV2 *>(&other)) {
2072 *this = *tab;
2073 } else {
2074 *((QStyleOptionTab *)this) = other;
2075 version = Version;
2076 }
2077}
2078
2079/*!
2080 Assigns the \a other style option to this QStyleOptionTabV2. The
2081 \a other style option can be either of the QStyleOptionTabV2 or
2082 QStyleOptionTab types.
2083
2084 If the other style option's version is 1, this style option's \c
2085 iconSize is set to an invalid size. If its version is 2, its \c
2086 iconSize value is simply copied to this style option.
2087*/
2088QStyleOptionTabV2 &QStyleOptionTabV2::operator=(const QStyleOptionTab &other)
2089{
2090 QStyleOptionTab::operator=(other);
2091
2092 if (const QStyleOptionTabV2 *tab = qstyleoption_cast<const QStyleOptionTabV2 *>(&other))
2093 iconSize = tab->iconSize;
2094 else
2095 iconSize = QSize();
2096 return *this;
2097}
2098
2099/*!
2100 \class QStyleOptionTabV3
2101 \brief The QStyleOptionTabV3 class is used to describe the
2102 parameters necessary for drawing a tabs in Qt 4.5 or above.
2103
2104 \since 4.5
2105
2106 An instance of the QStyleOptionTabV3 class has
2107 \l{QStyleOption::type} {type} \l SO_Tab and
2108 \l{QStyleOption::version} {version} 3. The type is used internally
2109 by QStyleOption, its subclasses, and qstyleoption_cast() to
2110 determine the type of style option. In general you do not need to
2111 worry about this unless you want to create your own QStyleOption
2112 subclass and your own styles. The version is used by QStyleOption
2113 subclasses to implement extensions without breaking
2114 compatibility. If you use qstyleoption_cast(), you normally do not
2115 need to check it.
2116
2117 If you create your own QStyle subclass, you should handle both
2118 QStyleOptionTab, QStyleOptionTabV2 and QStyleOptionTabV3.
2119 One way to achieve this is to use the QStyleOptionTabV3 copy
2120 constructor. For example:
2121
2122 \snippet doc/src/snippets/qstyleoption/main.cpp 3
2123
2124 In the example above: If \c tabOption's version is 1, the extra
2125 member (\l{QStyleOptionTabV2::iconSize}{iconSize}) will be set to
2126 an invalid size for \c tabV2. If \c tabOption's version is 2, the
2127 constructor will simply copy the \c tab's iconSize.
2128
2129 For an example demonstrating how style options can be used, see
2130 the \l {widgets/styles}{Styles} example.
2131
2132 \sa QStyleOptionTab, QStyleOption
2133*/
2134
2135/*!
2136 \enum QStyleOptionTabV3::StyleOptionVersion
2137
2138 This enum is used to hold information about the version of the style option, and
2139 is defined for each QStyleOption subclass.
2140
2141 \value Version 3
2142
2143 The version is used by QStyleOption subclasses to implement
2144 extensions without breaking compatibility. If you use
2145 qstyleoption_cast(), you normally do not need to check it.
2146
2147 \sa StyleOptionType
2148*/
2149
2150/*!
2151 \variable QStyleOptionTabV3::documentMode
2152 \brief whether the tabbar is in document mode.
2153
2154 The default value is false;
2155*/
2156
2157/*!
2158 \variable QStyleOptionTabV3::leftButtonSize
2159 \brief the size for the left widget on the tab.
2160
2161 The default value is QSize(-1, -1), i.e. an invalid size;
2162*/
2163
2164/*!
2165 \variable QStyleOptionTabV3::rightButtonSize
2166 \brief the size for the right widget on the tab.
2167
2168 The default value is QSize(-1, -1), i.e. an invalid size;
2169*/
2170
2171/*!
2172 Constructs a QStyleOptionTabV3.
2173*/
2174
2175QStyleOptionTabV3::QStyleOptionTabV3()
2176 : QStyleOptionTabV2(Version)
2177 , documentMode(false)
2178{
2179}
2180
2181/*!
2182 \internal
2183*/
2184QStyleOptionTabV3::QStyleOptionTabV3(int version)
2185 : QStyleOptionTabV2(version)
2186{
2187}
2188
2189/*!
2190 \fn QStyleOptionTabV3::QStyleOptionTabV3(const QStyleOptionTabV3 &other)
2191
2192 Constructs a copy of the \a other style option.
2193*/
2194
2195/*!
2196 \fn QStyleOptionTabV3::QStyleOptionTabV3(const QStyleOptionTabV2 &other)
2197
2198 Constructs a copy of the \a other style option.
2199*/
2200
2201/*!
2202 Constructs a QStyleOptionTabV3 copy of the \a other style option
2203 which can be either of the QStyleOptionTabV3, QStyleOptionTabV2
2204 or QStyleOptionTab types.
2205
2206 If the other style option's version is 1 or 2, the new style option's
2207 \c leftButtonSize and \c rightButtonSize is set to an invalid value. If
2208 its version is 3, its \c leftButtonSize and \c rightButtonSize values
2209 are simply copied to the new style option.
2210*/
2211QStyleOptionTabV3::QStyleOptionTabV3(const QStyleOptionTab &other)
2212 : QStyleOptionTabV2(Version)
2213{
2214 if (const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(&other)) {
2215 *this = *tab;
2216 } else {
2217 *((QStyleOptionTabV2 *)this) = other;
2218 version = Version;
2219 }
2220}
2221
2222/*!
2223 Assigns the \a other style option to this QStyleOptionTabV3. The
2224 \a other style option can be either of the QStyleOptionTabV3,
2225 QStyleOptionTabV2 or QStyleOptionTab types.
2226
2227 If the other style option's version is 1 or 2, the new style option's
2228 \c leftButtonSize and \c rightButtonSize is set to an invalid value. If
2229 its version is 3, its \c leftButtonSize and \c rightButtonSize values
2230 are simply copied to the new style option.
2231*/
2232QStyleOptionTabV3 &QStyleOptionTabV3::operator=(const QStyleOptionTab &other)
2233{
2234 QStyleOptionTabV2::operator=(other);
2235
2236 if (const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(&other)) {
2237 leftButtonSize = tab->leftButtonSize;
2238 rightButtonSize = tab->rightButtonSize;
2239 } else {
2240 leftButtonSize = QSize();
2241 rightButtonSize = QSize();
2242 documentMode = false;
2243 }
2244 return *this;
2245}
2246
2247#endif // QT_NO_TABBAR
2248
2249/*!
2250 \class QStyleOptionProgressBar
2251 \brief The QStyleOptionProgressBar class is used to describe the
2252 parameters necessary for drawing a progress bar.
2253
2254 Since Qt 4.1, Qt uses the QStyleOptionProgressBarV2 subclass for
2255 drawing QProgressBar.
2256
2257 An instance of the QStyleOptionProgressBar class has type
2258 SO_ProgressBar and version 1.
2259
2260 The type is used internally by QStyleOption, its subclasses, and
2261 qstyleoption_cast() to determine the type of style option. In
2262 general you do not need to worry about this unless you want to
2263 create your own QStyleOption subclass and your own styles. The
2264 version is used by QStyleOption subclasses to implement extensions
2265 without breaking compatibility. If you use qstyleoption_cast(),
2266 you normally do not need to check it.
2267
2268 If you create your own QStyle subclass, you should handle both
2269 QStyleOptionProgressBar and QStyleOptionProgressBarV2.
2270
2271 For an example demonstrating how style options can be used, see
2272 the \l {widgets/styles}{Styles} example.
2273
2274 \sa QStyleOptionProgressBarV2, QStyleOption
2275*/
2276
2277/*!
2278 Constructs a QStyleOptionProgressBar, initializing the members
2279 variables to their default values.
2280*/
2281
2282QStyleOptionProgressBar::QStyleOptionProgressBar()
2283 : QStyleOption(QStyleOptionProgressBar::Version, SO_ProgressBar),
2284 minimum(0), maximum(0), progress(0), textAlignment(Qt::AlignLeft), textVisible(false)
2285{
2286}
2287
2288/*!
2289 \internal
2290*/
2291QStyleOptionProgressBar::QStyleOptionProgressBar(int version)
2292 : QStyleOption(version, SO_ProgressBar),
2293 minimum(0), maximum(0), progress(0), textAlignment(Qt::AlignLeft), textVisible(false)
2294{
2295}
2296
2297/*!
2298 \fn QStyleOptionProgressBar::QStyleOptionProgressBar(const QStyleOptionProgressBar &other)
2299
2300 Constructs a copy of the \a other style option.
2301*/
2302
2303/*!
2304 \enum QStyleOptionProgressBar::StyleOptionType
2305
2306 This enum is used to hold information about the type of the style option, and
2307 is defined for each QStyleOption subclass.
2308
2309 \value Type The type of style option provided (\l{SO_ProgressBar} for this class).
2310
2311 The type is used internally by QStyleOption, its subclasses, and
2312 qstyleoption_cast() to determine the type of style option. In
2313 general you do not need to worry about this unless you want to
2314 create your own QStyleOption subclass and your own styles.
2315
2316 \sa StyleOptionVersion
2317*/
2318
2319/*!
2320 \enum QStyleOptionProgressBar::StyleOptionVersion
2321
2322 This enum is used to hold information about the version of the style option, and
2323 is defined for each QStyleOption subclass.
2324
2325 \value Version 1
2326
2327 The version is used by QStyleOption subclasses to implement
2328 extensions without breaking compatibility. If you use
2329 qstyleoption_cast(), you normally do not need to check it.
2330
2331 \sa StyleOptionType
2332*/
2333
2334/*!
2335 \variable QStyleOptionProgressBar::minimum
2336 \brief the minimum value for the progress bar
2337
2338 This is the minimum value in the progress bar. The default value
2339 is 0.
2340
2341 \sa QProgressBar::minimum
2342*/
2343
2344/*!
2345 \variable QStyleOptionProgressBar::maximum
2346 \brief the maximum value for the progress bar
2347
2348 This is the maximum value in the progress bar. The default value
2349 is 0.
2350
2351 \sa QProgressBar::maximum
2352*/
2353
2354/*!
2355 \variable QStyleOptionProgressBar::text
2356 \brief the text for the progress bar
2357
2358 The progress bar text is usually just the progress expressed as a
2359 string. An empty string indicates that the progress bar has not
2360 started yet. The default value is an empty string.
2361
2362 \sa QProgressBar::text
2363*/
2364
2365/*!
2366 \variable QStyleOptionProgressBar::textVisible
2367 \brief a flag indicating whether or not text is visible
2368
2369 If this flag is true then the text is visible. Otherwise, the text
2370 is not visible. The default value is false.
2371
2372 \sa QProgressBar::textVisible
2373*/
2374
2375
2376/*!
2377 \variable QStyleOptionProgressBar::textAlignment
2378 \brief the text alignment for the text in the QProgressBar
2379
2380 This can be used as a guide on where the text should be in the
2381 progress bar. The default value is Qt::AlignLeft.
2382*/
2383
2384/*!
2385 \variable QStyleOptionProgressBar::progress
2386 \brief the current progress for the progress bar
2387
2388 The current progress. A value of QStyleOptionProgressBar::minimum
2389 - 1 indicates that the progress hasn't started yet. The default
2390 value is 0.
2391
2392 \sa QProgressBar::value
2393*/
2394
2395/*!
2396 \class QStyleOptionProgressBarV2
2397 \brief The QStyleOptionProgressBarV2 class is used to describe the
2398 parameters necessary for drawing a progress bar in Qt 4.1 or above.
2399
2400 \since 4.1
2401
2402 An instance of this class has \l{QStyleOption::type} {type}
2403 SO_ProgressBar and \l{QStyleOption::version} {version} 2.
2404
2405 The type is used internally by QStyleOption, its subclasses, and
2406 qstyleoption_cast() to determine the type of style option. In
2407 general you do not need to worry about this unless you want to
2408 create your own QStyleOption subclass and your own styles. The
2409 version is used by QStyleOption subclasses to implement extensions
2410 without breaking compatibility. If you use qstyleoption_cast(),
2411 you normally do not need to check it.
2412
2413 If you create your own QStyle subclass, you should handle both
2414 QStyleOptionProgressBar and QStyleOptionProgressBarV2. One way
2415 to achieve this is to use the QStyleOptionProgressBarV2 copy
2416 constructor. For example:
2417
2418 \snippet doc/src/snippets/qstyleoption/main.cpp 2
2419
2420 In the example above: If the \c progressBarOption's version is 1,
2421 the extra members (\l orientation, \l invertedAppearance, and \l
2422 bottomToTop) are set to default values for \c progressBarV2. If
2423 the \c progressBarOption's version is 2, the constructor will
2424 simply copy the extra members to progressBarV2.
2425
2426 For an example demonstrating how style options can be used, see
2427 the \l {widgets/styles}{Styles} example.
2428
2429 \sa QStyleOptionProgressBar, QStyleOption
2430*/
2431
2432/*!
2433 Constructs a QStyleOptionProgressBarV2, initializing he members
2434 variables to their default values.
2435*/
2436
2437QStyleOptionProgressBarV2::QStyleOptionProgressBarV2()
2438 : QStyleOptionProgressBar(2),
2439 orientation(Qt::Horizontal), invertedAppearance(false), bottomToTop(false)
2440{
2441}
2442
2443/*!
2444 \internal
2445*/
2446QStyleOptionProgressBarV2::QStyleOptionProgressBarV2(int version)
2447 : QStyleOptionProgressBar(version),
2448 orientation(Qt::Horizontal), invertedAppearance(false), bottomToTop(false)
2449{
2450}
2451
2452/*!
2453 Constructs a copy of the \a other style option which can be either
2454 of the QStyleOptionProgressBar and QStyleOptionProgressBarV2
2455 types.
2456
2457 If the \a{other} style option's version is 1, the extra members (\l
2458 orientation, \l invertedAppearance, and \l bottomToTop) are set
2459 to default values for the new style option. If \a{other}'s version
2460 is 2, the extra members are simply copied.
2461
2462 \sa version
2463*/
2464QStyleOptionProgressBarV2::QStyleOptionProgressBarV2(const QStyleOptionProgressBar &other)
2465 : QStyleOptionProgressBar(2), orientation(Qt::Horizontal), invertedAppearance(false), bottomToTop(false)
2466{
2467 const QStyleOptionProgressBarV2 *pb2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(&other);
2468 if (pb2)
2469 *this = *pb2;
2470 else
2471 *((QStyleOptionProgressBar *)this) = other;
2472}
2473
2474/*!
2475 Constructs a copy of the \a other style option.
2476*/
2477QStyleOptionProgressBarV2::QStyleOptionProgressBarV2(const QStyleOptionProgressBarV2 &other)
2478 : QStyleOptionProgressBar(2), orientation(Qt::Horizontal), invertedAppearance(false), bottomToTop(false)
2479{
2480 *this = other;
2481}
2482
2483/*!
2484 Assigns the \a other style option to this style option. The \a
2485 other style option can be either of the QStyleOptionProgressBarV2
2486 or QStyleOptionProgressBar types.
2487
2488 If the \a{other} style option's version is 1, the extra members
2489 (\l orientation, \l invertedAppearance, and \l bottomToTop) are
2490 set to default values for this style option. If \a{other}'s
2491 version is 2, the extra members are simply copied to this style
2492 option.
2493*/
2494QStyleOptionProgressBarV2 &QStyleOptionProgressBarV2::operator=(const QStyleOptionProgressBar &other)
2495{
2496 QStyleOptionProgressBar::operator=(other);
2497
2498 const QStyleOptionProgressBarV2 *pb2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(&other);
2499 orientation = pb2 ? pb2->orientation : Qt::Horizontal;
2500 invertedAppearance = pb2 ? pb2->invertedAppearance : false;
2501 bottomToTop = pb2 ? pb2->bottomToTop : false;
2502 return *this;
2503}
2504
2505/*!
2506 \variable QStyleOptionProgressBarV2::orientation
2507 \brief the progress bar's orientation (horizontal or vertical);
2508 the default orentation is Qt::Horizontal
2509
2510 \sa QProgressBar::orientation
2511*/
2512
2513/*!
2514 \variable QStyleOptionProgressBarV2::invertedAppearance
2515 \brief whether the progress bar's appearance is inverted
2516
2517 The default value is false.
2518
2519 \sa QProgressBar::invertedAppearance
2520*/
2521
2522/*!
2523 \variable QStyleOptionProgressBarV2::bottomToTop
2524 \brief whether the text reads from bottom to top when the progress
2525 bar is vertical
2526
2527 The default value is false.
2528
2529 \sa QProgressBar::textDirection
2530*/
2531
2532/*!
2533 \enum QStyleOptionProgressBarV2::StyleOptionType
2534
2535 This enum is used to hold information about the type of the style option, and
2536 is defined for each QStyleOption subclass.
2537
2538 \value Type The type of style option provided (\l{SO_ProgressBar} for this class).
2539
2540 The type is used internally by QStyleOption, its subclasses, and
2541 qstyleoption_cast() to determine the type of style option. In
2542 general you do not need to worry about this unless you want to
2543 create your own QStyleOption subclass and your own styles.
2544
2545 \sa StyleOptionVersion
2546*/
2547
2548/*!
2549 \enum QStyleOptionProgressBarV2::StyleOptionVersion
2550
2551 This enum is used to hold information about the version of the style option, and
2552 is defined for each QStyleOption subclass.
2553
2554 \value Version 2
2555
2556 The version is used by QStyleOption subclasses to implement
2557 extensions without breaking compatibility. If you use
2558 qstyleoption_cast(), you normally do not need to check it.
2559
2560 \sa StyleOptionType
2561*/
2562
2563
2564/*!
2565 \class QStyleOptionMenuItem
2566 \brief The QStyleOptionMenuItem class is used to describe the
2567 parameter necessary for drawing a menu item.
2568
2569 QStyleOptionMenuItem contains all the information that QStyle
2570 functions need to draw the menu items from \l QMenu. It is also
2571 used for drawing other menu-related widgets.
2572
2573 For performance reasons, the access to the member variables is
2574 direct (i.e., using the \c . or \c -> operator). This low-level feel
2575 makes the structures straightforward to use and emphasizes that
2576 these are simply parameters used by the style functions.
2577
2578 For an example demonstrating how style options can be used, see
2579 the \l {widgets/styles}{Styles} example.
2580
2581 \sa QStyleOption
2582*/
2583
2584/*!
2585 Constructs a QStyleOptionMenuItem, initializing the members
2586 variables to their default values.
2587*/
2588
2589QStyleOptionMenuItem::QStyleOptionMenuItem()
2590 : QStyleOption(QStyleOptionMenuItem::Version, SO_MenuItem), menuItemType(Normal),
2591 checkType(NotCheckable), checked(false), menuHasCheckableItems(true), maxIconWidth(0), tabWidth(0)
2592{
2593}
2594
2595/*!
2596 \internal
2597*/
2598QStyleOptionMenuItem::QStyleOptionMenuItem(int version)
2599 : QStyleOption(version, SO_MenuItem), menuItemType(Normal),
2600 checkType(NotCheckable), checked(false), menuHasCheckableItems(true), maxIconWidth(0), tabWidth(0)
2601{
2602}
2603
2604/*!
2605 \fn QStyleOptionMenuItem::QStyleOptionMenuItem(const QStyleOptionMenuItem &other)
2606
2607 Constructs a copy of the \a other style option.
2608*/
2609
2610/*!
2611 \enum QStyleOptionMenuItem::StyleOptionType
2612
2613 This enum is used to hold information about the type of the style option, and
2614 is defined for each QStyleOption subclass.
2615
2616 \value Type The type of style option provided (\l{SO_MenuItem} for this class).
2617
2618 The type is used internally by QStyleOption, its subclasses, and
2619 qstyleoption_cast() to determine the type of style option. In
2620 general you do not need to worry about this unless you want to
2621 create your own QStyleOption subclass and your own styles.
2622
2623 \sa StyleOptionVersion
2624*/
2625
2626/*!
2627 \enum QStyleOptionMenuItem::StyleOptionVersion
2628
2629 This enum is used to hold information about the version of the style option, and
2630 is defined for each QStyleOption subclass.
2631
2632 \value Version 1
2633
2634 The version is used by QStyleOption subclasses to implement
2635 extensions without breaking compatibility. If you use
2636 qstyleoption_cast(), you normally do not need to check it.
2637
2638 \sa StyleOptionType
2639*/
2640
2641/*!
2642 \enum QStyleOptionMenuItem::MenuItemType
2643
2644 This enum indicates the type of menu item that the structure describes.
2645
2646 \value Normal A normal menu item.
2647 \value DefaultItem A menu item that is the default action as specified with \l QMenu::defaultAction().
2648 \value Separator A menu separator.
2649 \value SubMenu Indicates the menu item points to a sub-menu.
2650 \value Scroller A popup menu scroller (currently only used on Mac OS X).
2651 \value TearOff A tear-off handle for the menu.
2652 \value Margin The margin of the menu.
2653 \value EmptyArea The empty area of the menu.
2654
2655 \sa menuItemType
2656*/
2657
2658/*!
2659 \enum QStyleOptionMenuItem::CheckType
2660
2661 This enum is used to indicate whether or not a check mark should be
2662 drawn for the item, or even if it should be drawn at all.
2663
2664 \value NotCheckable The item is not checkable.
2665 \value Exclusive The item is an exclusive check item (like a radio button).
2666 \value NonExclusive The item is a non-exclusive check item (like a check box).
2667
2668 \sa checkType, QAction::checkable, QAction::checked, QActionGroup::exclusive
2669*/
2670
2671/*!
2672 \variable QStyleOptionMenuItem::menuItemType
2673 \brief the type of menu item
2674
2675 The default value is \l Normal.
2676
2677 \sa MenuItemType
2678*/
2679
2680/*!
2681 \variable QStyleOptionMenuItem::checkType
2682 \brief the type of checkmark of the menu item
2683
2684 The default value is \l NotCheckable.
2685
2686 \sa CheckType
2687*/
2688
2689/*!
2690 \variable QStyleOptionMenuItem::checked
2691 \brief whether the menu item is checked or not
2692
2693 The default value is false.
2694*/
2695
2696/*!
2697 \variable QStyleOptionMenuItem::menuHasCheckableItems
2698 \brief whether the menu as a whole has checkable items or not
2699
2700 The default value is true.
2701
2702 If this option is set to false, then the menu has no checkable
2703 items. This makes it possible for GUI styles to save some
2704 horizontal space that would normally be used for the check column.
2705*/
2706
2707/*!
2708 \variable QStyleOptionMenuItem::menuRect
2709 \brief the rectangle for the entire menu
2710
2711 The default value is a null rectangle, i.e. a rectangle with both
2712 the width and the height set to 0.
2713*/
2714
2715/*!
2716 \variable QStyleOptionMenuItem::text
2717 \brief the text for the menu item
2718
2719 Note that the text format is something like this "Menu
2720 text\bold{\\t}Shortcut".
2721
2722 If the menu item doesn't have a shortcut, it will just contain the
2723 menu item's text. The default value is an empty string.
2724*/
2725
2726/*!
2727 \variable QStyleOptionMenuItem::icon
2728 \brief the icon for the menu item
2729
2730 The default value is an empty icon, i.e. an icon with neither a
2731 pixmap nor a filename.
2732*/
2733
2734/*!
2735 \variable QStyleOptionMenuItem::maxIconWidth
2736 \brief the maximum icon width for the icon in the menu item
2737
2738 This can be used for drawing the icon into the correct place or
2739 properly aligning items. The variable must be set regardless of
2740 whether or not the menu item has an icon. The default value is 0.
2741*/
2742
2743/*!
2744 \variable QStyleOptionMenuItem::tabWidth
2745 \brief the tab width for the menu item
2746
2747 The tab width is the distance between the text of the menu item
2748 and the shortcut. The default value is 0.
2749*/
2750
2751
2752/*!
2753 \variable QStyleOptionMenuItem::font
2754 \brief the font used for the menu item text
2755
2756 This is the font that should be used for drawing the menu text
2757 minus the shortcut. The shortcut is usually drawn using the
2758 painter's font. By default, the application's default font is
2759 used.
2760*/
2761
2762/*!
2763 \class QStyleOptionComplex
2764 \brief The QStyleOptionComplex class is used to hold parameters that are
2765 common to all complex controls.
2766
2767 This class is not used on its own. Instead it is used to derive
2768 other complex control options, for example QStyleOptionSlider and
2769 QStyleOptionSpinBox.
2770
2771 For performance reasons, the access to the member variables is
2772 direct (i.e., using the \c . or \c -> operator).
2773
2774 For an example demonstrating how style options can be used, see
2775 the \l {widgets/styles}{Styles} example.
2776
2777 \sa QStyleOption
2778*/
2779
2780/*!
2781 Constructs a QStyleOptionComplex of the specified \a type and \a
2782 version, initializing the member variables to their default
2783 values. This constructor is usually called by subclasses.
2784*/
2785
2786QStyleOptionComplex::QStyleOptionComplex(int version, int type)
2787 : QStyleOption(version, type), subControls(QStyle::SC_All), activeSubControls(QStyle::SC_None)
2788{
2789}
2790
2791/*!
2792 \fn QStyleOptionComplex::QStyleOptionComplex(const QStyleOptionComplex &other)
2793
2794 Constructs a copy of the \a other style option.
2795*/
2796
2797/*!
2798 \enum QStyleOptionComplex::StyleOptionType
2799
2800 This enum is used to hold information about the type of the style option, and
2801 is defined for each QStyleOption subclass.
2802
2803 \value Type The type of style option provided (\l{SO_Complex} for this class).
2804
2805 The type is used internally by QStyleOption, its subclasses, and
2806 qstyleoption_cast() to determine the type of style option. In
2807 general you do not need to worry about this unless you want to
2808 create your own QStyleOption subclass and your own styles.
2809
2810 \sa StyleOptionVersion
2811*/
2812
2813/*!
2814 \enum QStyleOptionComplex::StyleOptionVersion
2815
2816 This enum is used to hold information about the version of the style option, and
2817 is defined for each QStyleOption subclass.
2818
2819 \value Version 1
2820
2821 The version is used by QStyleOption subclasses to implement
2822 extensions without breaking compatibility. If you use
2823 qstyleoption_cast(), you normally do not need to check it.
2824
2825 \sa StyleOptionType
2826*/
2827
2828/*!
2829 \variable QStyleOptionComplex::subControls
2830 \brief a bitwise OR of the various sub-controls that need to be
2831 drawn for the complex control
2832
2833 The default value is QStyle::SC_All.
2834
2835 \sa QStyle::SubControl
2836*/
2837
2838/*!
2839 \variable QStyleOptionComplex::activeSubControls
2840 \brief a bitwise OR of the various sub-controls that are active
2841 (pressed) for the complex control
2842
2843 The default value is QStyle::SC_None.
2844
2845 \sa QStyle::SubControl
2846*/
2847
2848#ifndef QT_NO_SLIDER
2849/*!
2850 \class QStyleOptionSlider
2851 \brief The QStyleOptionSlider class is used to describe the
2852 parameters needed for drawing a slider.
2853
2854 QStyleOptionSlider contains all the information that QStyle
2855 functions need to draw QSlider and QScrollBar.
2856
2857 For performance reasons, the access to the member variables is
2858 direct (i.e., using the \c . or \c -> operator). This low-level feel
2859 makes the structures straightforward to use and emphasizes that
2860 these are simply parameters used by the style functions.
2861
2862 For an example demonstrating how style options can be used, see
2863 the \l {widgets/styles}{Styles} example.
2864
2865 \sa QStyleOptionComplex, QSlider, QScrollBar
2866*/
2867
2868/*!
2869 Constructs a QStyleOptionSlider, initializing the members
2870 variables to their default values.
2871*/
2872
2873QStyleOptionSlider::QStyleOptionSlider()
2874 : QStyleOptionComplex(Version, SO_Slider), orientation(Qt::Horizontal), minimum(0), maximum(0),
2875 tickPosition(QSlider::NoTicks), tickInterval(0), upsideDown(false),
2876 sliderPosition(0), sliderValue(0), singleStep(0), pageStep(0), notchTarget(0.0),
2877 dialWrapping(false)
2878{
2879}
2880
2881/*!
2882 \internal
2883*/
2884QStyleOptionSlider::QStyleOptionSlider(int version)
2885 : QStyleOptionComplex(version, SO_Slider), orientation(Qt::Horizontal), minimum(0), maximum(0),
2886 tickPosition(QSlider::NoTicks), tickInterval(0), upsideDown(false),
2887 sliderPosition(0), sliderValue(0), singleStep(0), pageStep(0), notchTarget(0.0),
2888 dialWrapping(false)
2889{
2890}
2891
2892/*!
2893 \fn QStyleOptionSlider::QStyleOptionSlider(const QStyleOptionSlider &other)
2894
2895 Constructs a copy of the \a other style option.
2896*/
2897
2898/*!
2899 \enum QStyleOptionSlider::StyleOptionType
2900
2901 This enum is used to hold information about the type of the style option, and
2902 is defined for each QStyleOption subclass.
2903
2904 \value Type The type of style option provided (\l{SO_Slider} for this class).
2905
2906 The type is used internally by QStyleOption, its subclasses, and
2907 qstyleoption_cast() to determine the type of style option. In
2908 general you do not need to worry about this unless you want to
2909 create your own QStyleOption subclass and your own styles.
2910
2911 \sa StyleOptionVersion
2912*/
2913
2914/*!
2915 \enum QStyleOptionSlider::StyleOptionVersion
2916
2917 This enum is used to hold information about the version of the style option, and
2918 is defined for each QStyleOption subclass.
2919
2920 \value Version 1
2921
2922 The version is used by QStyleOption subclasses to implement
2923 extensions without breaking compatibility. If you use
2924 qstyleoption_cast(), you normally do not need to check it.
2925
2926 \sa StyleOptionType
2927*/
2928
2929/*!
2930 \variable QStyleOptionSlider::orientation
2931 \brief the slider's orientation (horizontal or vertical)
2932
2933 The default orientation is Qt::Horizontal.
2934
2935 \sa Qt::Orientation
2936*/
2937
2938/*!
2939 \variable QStyleOptionSlider::minimum
2940 \brief the minimum value for the slider
2941
2942 The default value is 0.
2943*/
2944
2945/*!
2946 \variable QStyleOptionSlider::maximum
2947 \brief the maximum value for the slider
2948
2949 The default value is 0.
2950*/
2951
2952/*!
2953 \variable QStyleOptionSlider::tickPosition
2954 \brief the position of the slider's tick marks, if any
2955
2956 The default value is QSlider::NoTicks.
2957
2958 \sa QSlider::TickPosition
2959*/
2960
2961/*!
2962 \variable QStyleOptionSlider::tickInterval
2963 \brief the interval that should be drawn between tick marks
2964
2965 The default value is 0.
2966*/
2967
2968/*!
2969 \variable QStyleOptionSlider::notchTarget
2970 \brief the number of pixel between notches
2971
2972 The default value is 0.0.
2973
2974 \sa QDial::notchTarget()
2975*/
2976
2977/*!
2978 \variable QStyleOptionSlider::dialWrapping
2979 \brief whether the dial should wrap or not
2980
2981 The default value is false, i.e. the dial is not wrapped.
2982
2983 \sa QDial::wrapping()
2984*/
2985
2986/*!
2987 \variable QStyleOptionSlider::upsideDown
2988 \brief the slider control orientation
2989
2990 Normally a slider increases as it moves up or to the right;
2991 upsideDown indicates that it should do the opposite (increase as
2992 it moves down or to the left). The default value is false,
2993 i.e. the slider increases as it moves up or to the right.
2994
2995 \sa QStyle::sliderPositionFromValue(),
2996 QStyle::sliderValueFromPosition(),
2997 QAbstractSlider::invertedAppearance
2998*/
2999
3000/*!
3001 \variable QStyleOptionSlider::sliderPosition
3002 \brief the position of the slider handle
3003
3004 If the slider has active feedback (i.e.,
3005 QAbstractSlider::tracking is true), this value will be the same as
3006 \l sliderValue. Otherwise, it will have the current position of
3007 the handle. The default value is 0.
3008
3009 \sa QAbstractSlider::tracking, sliderValue
3010*/
3011
3012/*!
3013 \variable QStyleOptionSlider::sliderValue
3014 \brief the value of the slider
3015
3016 If the slider has active feedback (i.e.,
3017 QAbstractSlider::tracking is true), this value will be the same
3018 as \l sliderPosition. Otherwise, it will have the value the
3019 slider had before the mouse was pressed.
3020
3021 The default value is 0.
3022
3023 \sa QAbstractSlider::tracking sliderPosition
3024*/
3025
3026/*!
3027 \variable QStyleOptionSlider::singleStep
3028 \brief the size of the single step of the slider
3029
3030 The default value is 0.
3031
3032 \sa QAbstractSlider::singleStep
3033*/
3034
3035/*!
3036 \variable QStyleOptionSlider::pageStep
3037 \brief the size of the page step of the slider
3038
3039 The default value is 0.
3040
3041 \sa QAbstractSlider::pageStep
3042*/
3043#endif // QT_NO_SLIDER
3044
3045#ifndef QT_NO_SPINBOX
3046/*!
3047 \class QStyleOptionSpinBox
3048 \brief The QStyleOptionSpinBox class is used to describe the
3049 parameters necessary for drawing a spin box.
3050
3051 QStyleOptionSpinBox contains all the information that QStyle
3052 functions need to draw QSpinBox and QDateTimeEdit.
3053
3054 For performance reasons, the access to the member variables is
3055 direct (i.e., using the \c . or \c -> operator). This low-level feel
3056 makes the structures straightforward to use and emphasizes that
3057 these are simply parameters used by the style functions.
3058
3059 For an example demonstrating how style options can be used, see
3060 the \l {widgets/styles}{Styles} example.
3061
3062 \sa QStyleOption, QStyleOptionComplex
3063*/
3064
3065/*!
3066 Constructs a QStyleOptionSpinBox, initializing the members
3067 variables to their default values.
3068*/
3069
3070QStyleOptionSpinBox::QStyleOptionSpinBox()
3071 : QStyleOptionComplex(Version, SO_SpinBox), buttonSymbols(QAbstractSpinBox::UpDownArrows),
3072 stepEnabled(QAbstractSpinBox::StepNone), frame(false)
3073{
3074}
3075
3076/*!
3077 \internal
3078*/
3079QStyleOptionSpinBox::QStyleOptionSpinBox(int version)
3080 : QStyleOptionComplex(version, SO_SpinBox), buttonSymbols(QAbstractSpinBox::UpDownArrows),
3081 stepEnabled(QAbstractSpinBox::StepNone), frame(false)
3082{
3083}
3084
3085/*!
3086 \fn QStyleOptionSpinBox::QStyleOptionSpinBox(const QStyleOptionSpinBox &other)
3087
3088 Constructs a copy of the \a other style option.
3089*/
3090
3091/*!
3092 \enum QStyleOptionSpinBox::StyleOptionType
3093
3094 This enum is used to hold information about the type of the style option, and
3095 is defined for each QStyleOption subclass.
3096
3097 \value Type The type of style option provided (\l{SO_SpinBox} for this class).
3098
3099 The type is used internally by QStyleOption, its subclasses, and
3100 qstyleoption_cast() to determine the type of style option. In
3101 general you do not need to worry about this unless you want to
3102 create your own QStyleOption subclass and your own styles.
3103
3104 \sa StyleOptionVersion
3105*/
3106
3107/*!
3108 \enum QStyleOptionSpinBox::StyleOptionVersion
3109
3110 This enum is used to hold information about the version of the style option, and
3111 is defined for each QStyleOption subclass.
3112
3113 \value Version 1
3114
3115 The version is used by QStyleOption subclasses to implement
3116 extensions without breaking compatibility. If you use
3117 qstyleoption_cast(), you normally do not need to check it.
3118
3119 \sa StyleOptionType
3120*/
3121
3122/*!
3123 \variable QStyleOptionSpinBox::buttonSymbols
3124 \brief the type of button symbols to draw for the spin box
3125
3126 The default value is QAbstractSpinBox::UpDownArrows specufying
3127 little arrows in the classic style.
3128
3129 \sa QAbstractSpinBox::ButtonSymbols
3130*/
3131
3132/*!
3133 \variable QStyleOptionSpinBox::stepEnabled
3134 \brief which buttons of the spin box that are enabled
3135
3136 The default value is QAbstractSpinBox::StepNone.
3137
3138 \sa QAbstractSpinBox::StepEnabled
3139*/
3140
3141/*!
3142 \variable QStyleOptionSpinBox::frame
3143 \brief whether the spin box has a frame
3144
3145 The default value is false, i.e. the spin box has no frame.
3146*/
3147#endif // QT_NO_SPINBOX
3148
3149/*!
3150 \class QStyleOptionQ3ListViewItem
3151 \brief The QStyleOptionQ3ListViewItem class is used to describe an
3152 item drawn in a Q3ListView.
3153
3154 This class is used for drawing the compatibility Q3ListView's
3155 items. \bold {It is not recommended for new classes}.
3156
3157 QStyleOptionQ3ListViewItem contains all the information that
3158 QStyle functions need to draw the Q3ListView items.
3159
3160 For performance reasons, the access to the member variables is
3161 direct (i.e., using the \c . or \c -> operator). This low-level feel
3162 makes the structures straightforward to use and emphasizes that
3163 these are simply parameters used by the style functions.
3164
3165 For an example demonstrating how style options can be used, see
3166 the \l {widgets/styles}{Styles} example.
3167
3168 \sa QStyleOption, QStyleOptionQ3ListView, Q3ListViewItem
3169*/
3170
3171/*!
3172 \enum QStyleOptionQ3ListViewItem::Q3ListViewItemFeature
3173
3174 This enum describes the features a list view item can have.
3175
3176 \value None A standard item.
3177 \value Expandable The item has children that can be shown.
3178 \value MultiLine The item is more than one line tall.
3179 \value Visible The item is visible.
3180 \value ParentControl The item's parent is a type of item control (Q3CheckListItem::Controller).
3181
3182 \sa features, Q3ListViewItem::isVisible(), Q3ListViewItem::multiLinesEnabled(),
3183 Q3ListViewItem::isExpandable()
3184*/
3185
3186/*!
3187 Constructs a QStyleOptionQ3ListViewItem, initializing the members
3188 variables to their default values.
3189*/
3190
3191QStyleOptionQ3ListViewItem::QStyleOptionQ3ListViewItem()
3192 : QStyleOption(Version, SO_Q3ListViewItem), features(None), height(0), totalHeight(0),
3193 itemY(0), childCount(0)
3194{
3195}
3196
3197/*!
3198 \internal
3199*/
3200QStyleOptionQ3ListViewItem::QStyleOptionQ3ListViewItem(int version)
3201 : QStyleOption(version, SO_Q3ListViewItem), features(None), height(0), totalHeight(0),
3202 itemY(0), childCount(0)
3203{
3204}
3205
3206/*!
3207 \fn QStyleOptionQ3ListViewItem::QStyleOptionQ3ListViewItem(const QStyleOptionQ3ListViewItem &other)
3208
3209 Constructs a copy of the \a other style option.
3210*/
3211
3212/*!
3213 \enum QStyleOptionQ3ListViewItem::StyleOptionType
3214
3215 This enum is used to hold information about the type of the style option, and
3216 is defined for each QStyleOption subclass.
3217
3218 \value Type The type of style option provided (\l{SO_Q3ListViewItem} for this class).
3219
3220 The type is used internally by QStyleOption, its subclasses, and
3221 qstyleoption_cast() to determine the type of style option. In
3222 general you do not need to worry about this unless you want to
3223 create your own QStyleOption subclass and your own styles.
3224
3225 \sa StyleOptionVersion
3226*/
3227
3228/*!
3229 \enum QStyleOptionQ3ListViewItem::StyleOptionVersion
3230
3231 This enum is used to hold information about the version of the style option, and
3232 is defined for each QStyleOption subclass.
3233
3234 \value Version 1
3235
3236 The version is used by QStyleOption subclasses to implement
3237 extensions without breaking compatibility. If you use
3238 qstyleoption_cast(), you normally do not need to check it.
3239
3240 \sa StyleOptionType
3241*/
3242
3243/*!
3244 \variable QStyleOptionQ3ListViewItem::features
3245 \brief the features for this item
3246
3247 This variable is a bitwise OR of the features of the item. The deafult value is \l None.
3248
3249 \sa Q3ListViewItemFeature
3250*/
3251
3252/*!
3253 \variable QStyleOptionQ3ListViewItem::height
3254 \brief the height of the item
3255
3256 This doesn't include the height of the item's children. The default height is 0.
3257
3258 \sa Q3ListViewItem::height()
3259*/
3260
3261/*!
3262 \variable QStyleOptionQ3ListViewItem::totalHeight
3263 \brief the total height of the item, including its children
3264
3265 The default total height is 0.
3266
3267 \sa Q3ListViewItem::totalHeight()
3268*/
3269
3270/*!
3271 \variable QStyleOptionQ3ListViewItem::itemY
3272 \brief the Y-coordinate for the item
3273
3274 The default value is 0.
3275
3276 \sa Q3ListViewItem::itemPos()
3277*/
3278
3279/*!
3280 \variable QStyleOptionQ3ListViewItem::childCount
3281 \brief the number of children the item has
3282*/
3283
3284/*!
3285 \class QStyleOptionQ3ListView
3286 \brief The QStyleOptionQ3ListView class is used to describe the
3287 parameters for drawing a Q3ListView.
3288
3289 This class is used for drawing the compatibility Q3ListView. \bold
3290 {It is not recommended for new classes}.
3291
3292 QStyleOptionQ3ListView contains all the information that QStyle
3293 functions need to draw Q3ListView.
3294
3295 For performance reasons, the access to the member variables is
3296 direct (i.e., using the \c . or \c -> operator). This low-level feel
3297 makes the structures straightforward to use and emphasizes that
3298 these are simply parameters used by the style functions.
3299
3300 For an example demonstrating how style options can be used, see
3301 the \l {widgets/styles}{Styles} example.
3302
3303 \sa QStyleOptionComplex, Q3ListView, QStyleOptionQ3ListViewItem
3304*/
3305
3306/*!
3307 Creates a QStyleOptionQ3ListView, initializing the members
3308 variables to their default values.
3309*/
3310
3311QStyleOptionQ3ListView::QStyleOptionQ3ListView()
3312 : QStyleOptionComplex(Version, SO_Q3ListView), viewportBGRole(QPalette::Base),
3313 sortColumn(0), itemMargin(0), treeStepSize(0), rootIsDecorated(false)
3314{
3315}
3316
3317/*!
3318 \internal
3319*/
3320QStyleOptionQ3ListView::QStyleOptionQ3ListView(int version)
3321 : QStyleOptionComplex(version, SO_Q3ListView), viewportBGRole(QPalette::Base),
3322 sortColumn(0), itemMargin(0), treeStepSize(0), rootIsDecorated(false)
3323{
3324}
3325
3326/*!
3327 \fn QStyleOptionQ3ListView::QStyleOptionQ3ListView(const QStyleOptionQ3ListView &other)
3328
3329 Constructs a copy of the \a other style option.
3330*/
3331
3332/*!
3333 \enum QStyleOptionQ3ListView::StyleOptionType
3334
3335 This enum is used to hold information about the type of the style option, and
3336 is defined for each QStyleOption subclass.
3337
3338 \value Type The type of style option provided (\l{SO_Q3ListView} for this class).
3339
3340 The type is used internally by QStyleOption, its subclasses, and
3341 qstyleoption_cast() to determine the type of style option. In
3342 general you do not need to worry about this unless you want to
3343 create your own QStyleOption subclass and your own styles.
3344
3345 \sa StyleOptionVersion
3346*/
3347
3348/*!
3349 \enum QStyleOptionQ3ListView::StyleOptionVersion
3350
3351 This enum is used to hold information about the version of the style option, and
3352 is defined for each QStyleOption subclass.
3353
3354 \value Version 1
3355
3356 The version is used by QStyleOption subclasses to implement
3357 extensions without breaking compatibility. If you use
3358 qstyleoption_cast(), you normally do not need to check it.
3359
3360 \sa StyleOptionType
3361*/
3362
3363/*!
3364 \variable QStyleOptionQ3ListView::items
3365 \brief a list of items in the Q3ListView
3366
3367 This is a list of \l {QStyleOptionQ3ListViewItem}s. The first item
3368 can be used for most of the calculation that are needed for
3369 drawing a list view. Any additional items are the children of
3370 this first item, which may be used for additional information.
3371
3372 \sa QStyleOptionQ3ListViewItem
3373*/
3374
3375/*!
3376 \variable QStyleOptionQ3ListView::viewportPalette
3377 \brief the palette of Q3ListView's viewport
3378
3379 By default, the application's default palette is used.
3380*/
3381
3382/*!
3383 \variable QStyleOptionQ3ListView::viewportBGRole
3384 \brief the background role of Q3ListView's viewport
3385
3386 The default value is QPalette::Base.
3387
3388 \sa QWidget::backgroundRole()
3389*/
3390
3391/*!
3392 \variable QStyleOptionQ3ListView::sortColumn
3393 \brief the sort column of the list view
3394
3395 The default value is 0.
3396
3397 \sa Q3ListView::sortColumn()
3398*/
3399
3400/*!
3401 \variable QStyleOptionQ3ListView::itemMargin
3402 \brief the margin for items in the list view
3403
3404 The default value is 0.
3405
3406 \sa Q3ListView::itemMargin()
3407*/
3408
3409/*!
3410 \variable QStyleOptionQ3ListView::treeStepSize
3411 \brief the number of pixel to offset children items from their
3412 parents
3413
3414 The default value is 0.
3415
3416 \sa Q3ListView::treeStepSize()
3417*/
3418
3419/*!
3420 \variable QStyleOptionQ3ListView::rootIsDecorated
3421 \brief whether root items are decorated
3422
3423 The default value is false.
3424
3425 \sa Q3ListView::rootIsDecorated()
3426*/
3427
3428/*!
3429 \class QStyleOptionQ3DockWindow
3430 \brief The QStyleOptionQ3DockWindow class is used to describe the
3431 parameters for drawing various parts of a Q3DockWindow.
3432
3433 This class is used for drawing the old Q3DockWindow and its
3434 parts. \bold {It is not recommended for new classes}.
3435
3436 QStyleOptionQ3DockWindow contains all the information that QStyle
3437 functions need to draw Q3DockWindow and its parts.
3438
3439 For performance reasons, the access to the member variables is
3440 direct (i.e., using the \c . or \c -> operator). This low-level feel
3441 makes the structures straightforward to use and emphasizes that
3442 these are simply parameters used by the style functions.
3443
3444 For an example demonstrating how style options can be used, see
3445 the \l {widgets/styles}{Styles} example.
3446
3447 \sa QStyleOption, Q3DockWindow
3448*/
3449
3450/*!
3451 Constructs a QStyleOptionQ3DockWindow, initializing the member
3452 variables to their default values.
3453*/
3454
3455QStyleOptionQ3DockWindow::QStyleOptionQ3DockWindow()
3456 : QStyleOption(Version, SO_Q3DockWindow), docked(false), closeEnabled(false)
3457{
3458}
3459
3460/*!
3461 \internal
3462*/
3463QStyleOptionQ3DockWindow::QStyleOptionQ3DockWindow(int version)
3464 : QStyleOption(version, SO_Q3DockWindow), docked(false), closeEnabled(false)
3465{
3466}
3467
3468/*!
3469 \fn QStyleOptionQ3DockWindow::QStyleOptionQ3DockWindow(const QStyleOptionQ3DockWindow &other)
3470
3471 Constructs a copy of the \a other style option.
3472*/
3473
3474/*!
3475 \enum QStyleOptionQ3DockWindow::StyleOptionType
3476
3477 This enum is used to hold information about the type of the style option, and
3478 is defined for each QStyleOption subclass.
3479
3480 \value Type The type of style option provided (\l{SO_Q3DockWindow} for this class).
3481
3482 The type is used internally by QStyleOption, its subclasses, and
3483 qstyleoption_cast() to determine the type of style option. In
3484 general you do not need to worry about this unless you want to
3485 create your own QStyleOption subclass and your own styles.
3486
3487 \sa StyleOptionVersion
3488*/
3489
3490/*!
3491 \enum QStyleOptionQ3DockWindow::StyleOptionVersion
3492
3493 This enum is used to hold information about the version of the style option, and
3494 is defined for each QStyleOption subclass.
3495
3496 \value Version 1
3497
3498 The version is used by QStyleOption subclasses to implement
3499 extensions without breaking compatibility. If you use
3500 qstyleoption_cast(), you normally do not need to check it.
3501
3502 \sa StyleOptionType
3503*/
3504
3505/*!
3506 \variable QStyleOptionQ3DockWindow::docked
3507 \brief whether the dock window is currently docked
3508
3509 The default value is false.
3510*/
3511
3512/*!
3513 \variable QStyleOptionQ3DockWindow::closeEnabled
3514 \brief whether the dock window has a close button
3515
3516 The default value is false.
3517*/
3518
3519/*!
3520 \class QStyleOptionDockWidget
3521 \brief The QStyleOptionDockWidget class is used to describe the
3522 parameters for drawing a dock widget.
3523
3524 QStyleOptionDockWidget contains all the information that QStyle
3525 functions need to draw graphical elements like QDockWidget.
3526
3527 For performance reasons, the access to the member variables is
3528 direct (i.e., using the \c . or \c -> operator). This low-level feel
3529 makes the structures straightforward to use and emphasizes that
3530 these are simply parameters used by the style functions.
3531
3532 For an example demonstrating how style options can be used, see
3533 the \l {widgets/styles}{Styles} example.
3534
3535 \sa QStyleOption
3536*/
3537
3538/*!
3539 Constructs a QStyleOptionDockWidget, initializing the member
3540 variables to their default values.
3541*/
3542
3543QStyleOptionDockWidget::QStyleOptionDockWidget()
3544 : QStyleOption(Version, SO_DockWidget), movable(false)
3545{
3546}
3547
3548/*!
3549 \internal
3550*/
3551QStyleOptionDockWidget::QStyleOptionDockWidget(int version)
3552 : QStyleOption(version, SO_DockWidget), closable(false),
3553 movable(false), floatable(false)
3554{
3555}
3556
3557QStyleOptionDockWidgetV2::QStyleOptionDockWidgetV2()
3558 : QStyleOptionDockWidget(Version), verticalTitleBar(false)
3559{
3560}
3561
3562QStyleOptionDockWidgetV2::QStyleOptionDockWidgetV2(
3563 const QStyleOptionDockWidget &other)
3564 : QStyleOptionDockWidget(Version)
3565{
3566 (void)QStyleOptionDockWidgetV2::operator=(other);
3567}
3568
3569QStyleOptionDockWidgetV2 &QStyleOptionDockWidgetV2::operator = (
3570 const QStyleOptionDockWidget &other)
3571{
3572 QStyleOptionDockWidget::operator=(other);
3573 const QStyleOptionDockWidgetV2 *v2
3574 = qstyleoption_cast<const QStyleOptionDockWidgetV2*>(&other);
3575 verticalTitleBar = v2 ? v2->verticalTitleBar : false;
3576 return *this;
3577}
3578
3579QStyleOptionDockWidgetV2::QStyleOptionDockWidgetV2(int version)
3580 : QStyleOptionDockWidget(version), verticalTitleBar(false)
3581{
3582}
3583
3584/*!
3585 \fn QStyleOptionDockWidget::QStyleOptionDockWidget(const QStyleOptionDockWidget &other)
3586
3587 Constructs a copy of the \a other style option.
3588*/
3589
3590/*!
3591 \enum QStyleOptionDockWidget::StyleOptionType
3592
3593 This enum is used to hold information about the type of the style option, and
3594 is defined for each QStyleOption subclass.
3595
3596 \value Type The type of style option provided (\l{SO_DockWidget} for this class).
3597
3598 The type is used internally by QStyleOption, its subclasses, and
3599 qstyleoption_cast() to determine the type of style option. In
3600 general you do not need to worry about this unless you want to
3601 create your own QStyleOption subclass and your own styles.
3602
3603 \sa StyleOptionVersion
3604*/
3605
3606/*!
3607 \enum QStyleOptionDockWidget::StyleOptionVersion
3608
3609 This enum is used to hold information about the version of the style option, and
3610 is defined for each QStyleOption subclass.
3611
3612 \value Version 1
3613
3614 The version is used by QStyleOption subclasses to implement
3615 extensions without breaking compatibility. If you use
3616 qstyleoption_cast(), you normally do not need to check it.
3617
3618 \sa StyleOptionType
3619*/
3620
3621/*!
3622 \variable QStyleOptionDockWidget::title
3623 \brief the title of the dock window
3624
3625 The default value is an empty string.
3626*/
3627
3628/*!
3629 \variable QStyleOptionDockWidget::closable
3630 \brief whether the dock window is closable
3631
3632 The default value is true.
3633*/
3634
3635/*!
3636 \variable QStyleOptionDockWidget::movable
3637 \brief whether the dock window is movable
3638
3639 The default value is false.
3640*/
3641
3642/*!
3643 \variable QStyleOptionDockWidget::floatable
3644 \brief whether the dock window is floatable
3645
3646 The default value is true.
3647*/
3648
3649/*!
3650 \class QStyleOptionToolButton
3651 \brief The QStyleOptionToolButton class is used to describe the
3652 parameters for drawing a tool button.
3653
3654 QStyleOptionToolButton contains all the information that QStyle
3655 functions need to draw QToolButton.
3656
3657 For performance reasons, the access to the member variables is
3658 direct (i.e., using the \c . or \c -> operator). This low-level feel
3659 makes the structures straightforward to use and emphasizes that
3660 these are simply parameters used by the style functions.
3661
3662 For an example demonstrating how style options can be used, see
3663 the \l {widgets/styles}{Styles} example.
3664
3665 \sa QStyleOption, QStyleOptionComplex, QStyleOptionButton
3666*/
3667
3668/*!
3669 \enum QStyleOptionToolButton::ToolButtonFeature
3670 Describes the various features that a tool button can have.
3671
3672 \value None A normal tool button.
3673 \value Arrow The tool button is an arrow.
3674 \value Menu The tool button has a menu.
3675 \value PopupDelay There is a delay to showing the menu.
3676 \value HasMenu The button has a popup menu.
3677 \value MenuButtonPopup The button should display an arrow to
3678 indicate that a menu is present.
3679
3680 \sa features, QToolButton::toolButtonStyle(), QToolButton::popupMode()
3681*/
3682
3683/*!
3684 Constructs a QStyleOptionToolButton, initializing the members
3685 variables to their default values.
3686*/
3687
3688QStyleOptionToolButton::QStyleOptionToolButton()
3689 : QStyleOptionComplex(Version, SO_ToolButton), features(None), arrowType(Qt::DownArrow)
3690 , toolButtonStyle(Qt::ToolButtonIconOnly)
3691{
3692}
3693
3694/*!
3695 \internal
3696*/
3697QStyleOptionToolButton::QStyleOptionToolButton(int version)
3698 : QStyleOptionComplex(version, SO_ToolButton), features(None), arrowType(Qt::DownArrow)
3699 , toolButtonStyle(Qt::ToolButtonIconOnly)
3700
3701{
3702}
3703
3704/*!
3705 \fn QStyleOptionToolButton::QStyleOptionToolButton(const QStyleOptionToolButton &other)
3706
3707 Constructs a copy of the \a other style option.
3708*/
3709
3710/*!
3711 \enum QStyleOptionToolButton::StyleOptionType
3712
3713 This enum is used to hold information about the type of the style option, and
3714 is defined for each QStyleOption subclass.
3715
3716 \value Type The type of style option provided (\l{SO_ToolButton} for this class).
3717
3718 The type is used internally by QStyleOption, its subclasses, and
3719 qstyleoption_cast() to determine the type of style option. In
3720 general you do not need to worry about this unless you want to
3721 create your own QStyleOption subclass and your own styles.
3722
3723 \sa StyleOptionVersion
3724*/
3725
3726/*!
3727 \enum QStyleOptionToolButton::StyleOptionVersion
3728
3729 This enum is used to hold information about the version of the style option, and
3730 is defined for each QStyleOption subclass.
3731
3732 \value Version 1
3733
3734 The version is used by QStyleOption subclasses to implement
3735 extensions without breaking compatibility. If you use
3736 qstyleoption_cast(), you normally do not need to check it.
3737
3738 \sa StyleOptionType
3739*/
3740
3741/*!
3742 \variable QStyleOptionToolButton::features
3743 \brief an OR combination of the tool button's features
3744
3745 The default value is \l None.
3746
3747 \sa ToolButtonFeature
3748*/
3749
3750/*!
3751 \variable QStyleOptionToolButton::icon
3752 \brief the icon for the tool button
3753
3754 The default value is an empty icon, i.e. an icon with neither a
3755 pixmap nor a filename.
3756
3757 \sa iconSize
3758*/
3759
3760/*!
3761 \variable QStyleOptionToolButton::iconSize
3762 \brief the size of the icon for the tool button
3763
3764 The default value is QSize(-1, -1), i.e. an invalid size.
3765*/
3766
3767/*!
3768 \variable QStyleOptionToolButton::text
3769 \brief the text of the tool button
3770
3771 This value is only used if toolButtonStyle is
3772 Qt::ToolButtonTextUnderIcon, Qt::ToolButtonTextBesideIcon, or
3773 Qt::ToolButtonTextOnly. The default value is an empty string.
3774*/
3775
3776/*!
3777 \variable QStyleOptionToolButton::arrowType
3778 \brief the direction of the arrow for the tool button
3779
3780 This value is only used if \l features includes \l Arrow. The
3781 default value is Qt::DownArrow.
3782*/
3783
3784/*!
3785 \variable QStyleOptionToolButton::toolButtonStyle
3786 \brief a Qt::ToolButtonStyle value describing the appearance of
3787 the tool button
3788
3789 The default value is Qt::ToolButtonIconOnly.
3790
3791 \sa QToolButton::toolButtonStyle()
3792*/
3793
3794/*!
3795 \variable QStyleOptionToolButton::pos
3796 \brief the position of the tool button
3797
3798 The default value is a null point, i.e. (0, 0)
3799*/
3800
3801/*!
3802 \variable QStyleOptionToolButton::font
3803 \brief the font that is used for the text
3804
3805 This value is only used if toolButtonStyle is
3806 Qt::ToolButtonTextUnderIcon, Qt::ToolButtonTextBesideIcon, or
3807 Qt::ToolButtonTextOnly. By default, the application's default font
3808 is used.
3809*/
3810
3811/*!
3812 \class QStyleOptionComboBox
3813 \brief The QStyleOptionComboBox class is used to describe the
3814 parameter for drawing a combobox.
3815
3816 QStyleOptionButton contains all the information that QStyle
3817 functions need to draw QComboBox.
3818
3819 For performance reasons, the access to the member variables is
3820 direct (i.e., using the \c . or \c -> operator). This low-level feel
3821 makes the structures straightforward to use and emphasizes that
3822 these are simply parameters used by the style functions.
3823
3824 For an example demonstrating how style options can be used, see
3825 the \l {widgets/styles}{Styles} example.
3826
3827 \sa QStyleOption, QStyleOptionComplex, QComboBox
3828*/
3829
3830/*!
3831 Creates a QStyleOptionComboBox, initializing the members variables
3832 to their default values.
3833*/
3834
3835QStyleOptionComboBox::QStyleOptionComboBox()
3836 : QStyleOptionComplex(Version, SO_ComboBox), editable(false), frame(true)
3837{
3838}
3839
3840/*!
3841 \internal
3842*/
3843QStyleOptionComboBox::QStyleOptionComboBox(int version)
3844 : QStyleOptionComplex(version, SO_ComboBox), editable(false), frame(true)
3845{
3846}
3847
3848/*!
3849 \fn QStyleOptionComboBox::QStyleOptionComboBox(const QStyleOptionComboBox &other)
3850
3851 Constructs a copy of the \a other style option.
3852*/
3853
3854/*!
3855 \enum QStyleOptionComboBox::StyleOptionType
3856
3857 This enum is used to hold information about the type of the style option, and
3858 is defined for each QStyleOption subclass.
3859
3860 \value Type The type of style option provided (\l{SO_ComboBox} for this class).
3861
3862 The type is used internally by QStyleOption, its subclasses, and
3863 qstyleoption_cast() to determine the type of style option. In
3864 general you do not need to worry about this unless you want to
3865 create your own QStyleOption subclass and your own styles.
3866
3867 \sa StyleOptionVersion
3868*/
3869
3870/*!
3871 \enum QStyleOptionComboBox::StyleOptionVersion
3872
3873 This enum is used to hold information about the version of the style option, and
3874 is defined for each QStyleOption subclass.
3875
3876 \value Version 1
3877
3878 The version is used by QStyleOption subclasses to implement
3879 extensions without breaking compatibility. If you use
3880 qstyleoption_cast(), you normally do not need to check it.
3881
3882 \sa StyleOptionType
3883*/
3884
3885/*!
3886 \variable QStyleOptionComboBox::editable
3887 \brief whether or not the combobox is editable or not
3888
3889 the default
3890 value is false
3891
3892 \sa QComboBox::isEditable()
3893*/
3894
3895
3896/*!
3897 \variable QStyleOptionComboBox::frame
3898 \brief whether the combo box has a frame
3899
3900 The default value is true.
3901*/
3902
3903/*!
3904 \variable QStyleOptionComboBox::currentText
3905 \brief the text for the current item of the combo box
3906
3907 The default value is an empty string.
3908*/
3909
3910/*!
3911 \variable QStyleOptionComboBox::currentIcon
3912 \brief the icon for the current item of the combo box
3913
3914 The default value is an empty icon, i.e. an icon with neither a
3915 pixmap nor a filename.
3916*/
3917
3918/*!
3919 \variable QStyleOptionComboBox::iconSize
3920 \brief the icon size for the current item of the combo box
3921
3922 The default value is QSize(-1, -1), i.e. an invalid size.
3923*/
3924
3925/*!
3926 \variable QStyleOptionComboBox::popupRect
3927 \brief the popup rectangle for the combobox
3928
3929 The default value is a null rectangle, i.e. a rectangle with both
3930 the width and the height set to 0.
3931
3932 This variable is currently unused. You can safely ignore it.
3933
3934 \sa QStyle::SC_ComboBoxListBoxPopup
3935*/
3936
3937/*!
3938 \class QStyleOptionToolBox
3939 \brief The QStyleOptionToolBox class is used to describe the
3940 parameters needed for drawing a tool box.
3941
3942 QStyleOptionToolBox contains all the information that QStyle
3943 functions need to draw QToolBox.
3944
3945 For performance reasons, the access to the member variables is
3946 direct (i.e., using the \c . or \c -> operator). This low-level feel
3947 makes the structures straightforward to use and emphasizes that
3948 these are simply parameters used by the style functions.
3949
3950 For an example demonstrating how style options can be used, see
3951 the \l {widgets/styles}{Styles} example.
3952
3953 \sa QStyleOption, QToolBox
3954*/
3955
3956/*!
3957 Creates a QStyleOptionToolBox, initializing the members variables
3958 to their default values.
3959*/
3960
3961QStyleOptionToolBox::QStyleOptionToolBox()
3962 : QStyleOption(Version, SO_ToolBox)
3963{
3964}
3965
3966/*!
3967 \internal
3968*/
3969QStyleOptionToolBox::QStyleOptionToolBox(int version)
3970 : QStyleOption(version, SO_ToolBox)
3971{
3972}
3973
3974/*!
3975 \fn QStyleOptionToolBox::QStyleOptionToolBox(const QStyleOptionToolBox &other)
3976
3977 Constructs a copy of the \a other style option.
3978*/
3979
3980/*!
3981 \enum QStyleOptionToolBox::StyleOptionType
3982
3983 This enum is used to hold information about the type of the style option, and
3984 is defined for each QStyleOption subclass.
3985
3986 \value Type The type of style option provided (\l{SO_ToolBox} for this class).
3987
3988 The type is used internally by QStyleOption, its subclasses, and
3989 qstyleoption_cast() to determine the type of style option. In
3990 general you do not need to worry about this unless you want to
3991 create your own QStyleOption subclass and your own styles.
3992
3993 \sa StyleOptionVersion
3994*/
3995
3996/*!
3997 \enum QStyleOptionToolBox::StyleOptionVersion
3998
3999 This enum is used to hold information about the version of the style option, and
4000 is defined for each QStyleOption subclass.
4001
4002 \value Version 1
4003
4004 The version is used by QStyleOption subclasses to implement
4005 extensions without breaking compatibility. If you use
4006 qstyleoption_cast(), you normally do not need to check it.
4007
4008 \sa StyleOptionType
4009*/
4010
4011/*!
4012 \variable QStyleOptionToolBox::icon
4013 \brief the icon for the tool box tab
4014
4015 The default value is an empty icon, i.e. an icon with neither a
4016 pixmap nor a filename.
4017*/
4018
4019/*!
4020 \variable QStyleOptionToolBox::text
4021 \brief the text for the tool box tab
4022
4023 The default value is an empty string.
4024*/
4025
4026/*!
4027 \class QStyleOptionToolBoxV2
4028 \brief The QStyleOptionToolBoxV2 class is used to describe the parameters necessary for drawing a frame in Qt 4.3 or above.
4029
4030 \since 4.3
4031 QStyleOptionToolBoxV2 inherits QStyleOptionToolBox which is used for
4032 drawing the tabs in a QToolBox.
4033
4034 An instance of the QStyleOptionToolBoxV2 class has
4035 \l{QStyleOption::type} {type} SO_ToolBox and
4036 \l{QStyleOption::version} {version} 2. The type is used
4037 internally by QStyleOption, its subclasses, and
4038 qstyleoption_cast() to determine the type of style option. In
4039 general you do not need to worry about this unless you want to
4040 create your own QStyleOption subclass and your own styles. The
4041 version is used by QStyleOption subclasses to implement extensions
4042 without breaking compatibility. If you use qstyleoption_cast(),
4043 you normally do not need to check it.
4044
4045 If you create your own QStyle subclass, you should handle both
4046 QStyleOptionToolBox and QStyleOptionToolBoxV2.
4047
4048 \sa QStyleOptionToolBox, QStyleOption
4049*/
4050
4051/*!
4052 Contsructs a QStyleOptionToolBoxV2 object.
4053*/
4054QStyleOptionToolBoxV2::QStyleOptionToolBoxV2()
4055 : QStyleOptionToolBox(Version), position(Beginning), selectedPosition(NotAdjacent)
4056{
4057}
4058
4059/*!
4060 \fn QStyleOptionToolBoxV2::QStyleOptionToolBoxV2(const QStyleOptionToolBoxV2 &other)
4061
4062 Constructs a QStyleOptionToolBoxV2 copy of the \a other style option.
4063*/
4064
4065/*!
4066 \internal
4067*/
4068QStyleOptionToolBoxV2::QStyleOptionToolBoxV2(int version)
4069 : QStyleOptionToolBox(version), position(Beginning), selectedPosition(NotAdjacent)
4070{
4071}
4072
4073/*!
4074 Constructs a QStyleOptionToolBoxV2 copy of the \a other style option
4075 which can be either of the QStyleOptionToolBoxV2 or
4076 QStyleOptionToolBox types.
4077
4078 If the \a other style option's version is 1, the new style
4079 option's \l{QStyleOptionTab::position} {position} value is set to
4080 \l QStyleOptionToolBoxV2::Beginning and \l selectedPosition is set
4081 to \l QStyleOptionToolBoxV2::NotAdjacent. If its version is 2, the
4082 \l{QStyleOptionTab::position} {position} selectedPosition values
4083 are simply copied to the new style option.
4084
4085 \sa version
4086*/
4087QStyleOptionToolBoxV2::QStyleOptionToolBoxV2(const QStyleOptionToolBox &other)
4088{
4089 QStyleOptionToolBox::operator=(other);
4090
4091 const QStyleOptionToolBoxV2 *f2 = qstyleoption_cast<const QStyleOptionToolBoxV2 *>(&other);
4092 position = f2 ? f2->position : Beginning;
4093 selectedPosition = f2 ? f2->selectedPosition : NotAdjacent;
4094 version = Version;
4095}
4096
4097/*!
4098 Assigns the \a other style option to this style option. The \a
4099 other style option can be either of the QStyleOptionToolBoxV2 or
4100 QStyleOptionToolBox types.
4101
4102 If the \a{other} style option's version is 1, this style option's
4103 \l{QStyleOptionTab::position} {position} and \l selectedPosition
4104 values are set to \l QStyleOptionToolBoxV2::Beginning and \l
4105 QStyleOptionToolBoxV2::NotAdjacent respectively. If its
4106 \l{QStyleOption::version} {version} is 2, these values are simply
4107 copied to this style option.
4108*/
4109QStyleOptionToolBoxV2 &QStyleOptionToolBoxV2::operator=(const QStyleOptionToolBox &other)
4110{
4111 QStyleOptionToolBox::operator=(other);
4112
4113 const QStyleOptionToolBoxV2 *f2 = qstyleoption_cast<const QStyleOptionToolBoxV2 *>(&other);
4114 position = f2 ? f2->position : Beginning;
4115 selectedPosition = f2 ? f2->selectedPosition : NotAdjacent;
4116 version = Version;
4117 return *this;
4118}
4119
4120
4121/*!
4122 \enum QStyleOptionToolBoxV2::SelectedPosition
4123
4124 This enum describes the position of the selected tab. Some styles
4125 need to draw a tab differently depending on whether or not it is
4126 adjacent to the selected tab.
4127
4128 \value NotAdjacent The tab is not adjacent to a selected tab (or is the selected tab).
4129 \value NextIsSelected The next tab (typically the tab on the right) is selected.
4130 \value PreviousIsSelected The previous tab (typically the tab on the left) is selected.
4131
4132 \sa selectedPosition
4133*/
4134
4135/*!
4136 \enum QStyleOptionToolBoxV2::StyleOptionVersion
4137
4138 This enum holds the version of this style option
4139
4140 \value Version 2
4141*/
4142
4143/*!
4144 \enum QStyleOptionToolBoxV2::TabPosition
4145
4146 This enum describes tab positions relative to other tabs.
4147
4148 \value Beginning The tab is the first (i.e., top-most) tab in
4149 the toolbox.
4150 \value Middle The tab is placed in the middle of the toolbox.
4151 \value End The tab is placed at the bottom of the toolbox.
4152 \value OnlyOneTab There is only one tab in the toolbox.
4153*/
4154
4155/*!
4156 \variable QStyleOptionToolBoxV2::selectedPosition
4157 \brief the position of the selected tab in relation to this tab
4158
4159 The default value is NotAdjacent, i.e. the tab is not adjacent to
4160 a selected tab nor is it the selected tab.
4161*/
4162
4163#ifndef QT_NO_RUBBERBAND
4164/*!
4165 \class QStyleOptionRubberBand
4166 \brief The QStyleOptionRubberBand class is used to describe the
4167 parameters needed for drawing a rubber band.
4168
4169 QStyleOptionRubberBand contains all the information that
4170 QStyle functions need to draw QRubberBand.
4171
4172 For performance reasons, the access to the member variables is
4173 direct (i.e., using the \c . or \c -> operator). This low-level feel
4174 makes the structures straightforward to use and emphasizes that
4175 these are simply parameters used by the style functions.
4176
4177 For an example demonstrating how style options can be used, see
4178 the \l {widgets/styles}{Styles} example.
4179
4180 \sa QStyleOption, QRubberBand
4181*/
4182
4183/*!
4184 Creates a QStyleOptionRubberBand, initializing the members
4185 variables to their default values.
4186*/
4187
4188QStyleOptionRubberBand::QStyleOptionRubberBand()
4189 : QStyleOption(Version, SO_RubberBand), shape(QRubberBand::Line), opaque(false)
4190{
4191}
4192
4193/*!
4194 \internal
4195*/
4196QStyleOptionRubberBand::QStyleOptionRubberBand(int version)
4197 : QStyleOption(version, SO_RubberBand), shape(QRubberBand::Line), opaque(false)
4198{
4199}
4200
4201/*!
4202 \fn QStyleOptionRubberBand::QStyleOptionRubberBand(const QStyleOptionRubberBand &other)
4203
4204 Constructs a copy of the \a other style option.
4205*/
4206
4207/*!
4208 \enum QStyleOptionRubberBand::StyleOptionType
4209
4210 This enum is used to hold information about the type of the style option, and
4211 is defined for each QStyleOption subclass.
4212
4213 \value Type The type of style option provided (\l{SO_RubberBand} for this class).
4214
4215 The type is used internally by QStyleOption, its subclasses, and
4216 qstyleoption_cast() to determine the type of style option. In
4217 general you do not need to worry about this unless you want to
4218 create your own QStyleOption subclass and your own styles.
4219
4220 \sa StyleOptionVersion
4221*/
4222
4223/*!
4224 \enum QStyleOptionRubberBand::StyleOptionVersion
4225
4226 This enum is used to hold information about the version of the style option, and
4227 is defined for each QStyleOption subclass.
4228
4229 \value Version 1
4230
4231 The version is used by QStyleOption subclasses to implement
4232 extensions without breaking compatibility. If you use
4233 qstyleoption_cast(), you normally do not need to check it.
4234
4235 \sa StyleOptionType
4236*/
4237
4238/*!
4239 \variable QStyleOptionRubberBand::shape
4240 \brief the shape of the rubber band
4241
4242 The default shape is QRubberBand::Line.
4243*/
4244
4245/*!
4246 \variable QStyleOptionRubberBand::opaque
4247 \brief whether the rubber band is required to be drawn in an opaque style
4248
4249 The default value is true.
4250*/
4251#endif // QT_NO_RUBBERBAND
4252
4253/*!
4254 \class QStyleOptionTitleBar
4255 \brief The QStyleOptionTitleBar class is used to describe the
4256 parameters for drawing a title bar.
4257
4258 QStyleOptionTitleBar contains all the information that QStyle
4259 functions need to draw the title bars of QWorkspace's MDI
4260 children.
4261
4262 For performance reasons, the access to the member variables is
4263 direct (i.e., using the \c . or \c -> operator). This low-level feel
4264 makes the structures straightforward to use and emphasizes that
4265 these are simply parameters used by the style functions.
4266
4267 For an example demonstrating how style options can be used, see
4268 the \l {widgets/styles}{Styles} example.
4269
4270 \sa QStyleOption, QStyleOptionComplex, QWorkspace
4271*/
4272
4273/*!
4274 Constructs a QStyleOptionTitleBar, initializing the members
4275 variables to their default values.
4276*/
4277
4278QStyleOptionTitleBar::QStyleOptionTitleBar()
4279 : QStyleOptionComplex(Version, SO_TitleBar), titleBarState(0), titleBarFlags(0)
4280{
4281}
4282
4283/*!
4284 \fn QStyleOptionTitleBar::QStyleOptionTitleBar(const QStyleOptionTitleBar &other)
4285
4286 Constructs a copy of the \a other style option.
4287*/
4288
4289/*!
4290 \enum QStyleOptionTitleBar::StyleOptionType
4291
4292 This enum is used to hold information about the type of the style option, and
4293 is defined for each QStyleOption subclass.
4294
4295 \value Type The type of style option provided (\l{SO_TitleBar} for this class).
4296
4297 The type is used internally by QStyleOption, its subclasses, and
4298 qstyleoption_cast() to determine the type of style option. In
4299 general you do not need to worry about this unless you want to
4300 create your own QStyleOption subclass and your own styles.
4301
4302 \sa StyleOptionVersion
4303*/
4304
4305/*!
4306 \enum QStyleOptionTitleBar::StyleOptionVersion
4307
4308 This enum is used to hold information about the version of the style option, and
4309 is defined for each QStyleOption subclass.
4310
4311 \value Version 1
4312
4313 The version is used by QStyleOption subclasses to implement
4314 extensions without breaking compatibility. If you use
4315 qstyleoption_cast(), you normally do not need to check it.
4316
4317 \sa StyleOptionType
4318*/
4319
4320/*!
4321 \internal
4322*/
4323QStyleOptionTitleBar::QStyleOptionTitleBar(int version)
4324 : QStyleOptionComplex(version, SO_TitleBar), titleBarState(0), titleBarFlags(0)
4325{
4326}
4327
4328
4329/*!
4330 \variable QStyleOptionTitleBar::text
4331 \brief the text of the title bar
4332
4333 The default value is an empty string.
4334*/
4335
4336/*!
4337 \variable QStyleOptionTitleBar::icon
4338 \brief the icon for the title bar
4339
4340 The default value is an empty icon, i.e. an icon with neither a
4341 pixmap nor a filename.
4342*/
4343
4344/*!
4345 \variable QStyleOptionTitleBar::titleBarState
4346 \brief the state of the title bar
4347
4348 This is basically the window state of the underlying widget. The
4349 default value is 0.
4350
4351 \sa QWidget::windowState()
4352*/
4353
4354/*!
4355 \variable QStyleOptionTitleBar::titleBarFlags
4356 \brief the widget flags for the title bar
4357
4358 The default value is Qt::Widget.
4359
4360 \sa Qt::WindowFlags
4361*/
4362
4363/*!
4364 \class QStyleOptionViewItem
4365 \brief The QStyleOptionViewItem class is used to describe the
4366 parameters used to draw an item in a view widget.
4367
4368 QStyleOptionViewItem contains all the information that QStyle
4369 functions need to draw the items for Qt's model/view classes.
4370
4371 For performance reasons, the access to the member variables is
4372 direct (i.e., using the \c . or \c -> operator). This low-level feel
4373 makes the structures straightforward to use and emphasizes that
4374 these are simply parameters used by the style functions.
4375
4376 For an example demonstrating how style options can be used, see
4377 the \l {widgets/styles}{Styles} example.
4378
4379 \sa QStyleOption, {model-view-programming.html}{Model/View
4380 Programming}
4381*/
4382
4383/*!
4384 \enum QStyleOptionViewItem::Position
4385
4386 This enum describes the position of the item's decoration.
4387
4388 \value Left On the left of the text.
4389 \value Right On the right of the text.
4390 \value Top Above the text.
4391 \value Bottom Below the text.
4392
4393 \sa decorationPosition
4394*/
4395
4396/*!
4397 \variable QStyleOptionViewItem::showDecorationSelected
4398 \brief whether the decoration should be highlighted on selected
4399 items
4400
4401 If this option is true, the branch and any decorations on selected items
4402 should be highlighted, indicating that the item is selected; otherwise, no
4403 highlighting is required. The default value is false.
4404
4405 \sa QStyle::SH_ItemView_ShowDecorationSelected, QAbstractItemView
4406*/
4407
4408/*!
4409 \variable QStyleOptionViewItem::textElideMode
4410 \brief where ellipsis should be added for text that is too long to fit
4411 into an item
4412
4413 The default value is Qt::ElideMiddle, i.e. the ellipsis appears in
4414 the middle of the text.
4415
4416 \sa Qt::TextElideMode, QStyle::SH_ItemView_EllipsisLocation
4417*/
4418
4419/*!
4420 Constructs a QStyleOptionViewItem, initializing the members
4421 variables to their default values.
4422*/
4423
4424QStyleOptionViewItem::QStyleOptionViewItem()
4425 : QStyleOption(Version, SO_ViewItem),
4426 displayAlignment(Qt::AlignLeft), decorationAlignment(Qt::AlignLeft),
4427 textElideMode(Qt::ElideMiddle), decorationPosition(Left),
4428 showDecorationSelected(false)
4429{
4430}
4431
4432/*!
4433 \internal
4434*/
4435QStyleOptionViewItem::QStyleOptionViewItem(int version)
4436 : QStyleOption(version, SO_ViewItem),
4437 displayAlignment(Qt::AlignLeft), decorationAlignment(Qt::AlignLeft),
4438 textElideMode(Qt::ElideMiddle), decorationPosition(Left),
4439 showDecorationSelected(false)
4440{
4441}
4442
4443/*!
4444 \fn QStyleOptionViewItem::QStyleOptionViewItem(const QStyleOptionViewItem &other)
4445
4446 Constructs a copy of the \a other style option.
4447*/
4448
4449/*!
4450 \enum QStyleOptionViewItem::StyleOptionType
4451
4452 This enum is used to hold information about the type of the style option, and
4453 is defined for each QStyleOption subclass.
4454
4455 \value Type The type of style option provided (\l{SO_ViewItem} for this class).
4456
4457 The type is used internally by QStyleOption, its subclasses, and
4458 qstyleoption_cast() to determine the type of style option. In
4459 general you do not need to worry about this unless you want to
4460 create your own QStyleOption subclass and your own styles.
4461
4462 \sa StyleOptionVersion
4463*/
4464
4465/*!
4466 \enum QStyleOptionViewItem::StyleOptionVersion
4467
4468 This enum is used to hold information about the version of the style option, and
4469 is defined for each QStyleOption subclass.
4470
4471 \value Version 1
4472
4473 The version is used by QStyleOption subclasses to implement
4474 extensions without breaking compatibility. If you use
4475 qstyleoption_cast(), you normally do not need to check it.
4476
4477 \sa StyleOptionType
4478*/
4479
4480/*!
4481 \variable QStyleOptionViewItem::displayAlignment
4482 \brief the alignment of the display value for the item
4483
4484 The default value is Qt::AlignLeft.
4485*/
4486
4487/*!
4488 \variable QStyleOptionViewItem::decorationAlignment
4489 \brief the alignment of the decoration for the item
4490
4491 The default value is Qt::AlignLeft.
4492*/
4493
4494/*!
4495 \variable QStyleOptionViewItem::decorationPosition
4496 \brief the position of the decoration for the item
4497
4498 The default value is \l Left.
4499
4500 \sa Position
4501*/
4502
4503/*!
4504 \variable QStyleOptionViewItem::decorationSize
4505 \brief the size of the decoration for the item
4506
4507 The default value is QSize(-1, -1), i.e. an invalid size.
4508
4509 \sa decorationAlignment, decorationPosition
4510*/
4511
4512/*!
4513 \variable QStyleOptionViewItem::font
4514 \brief the font used for the item
4515
4516 By default, the application's default font is used.
4517
4518 \sa QFont
4519*/
4520
4521/*!
4522 \fn T qstyleoption_cast<T>(const QStyleOption *option)
4523 \relates QStyleOption
4524
4525 Returns a T or 0 depending on the \l{QStyleOption::type}{type} and
4526 \l{QStyleOption::version}{version} of the given \a option.
4527
4528 Example:
4529
4530 \snippet doc/src/snippets/qstyleoption/main.cpp 4
4531
4532 \sa QStyleOption::type, QStyleOption::version
4533*/
4534
4535/*!
4536 \fn T qstyleoption_cast<T>(QStyleOption *option)
4537 \overload
4538 \relates QStyleOption
4539
4540 Returns a T or 0 depending on the type of the given \a option.
4541*/
4542
4543#ifndef QT_NO_TABWIDGET
4544/*!
4545 \class QStyleOptionTabWidgetFrame
4546 \brief The QStyleOptionTabWidgetFrame class is used to describe the
4547 parameters for drawing the frame around a tab widget.
4548
4549 QStyleOptionTabWidgetFrame contains all the information that
4550 QStyle functions need to draw the frame around QTabWidget.
4551
4552 For performance reasons, the access to the member variables is
4553 direct (i.e., using the \c . or \c -> operator). This low-level feel
4554 makes the structures straightforward to use and emphasizes that
4555 these are simply parameters used by the style functions.
4556
4557 For an example demonstrating how style options can be used, see
4558 the \l {widgets/styles}{Styles} example.
4559
4560 \sa QStyleOption, QTabWidget
4561*/
4562
4563/*!
4564 Constructs a QStyleOptionTabWidgetFrame, initializing the members
4565 variables to their default values.
4566*/
4567QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame()
4568 : QStyleOption(Version, SO_TabWidgetFrame), lineWidth(0), midLineWidth(0),
4569 shape(QTabBar::RoundedNorth)
4570{
4571}
4572
4573/*!
4574 \fn QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(const QStyleOptionTabWidgetFrame &other)
4575
4576 Constructs a copy of \a other.
4577*/
4578
4579/*! \internal */
4580QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(int version)
4581 : QStyleOption(version, SO_TabWidgetFrame), lineWidth(0), midLineWidth(0),
4582 shape(QTabBar::RoundedNorth)
4583{
4584}
4585
4586/*!
4587 \enum QStyleOptionTabWidgetFrame::StyleOptionType
4588
4589 This enum is used to hold information about the type of the style option, and
4590 is defined for each QStyleOption subclass.
4591
4592 \value Type The type of style option provided (\l{SO_TabWidgetFrame} for this class).
4593
4594 The type is used internally by QStyleOption, its subclasses, and
4595 qstyleoption_cast() to determine the type of style option. In
4596 general you do not need to worry about this unless you want to
4597 create your own QStyleOption subclass and your own styles.
4598
4599 \sa StyleOptionVersion
4600*/
4601
4602/*!
4603 \enum QStyleOptionTabWidgetFrame::StyleOptionVersion
4604
4605 This enum is used to hold information about the version of the style option, and
4606 is defined for each QStyleOption subclass.
4607
4608 \value Version 1
4609
4610 The version is used by QStyleOption subclasses to implement
4611 extensions without breaking compatibility. If you use
4612 qstyleoption_cast(), you normally do not need to check it.
4613
4614 \sa StyleOptionType
4615*/
4616
4617/*!
4618 \variable QStyleOptionTabWidgetFrame::lineWidth
4619 \brief the line width for drawing the panel
4620
4621 The default value is 0.
4622*/
4623
4624/*!
4625 \variable QStyleOptionTabWidgetFrame::midLineWidth
4626 \brief the mid-line width for drawing the panel
4627
4628 The mid line width is usually used in drawing sunken or raised
4629 frames. The default value is 0.
4630*/
4631
4632/*!
4633 \variable QStyleOptionTabWidgetFrame::shape
4634 \brief the tab shape used to draw the tabs
4635
4636 The default value is QTabBar::RoundedNorth.
4637*/
4638
4639/*!
4640 \variable QStyleOptionTabWidgetFrame::tabBarSize
4641 \brief the size of the tab bar
4642
4643 The default value is QSize(-1, -1), i.e. an invalid size.
4644*/
4645
4646/*!
4647 \variable QStyleOptionTabWidgetFrame::rightCornerWidgetSize
4648 \brief the size of the right-corner widget
4649
4650 The default value is QSize(-1, -1), i.e. an invalid size.
4651*/
4652
4653/*! \variable QStyleOptionTabWidgetFrame::leftCornerWidgetSize
4654 \brief the size of the left-corner widget
4655
4656 The default value is QSize(-1, -1), i.e. an invalid size.
4657*/
4658#endif // QT_NO_TABWIDGET
4659
4660#ifndef QT_NO_TABBAR
4661
4662/*!
4663 \class QStyleOptionTabBarBase
4664 \brief The QStyleOptionTabBarBase class is used to describe
4665 the base of a tab bar, i.e. the part that the tab bar usually
4666 overlaps with.
4667
4668 QStyleOptionTabBarBase contains all the information that QStyle
4669 functions need to draw the tab bar base. Note that this is only
4670 drawn for a standalone QTabBar (one that isn't part of a
4671 QTabWidget).
4672
4673 For performance reasons, the access to the member variables is
4674 direct (i.e., using the \c . or \c -> operator). This low-level feel
4675 makes the structures straightforward to use and emphasizes that
4676 these are simply parameters used by the style functions.
4677
4678 For an example demonstrating how style options can be used, see
4679 the \l {widgets/styles}{Styles} example.
4680
4681 \sa QStyleOption, QTabBar::drawBase()
4682*/
4683
4684/*!
4685 Construct a QStyleOptionTabBarBase, initializing the members
4686 vaiables to their default values.
4687*/
4688QStyleOptionTabBarBase::QStyleOptionTabBarBase()
4689 : QStyleOption(Version, SO_TabBarBase), shape(QTabBar::RoundedNorth)
4690{
4691}
4692
4693/*! \internal */
4694QStyleOptionTabBarBase::QStyleOptionTabBarBase(int version)
4695 : QStyleOption(version, SO_TabBarBase), shape(QTabBar::RoundedNorth)
4696{
4697}
4698
4699/*!
4700 \fn QStyleOptionTabBarBase::QStyleOptionTabBarBase(const QStyleOptionTabBarBase &other)
4701
4702 Constructs a copy of \a other.
4703*/
4704
4705/*!
4706 \enum QStyleOptionTabBarBase::StyleOptionType
4707
4708 This enum is used to hold information about the type of the style option, and
4709 is defined for each QStyleOption subclass.
4710
4711 \value Type The type of style option provided (\l{SO_TabBarBase} for this class).
4712
4713 The type is used internally by QStyleOption, its subclasses, and
4714 qstyleoption_cast() to determine the type of style option. In
4715 general you do not need to worry about this unless you want to
4716 create your own QStyleOption subclass and your own styles.
4717
4718 \sa StyleOptionVersion
4719*/
4720
4721/*!
4722 \enum QStyleOptionTabBarBase::StyleOptionVersion
4723
4724 This enum is used to hold information about the version of the style option, and
4725 is defined for each QStyleOption subclass.
4726
4727 \value Version 1
4728
4729 The version is used by QStyleOption subclasses to implement
4730 extensions without breaking compatibility. If you use
4731 qstyleoption_cast(), you normally do not need to check it.
4732
4733 \sa StyleOptionType
4734*/
4735
4736/*!
4737 \variable QStyleOptionTabBarBase::shape
4738 \brief the shape of the tab bar
4739
4740 The default value is QTabBar::RoundedNorth.
4741*/
4742
4743/*!
4744 \variable QStyleOptionTabBarBase::tabBarRect
4745 \brief the rectangle containing all the tabs
4746
4747 The default value is a null rectangle, i.e. a rectangle with both
4748 the width and the height set to 0.
4749*/
4750
4751/*!
4752 \variable QStyleOptionTabBarBase::selectedTabRect
4753 \brief the rectangle containing the selected tab
4754
4755 This rectangle is contained within the tabBarRect. The default
4756 value is a null rectangle, i.e. a rectangle with both the width
4757 and the height set to 0.
4758*/
4759
4760
4761/*!
4762 \class QStyleOptionTabBarBaseV2
4763 \brief The QStyleOptionTabBarBaseV2 class is used to describe
4764 the base of a tab bar, i.e. the part that the tab bar usually
4765 overlaps with.
4766 \since 4.5
4767
4768 QStyleOptionTabBarBase contains all the information that QStyle
4769 functions need to draw the tab bar base.
4770
4771 For performance reasons, the access to the member variables is
4772 direct (i.e., using the \c . or \c -> operator). This low-level feel
4773 makes the structures straightforward to use and emphasizes that
4774 these are simply parameters used by the style functions.
4775
4776 For an example demonstrating how style options can be used, see
4777 the \l {widgets/styles}{Styles} example.
4778
4779 \sa QStyleOption, QTabBar::drawBase()
4780*/
4781
4782/*!
4783 \enum QStyleOptionTabBarBaseV2::StyleOptionVersion
4784
4785 This enum is used to hold information about the version of the style option, and
4786 is defined for each QStyleOption subclass.
4787
4788 \value Version 2
4789
4790 The version is used by QStyleOption subclasses to implement
4791 extensions without breaking compatibility. If you use
4792 qstyleoption_cast(), you normally do not need to check it.
4793
4794 \sa StyleOptionType
4795*/
4796
4797/*!
4798 \variable QStyleOptionTabBarBaseV2::documentMode
4799 \brief whether the tabbar is in document mode.
4800
4801 The default value is false;
4802*/
4803
4804/*!
4805 Construct a QStyleOptionTabBarBaseV2, initializing the members
4806 vaiables to their default values.
4807*/
4808QStyleOptionTabBarBaseV2::QStyleOptionTabBarBaseV2()
4809 : QStyleOptionTabBarBase(Version)
4810 , documentMode(false)
4811{
4812}
4813
4814/*!
4815 \fn QStyleOptionTabBarBaseV2::QStyleOptionTabBarBaseV2(const QStyleOptionTabBarBaseV2 &other)
4816
4817 Constructs a copy of \a other.
4818*/
4819
4820/*!
4821 Constructs a copy of \a other.
4822*/
4823QStyleOptionTabBarBaseV2::QStyleOptionTabBarBaseV2(const QStyleOptionTabBarBase &other)
4824 : QStyleOptionTabBarBase(Version)
4825{
4826 (void)QStyleOptionTabBarBaseV2::operator=(other);
4827}
4828
4829/*!
4830 Constructs a QStyleOptionTabBarBaseV2 copy of the \a other style option
4831 which can be either of the QStyleOptionTabBarBaseV2, or QStyleOptionTabBarBase types.
4832
4833 If the other style option's version is not 1, the new style option's
4834 \c documentMode is set to false. If its version is 2, its \c documentMode value
4835 is simply copied to the new style option.
4836*/
4837QStyleOptionTabBarBaseV2 &QStyleOptionTabBarBaseV2::operator = (const QStyleOptionTabBarBase &other)
4838{
4839 QStyleOptionTabBarBase::operator=(other);
4840 const QStyleOptionTabBarBaseV2 *v2 = qstyleoption_cast<const QStyleOptionTabBarBaseV2*>(&other);
4841 documentMode = v2 ? v2->documentMode : false;
4842 return *this;
4843}
4844
4845/*! \internal */
4846QStyleOptionTabBarBaseV2::QStyleOptionTabBarBaseV2(int version)
4847 : QStyleOptionTabBarBase(version)
4848{
4849}
4850
4851#endif // QT_NO_TABBAR
4852
4853#ifndef QT_NO_SIZEGRIP
4854/*!
4855 \class QStyleOptionSizeGrip
4856 \brief The QStyleOptionSizeGrip class is used to describe the
4857 parameter for drawing a size grip.
4858 \since 4.2
4859
4860 QStyleOptionButton contains all the information that QStyle
4861 functions need to draw QSizeGrip.
4862
4863 For performance reasons, the access to the member variables is
4864 direct (i.e., using the \c . or \c -> operator). This low-level feel
4865 makes the structures straightforward to use and emphasizes that
4866 these are simply parameters used by the style functions.
4867
4868 For an example demonstrating how style options can be used, see
4869 the \l {widgets/styles}{Styles} example.
4870
4871 \sa QStyleOption, QStyleOptionComplex, QSizeGrip
4872*/
4873
4874/*!
4875 Constructs a QStyleOptionSizeGrip.
4876*/
4877QStyleOptionSizeGrip::QStyleOptionSizeGrip()
4878 : QStyleOptionComplex(Version, Type), corner(Qt::BottomRightCorner)
4879{
4880}
4881
4882/*!
4883 \fn QStyleOptionSizeGrip::QStyleOptionSizeGrip(const QStyleOptionSizeGrip &other)
4884
4885 Constructs a copy of the \a other style option.
4886*/
4887
4888/*!
4889 \internal
4890*/
4891QStyleOptionSizeGrip::QStyleOptionSizeGrip(int version)
4892 : QStyleOptionComplex(version, Type), corner(Qt::BottomRightCorner)
4893{
4894}
4895
4896/*!
4897 \variable QStyleOptionSizeGrip::corner
4898
4899 The corner in which the size grip is located.
4900*/
4901
4902/*!
4903 \enum QStyleOptionSizeGrip::StyleOptionType
4904
4905 This enum is used to hold information about the type of the style option, and
4906 is defined for each QStyleOption subclass.
4907
4908 \value Type The type of style option provided (\l{SO_TabBarBase} for this class).
4909
4910 The type is used internally by QStyleOption, its subclasses, and
4911 qstyleoption_cast() to determine the type of style option. In
4912 general you do not need to worry about this unless you want to
4913 create your own QStyleOption subclass and your own styles.
4914
4915 \sa StyleOptionVersion
4916*/
4917
4918/*!
4919 \enum QStyleOptionSizeGrip::StyleOptionVersion
4920
4921 This enum is used to hold information about the version of the style option, and
4922 is defined for each QStyleOption subclass.
4923
4924 \value Version 1
4925
4926 The version is used by QStyleOption subclasses to implement
4927 extensions without breaking compatibility. If you use
4928 qstyleoption_cast(), you normally do not need to check it.
4929
4930 \sa StyleOptionType
4931*/
4932#endif // QT_NO_SIZEGRIP
4933
4934/*!
4935 \class QStyleOptionGraphicsItem
4936 \brief The QStyleOptionGraphicsItem class is used to describe
4937 the parameters needed to draw a QGraphicsItem.
4938 \since 4.2
4939 \ingroup multimedia
4940
4941 For performance reasons, the access to the member variables is
4942 direct (i.e., using the \c . or \c -> operator). This low-level feel
4943 makes the structures straightforward to use and emphasizes that
4944 these are simply parameters.
4945
4946 For an example demonstrating how style options can be used, see
4947 the \l {widgets/styles}{Styles} example.
4948
4949 \sa QStyleOption, QGraphicsItem::paint()
4950*/
4951
4952/*!
4953 \enum QStyleOptionGraphicsItem::StyleOptionType
4954
4955 This enum is used to hold information about the type of the style option, and
4956 is defined for each QStyleOption subclass.
4957
4958 \value Type The type of style option provided (\l SO_GraphicsItem for this class).
4959
4960 The type is used internally by QStyleOption, its subclasses, and
4961 qstyleoption_cast() to determine the type of style option. In
4962 general you do not need to worry about this unless you want to
4963 create your own QStyleOption subclass and your own styles.
4964
4965 \sa StyleOptionVersion
4966*/
4967
4968/*!
4969 \enum QStyleOptionGraphicsItem::StyleOptionVersion
4970
4971 This enum is used to hold information about the version of the style option, and
4972 is defined for each QStyleOption subclass.
4973
4974 \value Version 1
4975
4976 The version is used by QStyleOption subclasses to implement
4977 extensions without breaking compatibility. If you use
4978 qstyleoption_cast(), you normally do not need to check it.
4979
4980 \sa StyleOptionType
4981*/
4982
4983/*!
4984 Constructs a QStyleOptionGraphicsItem. The levelOfDetail parameter is
4985 initialized to 1.
4986*/
4987QStyleOptionGraphicsItem::QStyleOptionGraphicsItem()
4988 : QStyleOption(Version, Type), levelOfDetail(1)
4989{
4990}
4991
4992/*!
4993 \internal
4994*/
4995QStyleOptionGraphicsItem::QStyleOptionGraphicsItem(int version)
4996 : QStyleOption(version, Type), levelOfDetail(1)
4997{
4998}
4999
5000/*!
5001 \fn QStyleOptionGraphicsItem::QStyleOptionGraphicsItem(const QStyleOptionGraphicsItem &other)
5002
5003 Constructs a copy of \a other.
5004*/
5005
5006/*!
5007 \variable QStyleOptionGraphicsItem::exposedRect
5008 \brief the exposed rectangle, in item coordinates
5009
5010 Make use of this rectangle to speed up item drawing when only parts of the
5011 item are exposed. If the whole item is exposed, this rectangle will be the
5012 same as QGraphicsItem::boundingRect().
5013*/
5014
5015/*!
5016 \variable QStyleOptionGraphicsItem::matrix
5017 \brief the complete transformation matrix for the item
5018
5019 This matrix is the sum of the item's scene matrix and the matrix of the
5020 painter used for drawing the item. It is provided for convenience,
5021 allowing anvanced level-of-detail metrics that can be used to speed up
5022 item drawing.
5023
5024 To find the dimentions of an item in screen coordinates (i.e., pixels),
5025 you can use the mapping functions of QMatrix, such as QMatrix::map().
5026
5027 \sa QStyleOptionGraphicsItem::levelOfDetail
5028*/
5029
5030/*!
5031 \variable QStyleOptionGraphicsItem::levelOfDetail
5032 \brief a simple metric for determining an item's level of detail
5033
5034 This simple metric provides an easy way to determine the level of detail
5035 for an item. Its value represents the maximum value of the height and
5036 width of a unity rectangle, mapped using the complete transformation
5037 matrix of the painter used to draw the item. By default, if no
5038 transformations are applied, its value is 1. If zoomed out 1:2, the level
5039 of detail will be 0.5, and if zoomed in 2:1, its value is 2.
5040
5041 For more advanced level-of-detail metrics, use
5042 QStyleOptionGraphicsItem::matrix directly.
5043
5044 \sa QStyleOptionGraphicsItem::matrix
5045*/
5046
5047/*!
5048 \class QStyleHintReturn
5049 \brief The QStyleHintReturn class provides style hints that return more
5050 than basic data types.
5051
5052 \ingroup appearance
5053
5054 QStyleHintReturn and its subclasses are used to pass information
5055 from a style back to the querying widget. This is most useful
5056 when the return value from QStyle::styleHint() does not provide enough
5057 detail; for example, when a mask is to be returned.
5058
5059 \omit
5060 ### --Sam
5061 \endomit
5062*/
5063
5064/*!
5065 \enum QStyleHintReturn::HintReturnType
5066
5067 \value SH_Default QStyleHintReturn
5068 \value SH_Mask \l QStyle::SH_RubberBand_Mask QStyle::SH_FocusFrame_Mask
5069 \value SH_Variant \l QStyle::SH_TextControl_FocusIndicatorTextCharFormat
5070*/
5071
5072/*!
5073 \enum QStyleHintReturn::StyleOptionType
5074
5075 This enum is used to hold information about the type of the style option, and
5076 is defined for each QStyleHintReturn subclass.
5077
5078 \value Type The type of style option provided (\l SH_Default for
5079 this class).
5080
5081 The type is used internally by QStyleHintReturn, its subclasses, and
5082 qstyleoption_cast() to determine the type of style option. In
5083 general you do not need to worry about this unless you want to
5084 create your own QStyleHintReturn subclass and your own styles.
5085
5086 \sa StyleOptionVersion
5087*/
5088
5089/*!
5090 \enum QStyleHintReturn::StyleOptionVersion
5091
5092 This enum is used to hold information about the version of the style option, and
5093 is defined for each QStyleHintReturn subclass.
5094
5095 \value Version 1
5096
5097 The version is used by QStyleHintReturn subclasses to implement
5098 extensions without breaking compatibility. If you use
5099 qstyleoption_cast(), you normally do not need to check it.
5100
5101 \sa StyleOptionType
5102*/
5103
5104/*!
5105 \variable QStyleHintReturn::type
5106 \brief the type of the style hint container
5107
5108 \sa HintReturnType
5109*/
5110
5111/*!
5112 \variable QStyleHintReturn::version
5113 \brief the version of the style hint return container
5114
5115 This value can be used by subclasses to implement extensions
5116 without breaking compatibility. If you use qstyleoption_cast<T>(), you
5117 normally do not need to check it.
5118*/
5119
5120/*!
5121 Constructs a QStyleHintReturn with version \a version and type \a
5122 type.
5123
5124 The version has no special meaning for QStyleHintReturn; it can be
5125 used by subclasses to distinguish between different version of
5126 the same hint type.
5127
5128 \sa QStyleOption::version, QStyleOption::type
5129*/
5130
5131QStyleHintReturn::QStyleHintReturn(int version, int type)
5132 : version(version), type(type)
5133{
5134}
5135
5136/*!
5137 \internal
5138*/
5139
5140QStyleHintReturn::~QStyleHintReturn()
5141{
5142
5143}
5144
5145/*!
5146 \class QStyleHintReturnMask
5147 \brief The QStyleHintReturnMask class provides style hints that return a QRegion.
5148
5149 \ingroup appearance
5150
5151 \omit
5152 ### --Sam
5153 \endomit
5154*/
5155
5156/*!
5157 \variable QStyleHintReturnMask::region
5158 \brief the region for style hints that return a QRegion
5159*/
5160
5161/*!
5162 Constructs a QStyleHintReturnMask. The member variables are
5163 initialized to default values.
5164*/
5165QStyleHintReturnMask::QStyleHintReturnMask() : QStyleHintReturn(Version, Type)
5166{
5167}
5168
5169/*!
5170 \enum QStyleHintReturnMask::StyleOptionType
5171
5172 This enum is used to hold information about the type of the style option, and
5173 is defined for each QStyleHintReturn subclass.
5174
5175 \value Type The type of style option provided (\l{SH_Mask} for
5176 this class).
5177
5178 The type is used internally by QStyleHintReturn, its subclasses, and
5179 qstyleoption_cast() to determine the type of style option. In
5180 general you do not need to worry about this unless you want to
5181 create your own QStyleHintReturn subclass and your own styles.
5182
5183 \sa StyleOptionVersion
5184*/
5185
5186/*!
5187 \enum QStyleHintReturnMask::StyleOptionVersion
5188
5189 This enum is used to hold information about the version of the style option, and
5190 is defined for each QStyleHintReturn subclass.
5191
5192 \value Version 1
5193
5194 The version is used by QStyleHintReturn subclasses to implement
5195 extensions without breaking compatibility. If you use
5196 qstyleoption_cast(), you normally do not need to check it.
5197
5198 \sa StyleOptionType
5199*/
5200
5201/*!
5202 \class QStyleHintReturnVariant
5203 \brief The QStyleHintReturnVariant class provides style hints that return a QVariant.
5204 \since 4.3
5205 \ingroup appearance
5206*/
5207
5208/*!
5209 \variable QStyleHintReturnVariant::variant
5210 \brief the variant for style hints that return a QVariant
5211*/
5212
5213/*!
5214 Constructs a QStyleHintReturnVariant. The member variables are
5215 initialized to default values.
5216*/
5217QStyleHintReturnVariant::QStyleHintReturnVariant() : QStyleHintReturn(Version, Type)
5218{
5219}
5220
5221/*!
5222 \enum QStyleHintReturnVariant::StyleOptionType
5223
5224 This enum is used to hold information about the type of the style option, and
5225 is defined for each QStyleHintReturn subclass.
5226
5227 \value Type The type of style option provided (\l{SH_Variant} for
5228 this class).
5229
5230 The type is used internally by QStyleHintReturn, its subclasses, and
5231 qstyleoption_cast() to determine the type of style option. In
5232 general you do not need to worry about this unless you want to
5233 create your own QStyleHintReturn subclass and your own styles.
5234
5235 \sa StyleOptionVersion
5236*/
5237
5238/*!
5239 \enum QStyleHintReturnVariant::StyleOptionVersion
5240
5241 This enum is used to hold information about the version of the style option, and
5242 is defined for each QStyleHintReturn subclass.
5243
5244 \value Version 1
5245
5246 The version is used by QStyleHintReturn subclasses to implement
5247 extensions without breaking compatibility. If you use
5248 qstyleoption_cast(), you normally do not need to check it.
5249
5250 \sa StyleOptionType
5251*/
5252
5253/*!
5254 \fn T qstyleoption_cast<T>(const QStyleHintReturn *hint)
5255 \relates QStyleHintReturn
5256
5257 Returns a T or 0 depending on the \l{QStyleHintReturn::type}{type}
5258 and \l{QStyleHintReturn::version}{version} of \a hint.
5259
5260 Example:
5261
5262 \snippet doc/src/snippets/code/src_gui_styles_qstyleoption.cpp 0
5263
5264 \sa QStyleHintReturn::type, QStyleHintReturn::version
5265*/
5266
5267/*!
5268 \fn T qstyleoption_cast<T>(QStyleHintReturn *hint)
5269 \overload
5270 \relates QStyleHintReturn
5271
5272 Returns a T or 0 depending on the type of \a hint.
5273*/
5274
5275#if !defined(QT_NO_DEBUG) && !defined(QT_NO_DEBUG_STREAM)
5276QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType)
5277{
5278 switch (optionType) {
5279 case QStyleOption::SO_Default:
5280 debug << "SO_Default"; break;
5281 case QStyleOption::SO_FocusRect:
5282 debug << "SO_FocusRect"; break;
5283 case QStyleOption::SO_Button:
5284 debug << "SO_Button"; break;
5285 case QStyleOption::SO_Tab:
5286 debug << "SO_Tab"; break;
5287 case QStyleOption::SO_MenuItem:
5288 debug << "SO_MenuItem"; break;
5289 case QStyleOption::SO_Frame:
5290 debug << "SO_Frame"; break;
5291 case QStyleOption::SO_ProgressBar:
5292 debug << "SO_ProgressBar"; break;
5293 case QStyleOption::SO_ToolBox:
5294 debug << "SO_ToolBox"; break;
5295 case QStyleOption::SO_Header:
5296 debug << "SO_Header"; break;
5297 case QStyleOption::SO_Q3DockWindow:
5298 debug << "SO_Q3DockWindow"; break;
5299 case QStyleOption::SO_DockWidget:
5300 debug << "SO_DockWidget"; break;
5301 case QStyleOption::SO_Q3ListViewItem:
5302 debug << "SO_Q3ListViewItem"; break;
5303 case QStyleOption::SO_ViewItem:
5304 debug << "SO_ViewItem"; break;
5305 case QStyleOption::SO_TabWidgetFrame:
5306 debug << "SO_TabWidgetFrame"; break;
5307 case QStyleOption::SO_TabBarBase:
5308 debug << "SO_TabBarBase"; break;
5309 case QStyleOption::SO_RubberBand:
5310 debug << "SO_RubberBand"; break;
5311 case QStyleOption::SO_Complex:
5312 debug << "SO_Complex"; break;
5313 case QStyleOption::SO_Slider:
5314 debug << "SO_Slider"; break;
5315 case QStyleOption::SO_SpinBox:
5316 debug << "SO_SpinBox"; break;
5317 case QStyleOption::SO_ToolButton:
5318 debug << "SO_ToolButton"; break;
5319 case QStyleOption::SO_ComboBox:
5320 debug << "SO_ComboBox"; break;
5321 case QStyleOption::SO_Q3ListView:
5322 debug << "SO_Q3ListView"; break;
5323 case QStyleOption::SO_TitleBar:
5324 debug << "SO_TitleBar"; break;
5325 case QStyleOption::SO_CustomBase:
5326 debug << "SO_CustomBase"; break;
5327 case QStyleOption::SO_GroupBox:
5328 debug << "SO_GroupBox"; break;
5329 case QStyleOption::SO_ToolBar:
5330 debug << "SO_ToolBar"; break;
5331 case QStyleOption::SO_ComplexCustomBase:
5332 debug << "SO_ComplexCustomBase"; break;
5333 case QStyleOption::SO_SizeGrip:
5334 debug << "SO_SizeGrip"; break;
5335 case QStyleOption::SO_GraphicsItem:
5336 debug << "SO_GraphicsItem"; break;
5337 }
5338 return debug;
5339}
5340
5341QDebug operator<<(QDebug debug, const QStyleOption &option)
5342{
5343 debug << "QStyleOption(";
5344 debug << QStyleOption::OptionType(option.type);
5345 debug << "," << (option.direction == Qt::RightToLeft ? "RightToLeft" : "LeftToRight");
5346 debug << "," << option.state;
5347 debug << "," << option.rect;
5348 debug << ")";
5349 return debug;
5350}
5351#endif
5352
5353QT_END_NAMESPACE
Note: See TracBrowser for help on using the repository browser.