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

Last change on this file since 1147 was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

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