~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/gui/styles/qstyleoption.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 1992-2005 Trolltech AS. All rights reserved.
 
4
**
 
5
** This file is part of the style module of the Qt Toolkit.
 
6
**
 
7
** This file may be distributed under the terms of the Q Public License
 
8
** as defined by Trolltech AS of Norway and appearing in the file
 
9
** LICENSE.QPL included in the packaging of this file.
 
10
**
 
11
** This file may be distributed and/or modified under the terms of the
 
12
** GNU General Public License version 2 as published by the Free Software
 
13
** Foundation and appearing in the file LICENSE.GPL included in the
 
14
** packaging of this file.
 
15
**
 
16
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
 
17
**   information about Qt Commercial License Agreements.
 
18
** See http://www.trolltech.com/qpl/ for QPL licensing information.
 
19
** See http://www.trolltech.com/gpl/ for GPL licensing information.
 
20
**
 
21
** Contact info@trolltech.com if any conditions of this licensing are
 
22
** not clear to you.
 
23
**
 
24
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
 
25
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 
26
**
 
27
****************************************************************************/
 
28
 
 
29
#ifndef QSTYLEOPTION_H
 
30
#define QSTYLEOPTION_H
 
31
 
 
32
#include "QtGui/qabstractspinbox.h"
 
33
#include "QtGui/qicon.h"
 
34
#include "QtGui/qslider.h"
 
35
#include "QtGui/qstyle.h"
 
36
#include "QtGui/qtabbar.h"
 
37
#include "QtGui/qtabwidget.h"
 
38
#include "QtGui/qrubberband.h"
 
39
 
 
40
class QDebug;
 
41
 
 
42
class Q_GUI_EXPORT QStyleOption
 
43
{
 
44
public:
 
45
    enum OptionType {
 
46
                      SO_Default, SO_FocusRect, SO_Button, SO_Tab, SO_MenuItem,
 
47
                      SO_Frame, SO_ProgressBar, SO_ToolBox, SO_Header, SO_Q3DockWindow,
 
48
                      SO_DockWidget, SO_Q3ListViewItem, SO_ViewItem, SO_TabWidgetFrame,
 
49
                      SO_TabBarBase, SO_RubberBand,
 
50
 
 
51
                      SO_Complex = 0xf0000, SO_Slider, SO_SpinBox, SO_ToolButton, SO_ComboBox,
 
52
                      SO_Q3ListView, SO_TitleBar,
 
53
 
 
54
                      SO_CustomBase = 0xf00,
 
55
                      SO_ComplexCustomBase = 0xf000000
 
56
                    };
 
57
 
 
58
    enum { Type = SO_Default };
 
59
    enum { Version = 1 };
 
60
 
 
61
    int version;
 
62
    int type;
 
63
    QStyle::State state;
 
64
    Qt::LayoutDirection direction;
 
65
    QRect rect;
 
66
    QFontMetrics fontMetrics;
 
67
    QPalette palette;
 
68
 
 
69
    QStyleOption(int version = QStyleOption::Version, int type = SO_Default);
 
70
    QStyleOption(const QStyleOption &other);
 
71
    ~QStyleOption();
 
72
 
 
73
    void init(const QWidget *w);
 
74
    QStyleOption &operator=(const QStyleOption &other);
 
75
};
 
76
 
 
77
class Q_GUI_EXPORT QStyleOptionFocusRect : public QStyleOption
 
78
{
 
79
public:
 
80
    enum { Type = SO_FocusRect };
 
81
    enum { Version = 1 };
 
82
 
 
83
    QColor backgroundColor;
 
84
 
 
85
    QStyleOptionFocusRect();
 
86
    QStyleOptionFocusRect(const QStyleOptionFocusRect &other) : QStyleOption(Version, Type) { *this = other; }
 
87
 
 
88
protected:
 
89
    QStyleOptionFocusRect(int version);
 
90
};
 
91
 
 
92
class Q_GUI_EXPORT QStyleOptionFrame : public QStyleOption
 
93
{
 
94
public:
 
95
    enum { Type = SO_Frame };
 
96
    enum { Version = 1 };
 
97
 
 
98
    int lineWidth;
 
99
    int midLineWidth;
 
100
 
 
101
    QStyleOptionFrame();
 
102
    QStyleOptionFrame(const QStyleOptionFrame &other) : QStyleOption(Version, Type) { *this = other; }
 
103
 
 
104
protected:
 
105
    QStyleOptionFrame(int version);
 
106
};
 
107
 
 
108
class Q_GUI_EXPORT QStyleOptionTabWidgetFrame : public QStyleOption
 
109
{
 
110
public:
 
111
    enum { Type = SO_TabWidgetFrame };
 
112
    enum { Version = 1 };
 
113
 
 
114
    int lineWidth;
 
115
    int midLineWidth;
 
116
    QTabBar::Shape shape;
 
117
    QSize tabBarSize;
 
118
    QSize rightCornerWidgetSize;
 
119
    QSize leftCornerWidgetSize;
 
120
 
 
121
    QStyleOptionTabWidgetFrame();
 
122
    inline QStyleOptionTabWidgetFrame(const QStyleOptionTabWidgetFrame &other)
 
123
        : QStyleOption(Version, Type) { *this = other; }
 
124
 
 
125
protected:
 
126
    QStyleOptionTabWidgetFrame(int version);
 
127
};
 
128
 
 
129
class Q_GUI_EXPORT QStyleOptionTabBarBase : public QStyleOption
 
130
{
 
131
public:
 
132
    enum { Type = SO_TabBarBase };
 
133
    enum { Version = 1 };
 
134
 
 
135
    QTabBar::Shape shape;
 
136
    QRect tabBarRect;
 
137
    QRect selectedTabRect;
 
138
 
 
139
    QStyleOptionTabBarBase();
 
140
    QStyleOptionTabBarBase(const QStyleOptionTabBarBase &other) : QStyleOption(Version, Type) { *this = other; }
 
141
 
 
142
protected:
 
143
    QStyleOptionTabBarBase(int version);
 
144
};
 
145
 
 
146
class Q_GUI_EXPORT QStyleOptionHeader : public QStyleOption
 
147
{
 
148
public:
 
149
    enum { Type = SO_Header };
 
150
    enum { Version = 1 };
 
151
 
 
152
    enum SectionPosition { Beginning, Middle, End, OnlyOneSection };
 
153
    enum SelectedPosition { NotAdjacent, NextIsSelected, PreviousIsSelected,
 
154
                            NextAndPreviousAreSelected };
 
155
    enum SortIndicator { None, SortUp, SortDown };
 
156
 
 
157
    int section;
 
158
    QString text;
 
159
    Qt::Alignment textAlignment;
 
160
    QIcon icon;
 
161
    Qt::Alignment iconAlignment;
 
162
    SectionPosition position;
 
163
    SelectedPosition selectedPosition;
 
164
    SortIndicator sortIndicator;
 
165
    Qt::Orientation orientation;
 
166
 
 
167
    QStyleOptionHeader();
 
168
    QStyleOptionHeader(const QStyleOptionHeader &other) : QStyleOption(Version, Type) { *this = other; }
 
169
 
 
170
protected:
 
171
    QStyleOptionHeader(int version);
 
172
};
 
173
 
 
174
class Q_GUI_EXPORT QStyleOptionButton : public QStyleOption
 
175
{
 
176
public:
 
177
    enum { Type = SO_Button };
 
178
    enum { Version = 1 };
 
179
 
 
180
    enum ButtonFeature { None = 0x00, Flat = 0x01, HasMenu = 0x02, DefaultButton = 0x04,
 
181
                         AutoDefaultButton = 0x08 };
 
182
    Q_DECLARE_FLAGS(ButtonFeatures, ButtonFeature)
 
183
 
 
184
    ButtonFeatures features;
 
185
    QString text;
 
186
    QIcon icon;
 
187
    QSize iconSize;
 
188
 
 
189
    QStyleOptionButton();
 
190
    QStyleOptionButton(const QStyleOptionButton &other) : QStyleOption(Version, Type) { *this = other; }
 
191
 
 
192
protected:
 
193
    QStyleOptionButton(int version);
 
194
};
 
195
 
 
196
Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionButton::ButtonFeatures)
 
197
 
 
198
class Q_GUI_EXPORT QStyleOptionTab : public QStyleOption
 
199
{
 
200
public:
 
201
    enum { Type = SO_Tab };
 
202
    enum { Version = 1 };
 
203
 
 
204
    enum TabPosition { Beginning, Middle, End, OnlyOneTab };
 
205
    enum SelectedPosition { NotAdjacent, NextIsSelected, PreviousIsSelected };
 
206
    enum CornerWidget { NoCornerWidgets = 0x00, LeftCornerWidget = 0x01,
 
207
                        RightCornerWidget = 0x02 };
 
208
    Q_DECLARE_FLAGS(CornerWidgets, CornerWidget)
 
209
 
 
210
    QTabBar::Shape shape;
 
211
    QString text;
 
212
    QIcon icon;
 
213
    int row;
 
214
    TabPosition position;
 
215
    SelectedPosition selectedPosition;
 
216
    CornerWidgets cornerWidgets;
 
217
 
 
218
    QStyleOptionTab();
 
219
    QStyleOptionTab(const QStyleOptionTab &other) : QStyleOption(Version, Type) { *this = other; }
 
220
 
 
221
protected:
 
222
    QStyleOptionTab(int version);
 
223
};
 
224
 
 
225
Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionTab::CornerWidgets)
 
226
 
 
227
class Q_GUI_EXPORT QStyleOptionProgressBar : public QStyleOption
 
228
{
 
229
public:
 
230
    enum { Type = SO_ProgressBar };
 
231
    enum { Version = 1 };
 
232
 
 
233
    int minimum;
 
234
    int maximum;
 
235
    int progress;
 
236
    QString text;
 
237
    Qt::Alignment textAlignment;
 
238
    bool textVisible;
 
239
 
 
240
    QStyleOptionProgressBar();
 
241
    QStyleOptionProgressBar(const QStyleOptionProgressBar &other) : QStyleOption(Version, Type) { *this = other; }
 
242
 
 
243
protected:
 
244
    QStyleOptionProgressBar(int version);
 
245
};
 
246
 
 
247
class Q_GUI_EXPORT QStyleOptionMenuItem : public QStyleOption
 
248
{
 
249
public:
 
250
    enum { Type = SO_MenuItem };
 
251
    enum { Version = 1 };
 
252
 
 
253
    enum MenuItemType { Normal, DefaultItem, Separator, SubMenu, Scroller, TearOff, Margin,
 
254
                        EmptyArea };
 
255
    enum CheckType { NotCheckable, Exclusive, NonExclusive };
 
256
 
 
257
    MenuItemType menuItemType;
 
258
    CheckType checkType;
 
259
    bool checked;
 
260
    bool menuHasCheckableItems;
 
261
    QRect menuRect;
 
262
    QString text;
 
263
    QIcon icon;
 
264
    int maxIconWidth;
 
265
    int tabWidth;
 
266
    QFont font;
 
267
 
 
268
    QStyleOptionMenuItem();
 
269
    QStyleOptionMenuItem(const QStyleOptionMenuItem &other) : QStyleOption(Version, Type) { *this = other; }
 
270
 
 
271
protected:
 
272
    QStyleOptionMenuItem(int version);
 
273
};
 
274
 
 
275
class Q_GUI_EXPORT QStyleOptionQ3ListViewItem : public QStyleOption
 
276
{
 
277
public:
 
278
    enum { Type = SO_Q3ListViewItem };
 
279
    enum { Version = 1 };
 
280
 
 
281
    enum Q3ListViewItemFeature { None = 0x00, Expandable = 0x01, MultiLine = 0x02, Visible = 0x04,
 
282
                                 ParentControl = 0x08 };
 
283
    Q_DECLARE_FLAGS(Q3ListViewItemFeatures, Q3ListViewItemFeature)
 
284
 
 
285
    Q3ListViewItemFeatures features;
 
286
    int height;
 
287
    int totalHeight;
 
288
    int itemY;
 
289
    int childCount;
 
290
 
 
291
    QStyleOptionQ3ListViewItem();
 
292
    QStyleOptionQ3ListViewItem(const QStyleOptionQ3ListViewItem &other) : QStyleOption(Version, Type) { *this = other; }
 
293
 
 
294
protected:
 
295
    QStyleOptionQ3ListViewItem(int version);
 
296
};
 
297
 
 
298
Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionQ3ListViewItem::Q3ListViewItemFeatures)
 
299
 
 
300
class Q_GUI_EXPORT QStyleOptionQ3DockWindow : public QStyleOption
 
301
{
 
302
public:
 
303
    enum { Type = SO_Q3DockWindow };
 
304
    enum { Version = 1 };
 
305
 
 
306
    bool docked;
 
307
    bool closeEnabled;
 
308
 
 
309
    QStyleOptionQ3DockWindow();
 
310
    QStyleOptionQ3DockWindow(const QStyleOptionQ3DockWindow &other) : QStyleOption(Version, Type) { *this = other; }
 
311
 
 
312
protected:
 
313
    QStyleOptionQ3DockWindow(int version);
 
314
};
 
315
 
 
316
class Q_GUI_EXPORT QStyleOptionDockWidget : public QStyleOption
 
317
{
 
318
public:
 
319
    enum { Type = SO_DockWidget };
 
320
    enum { Version = 1 };
 
321
 
 
322
    QString title;
 
323
    bool closable;
 
324
    bool movable;
 
325
    bool floatable;
 
326
 
 
327
    QStyleOptionDockWidget();
 
328
    QStyleOptionDockWidget(const QStyleOptionDockWidget &other) : QStyleOption(Version, Type) { *this = other; }
 
329
 
 
330
protected:
 
331
    QStyleOptionDockWidget(int version);
 
332
};
 
333
 
 
334
class Q_GUI_EXPORT QStyleOptionViewItem : public QStyleOption
 
335
{
 
336
public:
 
337
    enum { Type = SO_ViewItem };
 
338
    enum { Version = 1 };
 
339
 
 
340
    enum Position { Left, Right, Top, Bottom };
 
341
 
 
342
    Qt::Alignment displayAlignment;
 
343
    Qt::Alignment decorationAlignment;
 
344
    Qt::TextElideMode textElideMode;
 
345
    Position decorationPosition;
 
346
    QSize decorationSize;
 
347
    QFont font;
 
348
    bool showDecorationSelected;
 
349
 
 
350
    QStyleOptionViewItem();
 
351
    QStyleOptionViewItem(const QStyleOptionViewItem &other) : QStyleOption(Version, Type) { *this = other; }
 
352
 
 
353
protected:
 
354
    QStyleOptionViewItem(int version);
 
355
};
 
356
 
 
357
class Q_GUI_EXPORT QStyleOptionToolBox : public QStyleOption
 
358
{
 
359
public:
 
360
    enum { Type = SO_ToolBox };
 
361
    enum { Version = 1 };
 
362
 
 
363
    QString text;
 
364
    QIcon icon;
 
365
 
 
366
    QStyleOptionToolBox();
 
367
    QStyleOptionToolBox(const QStyleOptionToolBox &other) : QStyleOption(Version, Type) { *this = other; }
 
368
 
 
369
protected:
 
370
    QStyleOptionToolBox(int version);
 
371
};
 
372
 
 
373
class Q_GUI_EXPORT QStyleOptionRubberBand : public QStyleOption
 
374
{
 
375
public:
 
376
    enum { Type = SO_RubberBand };
 
377
    enum { Version = 1 };
 
378
 
 
379
    QRubberBand::Shape shape;
 
380
    bool opaque;
 
381
 
 
382
    QStyleOptionRubberBand();
 
383
    QStyleOptionRubberBand(const QStyleOptionRubberBand &other) : QStyleOption(Version, Type) { *this = other; }
 
384
 
 
385
protected:
 
386
    QStyleOptionRubberBand(int version);
 
387
};
 
388
 
 
389
// -------------------------- Complex style options -------------------------------
 
390
class Q_GUI_EXPORT QStyleOptionComplex : public QStyleOption
 
391
{
 
392
public:
 
393
    enum { Type = SO_Complex };
 
394
    enum { Version = 1 };
 
395
 
 
396
    QStyle::SubControls subControls;
 
397
    QStyle::SubControls activeSubControls;
 
398
 
 
399
    QStyleOptionComplex(int version = QStyleOptionComplex::Version, int type = SO_Complex);
 
400
    QStyleOptionComplex(const QStyleOptionComplex &other) : QStyleOption(Version, Type) { *this = other; }
 
401
};
 
402
 
 
403
class Q_GUI_EXPORT QStyleOptionSlider : public QStyleOptionComplex
 
404
{
 
405
public:
 
406
    enum { Type = SO_Slider };
 
407
    enum { Version = 1 };
 
408
 
 
409
    Qt::Orientation orientation;
 
410
    int minimum;
 
411
    int maximum;
 
412
    QSlider::TickPosition tickPosition;
 
413
    int tickInterval;
 
414
    bool upsideDown;
 
415
    int sliderPosition;
 
416
    int sliderValue;
 
417
    int singleStep;
 
418
    int pageStep;
 
419
    qreal notchTarget;
 
420
    bool dialWrapping;
 
421
 
 
422
    QStyleOptionSlider();
 
423
    QStyleOptionSlider(const QStyleOptionSlider &other) : QStyleOptionComplex(Version, Type) { *this = other; }
 
424
 
 
425
protected:
 
426
    QStyleOptionSlider(int version);
 
427
};
 
428
 
 
429
class Q_GUI_EXPORT QStyleOptionSpinBox : public QStyleOptionComplex
 
430
{
 
431
public:
 
432
    enum { Type = SO_SpinBox };
 
433
    enum { Version = 1 };
 
434
 
 
435
    QAbstractSpinBox::ButtonSymbols buttonSymbols;
 
436
    QAbstractSpinBox::StepEnabled stepEnabled;
 
437
    bool frame;
 
438
 
 
439
    QStyleOptionSpinBox();
 
440
    QStyleOptionSpinBox(const QStyleOptionSpinBox &other) : QStyleOptionComplex(Version, Type) { *this = other; }
 
441
 
 
442
protected:
 
443
    QStyleOptionSpinBox(int version);
 
444
};
 
445
 
 
446
class Q_GUI_EXPORT QStyleOptionQ3ListView : public QStyleOptionComplex
 
447
{
 
448
public:
 
449
    enum { Type = SO_Q3ListView };
 
450
    enum { Version = 1 };
 
451
 
 
452
    QList<QStyleOptionQ3ListViewItem> items;
 
453
    QPalette viewportPalette;
 
454
    QPalette::ColorRole viewportBGRole;
 
455
    int sortColumn;
 
456
    int itemMargin;
 
457
    int treeStepSize;
 
458
    bool rootIsDecorated;
 
459
 
 
460
    QStyleOptionQ3ListView();
 
461
    QStyleOptionQ3ListView(const QStyleOptionQ3ListView &other) : QStyleOptionComplex(Version, Type) { *this = other; }
 
462
 
 
463
protected:
 
464
    QStyleOptionQ3ListView(int version);
 
465
};
 
466
 
 
467
class Q_GUI_EXPORT QStyleOptionToolButton : public QStyleOptionComplex
 
468
{
 
469
public:
 
470
    enum { Type = SO_ToolButton };
 
471
    enum { Version = 1 };
 
472
 
 
473
    enum ToolButtonFeature { None = 0x00, Arrow = 0x01, Menu = 0x04, PopupDelay = 0x08 };
 
474
    Q_DECLARE_FLAGS(ToolButtonFeatures, ToolButtonFeature)
 
475
 
 
476
    ToolButtonFeatures features;
 
477
    QIcon icon;
 
478
    QSize iconSize;
 
479
    QString text;
 
480
    Qt::ArrowType arrowType;
 
481
    Qt::ToolButtonStyle toolButtonStyle;
 
482
    QPoint pos;
 
483
    QFont font;
 
484
 
 
485
    QStyleOptionToolButton();
 
486
    QStyleOptionToolButton(const QStyleOptionToolButton &other) : QStyleOptionComplex(Version, Type) { *this = other; }
 
487
 
 
488
protected:
 
489
    QStyleOptionToolButton(int version);
 
490
};
 
491
 
 
492
Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionToolButton::ToolButtonFeatures)
 
493
 
 
494
class Q_GUI_EXPORT QStyleOptionComboBox : public QStyleOptionComplex
 
495
{
 
496
public:
 
497
    enum { Type = SO_ComboBox };
 
498
    enum { Version = 1 };
 
499
 
 
500
    bool editable;
 
501
    QRect popupRect;
 
502
    bool frame;
 
503
    QString currentText;
 
504
    QIcon currentIcon;
 
505
    QSize iconSize;
 
506
 
 
507
    QStyleOptionComboBox();
 
508
    QStyleOptionComboBox(const QStyleOptionComboBox &other) : QStyleOptionComplex(Version, Type) { *this = other; }
 
509
 
 
510
protected:
 
511
    QStyleOptionComboBox(int version);
 
512
};
 
513
 
 
514
class Q_GUI_EXPORT QStyleOptionTitleBar : public QStyleOptionComplex
 
515
{
 
516
public:
 
517
    enum { Type = SO_TitleBar };
 
518
    enum { Version = 1 };
 
519
 
 
520
    QString text;
 
521
    QIcon icon;
 
522
    int titleBarState;
 
523
    Qt::WFlags titleBarFlags;
 
524
 
 
525
    QStyleOptionTitleBar();
 
526
    QStyleOptionTitleBar(const QStyleOptionTitleBar &other) : QStyleOptionComplex(Version, Type) { *this = other; }
 
527
 
 
528
protected:
 
529
    QStyleOptionTitleBar(int version);
 
530
};
 
531
 
 
532
template <typename T>
 
533
T qstyleoption_cast(const QStyleOption *opt)
 
534
{
 
535
    if (opt && opt->version <= static_cast<T>(0)->Version && (opt->type == static_cast<T>(0)->Type
 
536
        || int(static_cast<T>(0)->Type) == QStyleOption::SO_Default
 
537
        || (int(static_cast<T>(0)->Type) == QStyleOption::SO_Complex
 
538
            && opt->type > QStyleOption::SO_Complex)))
 
539
        return static_cast<T>(opt);
 
540
    return 0;
 
541
}
 
542
 
 
543
template <typename T>
 
544
T qstyleoption_cast(QStyleOption *opt)
 
545
{
 
546
    if (opt && opt->version <= static_cast<T>(0)->Version && (opt->type == static_cast<T>(0)->Type
 
547
        || int(static_cast<T>(0)->Type) == QStyleOption::SO_Default
 
548
        || (int(static_cast<T>(0)->Type) == QStyleOption::SO_Complex
 
549
            && opt->type > QStyleOption::SO_Complex)))
 
550
        return static_cast<T>(opt);
 
551
    return 0;
 
552
}
 
553
 
 
554
// -------------------------- QStyleHintReturn -------------------------------
 
555
class Q_GUI_EXPORT QStyleHintReturn {
 
556
public:
 
557
    enum HintReturnType {
 
558
        SH_Default=0xf000, SH_Mask
 
559
    };
 
560
 
 
561
    enum { Type = SH_Default };
 
562
    enum { Version = 1 };
 
563
 
 
564
    QStyleHintReturn(int version = QStyleOption::Version, int type = SH_Default);
 
565
    ~QStyleHintReturn();
 
566
 
 
567
    int version;
 
568
    int type;
 
569
};
 
570
 
 
571
class Q_GUI_EXPORT QStyleHintReturnMask : public QStyleHintReturn {
 
572
public:
 
573
    enum { Type = SH_Mask };
 
574
    enum { Version = 1 };
 
575
 
 
576
    QStyleHintReturnMask();
 
577
 
 
578
    QRegion region;
 
579
};
 
580
 
 
581
template <typename T>
 
582
T qstyleoption_cast(const QStyleHintReturn *hint)
 
583
{
 
584
    if (hint && hint->version <= static_cast<T>(0)->Version &&
 
585
        (hint->type == static_cast<T>(0)->Type || int(static_cast<T>(0)->Type) == QStyleHintReturn::SH_Default))
 
586
        return static_cast<T>(hint);
 
587
    return 0;
 
588
}
 
589
 
 
590
template <typename T>
 
591
T qstyleoption_cast(QStyleHintReturn *hint)
 
592
{
 
593
    if (hint && hint->version <= static_cast<T>(0)->Version &&
 
594
        (hint->type == static_cast<T>(0)->Type || int(static_cast<T>(0)->Type) == QStyleHintReturn::SH_Default))
 
595
        return static_cast<T>(hint);
 
596
    return 0;
 
597
}
 
598
 
 
599
#ifndef QT_NO_DEBUG
 
600
Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QStyleOption::OptionType &optionType);
 
601
Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QStyleOption &option);
 
602
#endif
 
603
 
 
604
#endif