Merge QStyleOption*V{2,3,4} classes together
authorGiuseppe D'Angelo <dangelog@gmail.com>
Mon, 30 Jan 2012 00:52:34 +0000 (00:52 +0000)
committerQt by Nokia <qt-info@nokia.com>
Thu, 2 Feb 2012 19:18:55 +0000 (20:18 +0100)
In order to keep binary compatibility, Qt 4 introduced V{2,3,4}
classes for QStyleOption subclasses. They're simple, low level
containers for various members with public access (no accessors
required).

In Qt 5.0 we can break BC, so this patch moves the members
from the derived classes into the ``base'' ones.
The ``base'' ones get a version bump matching the highest
version available, and the V{2,3,4} classes become typedefs.

This change can cause problems in code that used QStyleOption
directly, especially QStyleOptionViewItem, because the old V4
fields get default initialization but the QStyle subclasses
detect that the option is a V4 option and expect all fields
to be properly initialized. The fix in such places is to
properly initialize all fields.

Task-number: QTBUG-23522
Change-Id: I2f782da09ca5cc8c4cbafc07448fb0d33153a251
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
dist/changes-5.0.0
src/widgets/styles/qstyleoption.cpp
src/widgets/styles/qstyleoption.h
tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
tests/auto/widgets/itemviews/qtreewidget/tst_qtreewidget.cpp

index 14a9cbb..d5e24c1 100644 (file)
@@ -269,6 +269,16 @@ QtWidgets
 
 * QInputDialog::getInteger() has been obsoleted. Use QInputDialog::getInt() instead.
 
+* In Qt 4, many QStyleOption subclasses were introduced in order to keep
+  binary compatibility -- QStyleOption was designed to be extended this way,
+  in fact it embeds a version number. In Qt 5 the various QStyleOption*V{2,3,4}
+  classes have been removed, and their members merged into the respective
+  base classes. Those classes were left as typedefs to keep existing code
+  working. Still, some minor adjustements could be necessary, especially in code
+  that uses QStyleOption directly and does not initialize all the members using
+  the proper Qt API: due to the version bump, QStyle will try to use the additional
+  QStyleOption members, which are left default-initialized.
+
 QtNetwork
 ---------
 * QHostAddress::isLoopback() API added. Returns true if the address is
index 08c40e0..63e7b87 100644 (file)
@@ -110,12 +110,12 @@ QT_BEGIN_NAMESPACE
     \value SO_Default QStyleOption
     \value SO_DockWidget \l QStyleOptionDockWidget
     \value SO_FocusRect \l QStyleOptionFocusRect
-    \value SO_Frame \l QStyleOptionFrame \l QStyleOptionFrameV2
+    \value SO_Frame \l QStyleOptionFrame
     \value SO_GraphicsItem \l QStyleOptionGraphicsItem
     \value SO_GroupBox \l QStyleOptionGroupBox
     \value SO_Header \l QStyleOptionHeader
     \value SO_MenuItem \l QStyleOptionMenuItem
-    \value SO_ProgressBar \l QStyleOptionProgressBar \l QStyleOptionProgressBarV2
+    \value SO_ProgressBar \l QStyleOptionProgressBar
     \value SO_RubberBand \l QStyleOptionRubberBand
     \value SO_SizeGrip \l QStyleOptionSizeGrip
     \value SO_Slider \l QStyleOptionSlider
@@ -455,13 +455,11 @@ QStyleOptionFocusRect::QStyleOptionFocusRect(int version)
     \inmodule QtWidgets
  
     QStyleOptionFrame is used for drawing several built-in Qt widgets,
-    including QFrame, QGroupBox, QLineEdit, and QMenu. Note that to
-    describe the parameters necessary for drawing a frame in Qt 4.1 or
-    above, you must use the QStyleOptionFrameV2 subclass.
+    including QFrame, QGroupBox, QLineEdit, and QMenu.
 
     An instance of the QStyleOptionFrame class has
     \l{QStyleOption::type} {type} SO_Frame and \l{QStyleOption::version}
-    {version} 1.
+    {version} 3.
 
     The type is used internally by QStyleOption, its subclasses, and
     qstyleoption_cast() to determine the type of style option. In
@@ -471,615 +469,75 @@ QStyleOptionFocusRect::QStyleOptionFocusRect(int version)
     without breaking compatibility. If you use qstyleoption_cast(),
     you normally do not need to check it.
 
-    If you create your own QStyle subclass, you should handle both
-    QStyleOptionFrame and QStyleOptionFrameV2.
-
-    For an example demonstrating how style options can be used, see
-    the \l {widgets/styles}{Styles} example.
-
-    \sa QStyleOptionFrameV2, QStyleOption
-*/
-
-/*!
-    Constructs a QStyleOptionFrame, initializing the members
-    variables to their default values.
-*/
-
-QStyleOptionFrame::QStyleOptionFrame()
-    : QStyleOption(Version, SO_Frame), lineWidth(0), midLineWidth(0)
-{
-}
-
-/*!
-    \internal
-*/
-QStyleOptionFrame::QStyleOptionFrame(int version)
-    : QStyleOption(version, SO_Frame), lineWidth(0), midLineWidth(0)
-{
-}
-
-/*!
-    \fn QStyleOptionFrame::QStyleOptionFrame(const QStyleOptionFrame &other)
-
-    Constructs a copy of the \a other style option.
-*/
-
-/*!
-    \enum QStyleOptionFrame::StyleOptionType
-
-    This enum is used to hold information about the type of the style option, and
-    is defined for each QStyleOption subclass.
-
-    \value Type The type of style option provided (\l{SO_Frame} for this class).
-
-    The type is used internally by QStyleOption, its subclasses, and
-    qstyleoption_cast() to determine the type of style option. In
-    general you do not need to worry about this unless you want to
-    create your own QStyleOption subclass and your own styles.
-
-    \sa StyleOptionVersion
-*/
-
-/*!
-    \enum QStyleOptionFrame::StyleOptionVersion
-
-    This enum is used to hold information about the version of the style option, and
-    is defined for each QStyleOption subclass.
-
-    \value Version 1
-
-    The version is used by QStyleOption subclasses to implement
-    extensions without breaking compatibility. If you use
-    qstyleoption_cast(), you normally do not need to check it.
-
-    \sa StyleOptionType
-*/
-
-/*!
-    \variable QStyleOptionFrame::lineWidth
-    \brief the line width for drawing the frame
-
-    The default value is 0.
-
-    \sa QFrame::lineWidth
-*/
-
-/*!
-    \variable QStyleOptionFrame::midLineWidth
-    \brief the mid-line width for drawing the frame
-
-    This is usually used in drawing sunken or raised frames.
-
-    The default value is 0.
-
-    \sa QFrame::midLineWidth
-*/
-
-/*!
-    \class QStyleOptionFrameV2
-    \brief The QStyleOptionFrameV2 class is used to describe the
-    parameters necessary for drawing a frame in Qt 4.1 or above.
-
-    \since 4.1
-    \inmodule QtWidgets
-
-    QStyleOptionFrameV2 inherits QStyleOptionFrame which is used for
-    drawing several built-in Qt widgets, including QFrame, QGroupBox,
-    QLineEdit, and QMenu.
-
-    An instance of the QStyleOptionFrameV2 class has
-    \l{QStyleOption::type} {type} SO_Frame and
-    \l{QStyleOption::version} {version} 2.  The type is used
-    internally by QStyleOption, its subclasses, and
-    qstyleoption_cast() to determine the type of style option. In
-    general you do not need to worry about this unless you want to
-    create your own QStyleOption subclass and your own styles. The
-    version is used by QStyleOption subclasses to implement extensions
-    without breaking compatibility. If you use qstyleoption_cast(),
-    you normally do not need to check it.
-
-    If you create your own QStyle subclass, you should handle both
-    QStyleOptionFrame and QStyleOptionFrameV2. One way to achieve this
-    is to use the QStyleOptionFrameV2 copy constructor. For example:
-
-    \snippet doc/src/snippets/qstyleoption/main.cpp 1
-
-    In the example above: If the \c frameOption's version is 1, \l
-    FrameFeature is set to \l None for \c frameOptionV2. If \c
-    frameOption's version is 2, the constructor will simply copy the
-    \c frameOption's \l FrameFeature value.
-
     For an example demonstrating how style options can be used, see
     the \l {widgets/styles}{Styles} example.
 
-    \sa QStyleOptionFrame, QStyleOption
-*/
-
-/*!
-    Constructs a QStyleOptionFrameV2 object.
-*/
-QStyleOptionFrameV2::QStyleOptionFrameV2()
-    : QStyleOptionFrame(Version), features(None)
-{
-}
-
-/*!
-    \fn QStyleOptionFrameV2::QStyleOptionFrameV2(const QStyleOptionFrameV2 &other)
-
-    Constructs a QStyleOptionFrameV2 copy of the \a other style option.
-*/
-
-/*!
-    \internal
-*/
-QStyleOptionFrameV2::QStyleOptionFrameV2(int version)
-    : QStyleOptionFrame(version), features(None)
-{
-}
-
-/*!
-    Constructs a QStyleOptionFrameV2 copy of the \a other style option
-    which can be either of the QStyleOptionFrameV2 or
-    QStyleOptionFrame types.
-
-    If the \a other style option's version is 1, the new style option's \l
-    FrameFeature value is set to \l QStyleOptionFrameV2::None. If its
-    version is 2, its \l FrameFeature value is simply copied to the
-    new style option.
-
-    \sa version
-*/
-QStyleOptionFrameV2::QStyleOptionFrameV2(const QStyleOptionFrame &other)
-{
-    QStyleOptionFrame::operator=(other);
-
-    const QStyleOptionFrameV2 *f2 = qstyleoption_cast<const QStyleOptionFrameV2 *>(&other);
-    features = f2 ? f2->features : FrameFeatures(QStyleOptionFrameV2::None);
-    version = Version;
-}
-
-/*!
-    Assigns the \a other style option to this style option. The \a
-    other style option can be either of the QStyleOptionFrameV2 or
-    QStyleOptionFrame types.
-
-    If the \a{other} style option's version is 1, this style option's
-    \l FrameFeature value is set to \l QStyleOptionFrameV2::None. If
-    its version is 2, its \l FrameFeature value is simply copied to
-    this style option.
-*/
-QStyleOptionFrameV2 &QStyleOptionFrameV2::operator=(const QStyleOptionFrame &other)
-{
-    QStyleOptionFrame::operator=(other);
-
-    const QStyleOptionFrameV2 *f2 = qstyleoption_cast<const QStyleOptionFrameV2 *>(&other);
-    features = f2 ? f2->features : FrameFeatures(QStyleOptionFrameV2::None);
-    version = Version;
-    return *this;
-}
-
-/*!
-    \enum QStyleOptionFrameV2::FrameFeature
-
-    This enum describes the different types of features a frame can have.
-
-    \value None Indicates a normal frame.
-    \value Flat Indicates a flat frame.
-*/
-
-/*!
-    \variable QStyleOptionFrameV2::features
-    \brief a bitwise OR of the features that describe this frame.
-
-    \sa FrameFeature
-*/
-
-/*!
-    \enum QStyleOptionFrameV2::StyleOptionVersion
-
-    This enum is used to hold information about the version of the
-    style option, and is defined for each QStyleOption subclass.
-
-    \value Version 2
-
-    The version is used by QStyleOption subclasses to implement
-    extensions without breaking compatibility. If you use
-    qstyleoption_cast(), you normally do not need to check it.
-
-    \sa StyleOptionType
-*/
-
-/*!
-    \class QStyleOptionFrameV3
-    \brief The QStyleOptionFrameV3 class is used to describe the
-    parameters necessary for drawing a frame in Qt 4.1 or above.
-
-    \since 4.5
-    \inmodule QtWidgets
-
-    QStyleOptionFrameV3 inherits QStyleOptionFrameV2
-
-    An instance of the QStyleOptionFrameV3 class has
-    \l{QStyleOption::type} {type} SO_Frame and
-    \l{QStyleOption::version} {version} 3.  The type is used
-    internally by QStyleOption, its subclasses, and
-    qstyleoption_cast() to determine the type of style option. In
-    general you do not need to worry about this unless you want to
-    create your own QStyleOption subclass and your own styles. The
-    version is used by QStyleOption subclasses to implement extensions
-    without breaking compatibility. If you use qstyleoption_cast(),
-    you normally do not need to check it.
-
-    \sa QStyleOptionFrameV2, QStyleOption
-*/
-
-/*!
-    Constructs a QStyleOptionFrameV3 object.
-*/
-QStyleOptionFrameV3::QStyleOptionFrameV3()
-    : QStyleOptionFrameV2(Version), frameShape(QFrame::NoFrame), unused(0)
-{
-}
-
-/*!
-    \fn QStyleOptionFrameV3::QStyleOptionFrameV3(const QStyleOptionFrameV3 &other)
-
-    Constructs a QStyleOptionFrameV3 copy of the \a other style option.
-*/
-
-/*!
-    \internal
-*/
-QStyleOptionFrameV3::QStyleOptionFrameV3(int version)
-    : QStyleOptionFrameV2(version), frameShape(QFrame::NoFrame), unused(0)
-{
-}
-
-/*!
-    Constructs a QStyleOptionFrameV3 copy of the \a other style option
-    which can be either of the QStyleOptionFrameV3 or
-    QStyleOptionFrame types.
-
-    If the \a other style option's version is 1, the new style
-    option's \l FrameFeature value is set to
-    \l{QStyleOptionFrameV2::None}. If its version is 2 or lower,
-    \l{QStyleOptionFrameV3::frameShape} value is QFrame::NoFrame
-
-    \sa version
-*/
-QStyleOptionFrameV3::QStyleOptionFrameV3(const QStyleOptionFrame &other)
-{
-    operator=(other);
-}
-
-/*!
-    Assigns the \a other style option to this style option. The \a
-    other style option can be either of the QStyleOptionFrameV3,
-    QStyleOptionFrameV2 or QStyleOptionFrame types.
-
-    If the \a other style option's version is 1, the new style
-    option's \l FrameFeature value is set to
-    \l{QStyleOptionFrameV2::None}. If its version is 2 or lower,
-    \l{QStyleOptionFrameV3::frameShape} value is QFrame::NoFrame
-*/
-QStyleOptionFrameV3 &QStyleOptionFrameV3::operator=(const QStyleOptionFrame &other)
-{
-    QStyleOptionFrameV2::operator=(other);
-
-    const QStyleOptionFrameV3 *f3 = qstyleoption_cast<const QStyleOptionFrameV3 *>(&other);
-    frameShape = f3 ? f3->frameShape : QFrame::NoFrame;
-    version = Version;
-    return *this;
-}
-
-
-/*!
-    \variable QStyleOptionFrameV3::frameShape
-    \brief This property holds the frame shape value of the frame.
-
-    \sa QFrame::frameShape
-*/
-
-/*!
-    \enum QStyleOptionFrameV3::StyleOptionVersion
-
-    This enum is used to hold information about the version of the style option, and
-    is defined for each QStyleOption subclass.
-
-    \value Version 3
-
-    The version is used by QStyleOption subclasses to implement
-    extensions without breaking compatibility. If you use
-    qstyleoption_cast(), you normally do not need to check it.
-
-    \sa StyleOptionType
-*/
-
-/*!
-    \class QStyleOptionViewItemV2
-    \brief The QStyleOptionViewItemV2 class is used to describe the
-    parameters necessary for drawing a frame in Qt 4.2 or above.
-    \since 4.2
-    \inmodule QtWidgets
-
-    QStyleOptionViewItemV2 inherits QStyleOptionViewItem.
-
-    An instance of the QStyleOptionViewItemV2 class has
-    \l{QStyleOption::type} {type} SO_ViewItem and
-    \l{QStyleOption::version} {version} 2. The type is used internally
-    by QStyleOption, its subclasses, and qstyleoption_cast() to
-    determine the type of style option. In general you do not need to
-    worry about this unless you want to create your own QStyleOption
-    subclass and your own styles. The version is used by QStyleOption
-    subclasses to implement extensions without breaking
-    compatibility. If you use qstyleoption_cast(), you normally do not
-    need to check it.
-
-    See QStyleOptionFrameV2's detailed description for a discussion
-    of how to handle "V2" classes.
-
-    \sa QStyleOptionViewItem, QStyleOption
-*/
-
-/*!
-    \enum QStyleOptionViewItemV2::StyleOptionVersion
-
-    This enum is used to hold information about the version of the
-    style option, and is defined for each QStyleOption subclass.
-
-    \value Version 2
-
-    The version is used by QStyleOption subclasses to implement
-    extensions without breaking compatibility. If you use
-    qstyleoption_cast(), you normally do not need to check it.
-
-    \sa StyleOptionType
-*/
-
-/*!
-    \variable QStyleOptionViewItemV2::features
-    \brief a bitwise OR of the features that describe this view item
-
-    \sa ViewItemFeature
-*/
-
-/*!
-    Constructs a QStyleOptionViewItemV2 object.
-*/
-QStyleOptionViewItemV2::QStyleOptionViewItemV2()
-    : QStyleOptionViewItem(Version), features(None)
-{
-}
-
-/*!
-    \fn QStyleOptionViewItemV2::QStyleOptionViewItemV2(const QStyleOptionViewItemV2 &other)
-
-    Constructs a copy of \a other.
-*/
-
-/*!
-    Constructs a QStyleOptionViewItemV2 copy of the \a other style option
-    which can be either of the QStyleOptionViewItemV2 or
-    QStyleOptionViewItem types.
-
-    If the \a other style option's version is 1, the new style option's \l
-    ViewItemFeature value is set to \l QStyleOptionViewItemV2::None. If its
-    version is 2, its \l ViewItemFeature value is simply copied to the
-    new style option.
-
-    \sa version
-*/
-QStyleOptionViewItemV2::QStyleOptionViewItemV2(const QStyleOptionViewItem &other)
-    : QStyleOptionViewItem(Version)
-{
-    (void)QStyleOptionViewItemV2::operator=(other);
-}
-
-/*!
-    \internal
-*/
-QStyleOptionViewItemV2::QStyleOptionViewItemV2(int version)
-    : QStyleOptionViewItem(version)
-{
-
-}
-
-/*!
-    Assigns the \a other style option to this style option. The \a
-    other style option can be either of the QStyleOptionViewItemV2 or
-    QStyleOptionViewItem types.
-
-    If the \a{other} style option's version is 1, this style option's
-    \l ViewItemFeature value is set to \l QStyleOptionViewItemV2::None.
-    If its version is 2, its \l ViewItemFeature value is simply copied
-    to this style option.
-*/
-QStyleOptionViewItemV2 &QStyleOptionViewItemV2::operator=(const QStyleOptionViewItem &other)
-{
-    QStyleOptionViewItem::operator=(other);
-    const QStyleOptionViewItemV2 *v2 = qstyleoption_cast<const QStyleOptionViewItemV2 *>(&other);
-    features = v2 ? v2->features : ViewItemFeatures(QStyleOptionViewItemV2::None);
-    return *this;
-}
-
-/*!
-    \enum QStyleOptionViewItemV2::ViewItemFeature
-
-    This enum describes the different types of features an item can have.
-
-    \value None      Indicates a normal item.
-    \value WrapText  Indicates an item with wrapped text.
-    \value Alternate Indicates that the item's background is rendered using alternateBase.
-    \value HasCheckIndicator Indicates that the item has a check state indicator.
-    \value HasDisplay        Indicates that the item has a display role.
-    \value HasDecoration     Indicates that the item has a decoration role.
-*/
-
-
-
-/*!
-    \class QStyleOptionViewItemV3
-    \brief The QStyleOptionViewItemV3 class is used to describe the
-    parameters necessary for drawing a frame in Qt 4.3 or above.
-    \since 4.3
-    \inmodule QtWidgets
-
-    QStyleOptionViewItemV3 inherits QStyleOptionViewItem.
-
-    An instance of the QStyleOptionViewItemV3 class has
-    \l{QStyleOption::type} {type} SO_ViewItem and \l{QStyleOption::version}
-    {version} 3. The type is used internally by QStyleOption, its subclasses,
-    and qstyleoption_cast() to determine the type of style option. In general
-    you do not need to worry about this unless you want to create your own
-    QStyleOption subclass and your own styles. The version is used by
-    QStyleOption subclasses to implement extensions without breaking
-    compatibility. If you use qstyleoption_cast(), you normally do not need to
-    check it.
-
-    See QStyleOptionFrameV2's detailed description for a discussion
-    of how to handle "V2" and other versioned classes.
-
-    \sa QStyleOptionViewItem, QStyleOption
-*/
-
-/*!
-    \enum QStyleOptionViewItemV3::StyleOptionVersion
-
-    This enum is used to hold information about the version of the
-    style option, and is defined for each QStyleOption subclass.
-
-    \value Version 3
-
-    The version is used by QStyleOption subclasses to implement
-    extensions without breaking compatibility. If you use
-    qstyleoption_cast(), you normally do not need to check it.
-
-    \sa StyleOptionType
+    \sa QStyleOption
 */
 
 /*!
-    Constructs a QStyleOptionViewItemV3 object.
-*/
-QStyleOptionViewItemV3::QStyleOptionViewItemV3()
-    : QStyleOptionViewItemV2(Version), widget(0)
-{
-}
+    \typedef QStyleOptionFrameV2
+    \relates QStyleOptionFrame
 
-/*!
-    Constructs a copy of \a other.
+    Synonym for QStyleOptionFrame.
 */
-QStyleOptionViewItemV3::QStyleOptionViewItemV3(const QStyleOptionViewItem &other)
-    : QStyleOptionViewItemV2(Version), widget(0)
-{
-    (void)QStyleOptionViewItemV3::operator=(other);
-}
 
 /*!
-    \fn QStyleOptionViewItemV3::QStyleOptionViewItemV3(const QStyleOptionViewItemV3 &other)
+    \typedef QStyleOptionFrameV3
+    \relates QStyleOptionFrame
 
-    Constructs a copy of \a other.
+    Synonym for QStyleOptionFrame.
 */
 
 /*!
-    Assigns the \a other style option to this style option. The \a
-    other style option can be an instance of the QStyleOptionViewItemV2,
-    QStyleOptionViewItemV3 or QStyleOptionViewItem types.
+    Constructs a QStyleOptionFrame, initializing the members
+    variables to their default values.
 */
-QStyleOptionViewItemV3 &QStyleOptionViewItemV3::operator = (const QStyleOptionViewItem &other)
-{
-    QStyleOptionViewItemV2::operator=(other);
-    const QStyleOptionViewItemV3 *v3 = qstyleoption_cast<const QStyleOptionViewItemV3*>(&other);
-    locale = v3 ? v3->locale : QLocale();
-    widget = v3 ? v3->widget : 0;
-    return *this;
-}
 
-/*!
-    \internal
-*/
-QStyleOptionViewItemV3::QStyleOptionViewItemV3(int version)
-    : QStyleOptionViewItemV2(version), widget(0)
+QStyleOptionFrame::QStyleOptionFrame()
+    : QStyleOption(Version, SO_Frame), lineWidth(0), midLineWidth(0),
+      features(None), frameShape(QFrame::NoFrame)
 {
-}
-
-#ifndef QT_NO_ITEMVIEWS
-
-/*!
-    \class QStyleOptionViewItemV4
-    \brief The QStyleOptionViewItemV4 class is used to describe the
-    parameters necessary for drawing a frame in Qt 4.4 or above.
-    \since 4.4
-    \inmodule QtWidgets
-
-    QStyleOptionViewItemV4 inherits QStyleOptionViewItemV3.
-
-    An instance of the QStyleOptionViewItemV4 class has
-    \l{QStyleOption::type} {type} SO_ViewItem and
-    \l{QStyleOption::version} {version} 4. The type is used internally
-    by QStyleOption, its subclasses, and qstyleoption_cast() to
-    determine the type of style option. In general you do not need to
-    worry about this unless you want to create your own QStyleOption
-    subclass and your own styles. The version is used by QStyleOption
-    subclasses to implement extensions without breaking
-    compatibility. If you use qstyleoption_cast(), you normally do not
-    need to check it.
-
-    See QStyleOptionViewItemV3's detailed description for a discussion
-    of how to handle "V3" classes.
-
-    \sa QStyleOptionViewItem, QStyleOption
-*/
-
-/*!
-    \variable QStyleOptionViewItemV4::index
-
-    The model index that is to be drawn.
-*/
-
-/*!
-    \variable QStyleOptionViewItemV4::checkState
-
-    If this view item is checkable, i.e.,
-    ViewItemFeature::HasCheckIndicator is true, \c checkState is true
-    if the item is checked; otherwise, it is false.
-
-*/
-
-/*!
-    \variable QStyleOptionViewItemV4::icon
-
-    The icon (if any) to be drawn in the view item.
-*/
-
+}
 
 /*!
-    \variable QStyleOptionViewItemV4::text
-
-    The text (if any) to be drawn in the view item.
+    \internal
 */
+QStyleOptionFrame::QStyleOptionFrame(int version)
+    : QStyleOption(version, SO_Frame), lineWidth(0), midLineWidth(0),
+      features(None), frameShape(QFrame::NoFrame)
+{
+}
 
 /*!
-    \variable QStyleOptionViewItemV4::backgroundBrush
+    \fn QStyleOptionFrame::QStyleOptionFrame(const QStyleOptionFrame &other)
 
-    The QBrush that should be used to paint the view items
-    background.
+    Constructs a copy of the \a other style option.
 */
 
 /*!
-    \variable QStyleOptionViewItemV4::viewItemPosition
+    \enum QStyleOptionFrame::StyleOptionType
 
-    Gives the position of this view item relative to other items. See
-    the \l{QStyleOptionViewItemV4::}{ViewItemPosition} enum for the
-    details.
+    This enum is used to hold information about the type of the style option, and
+    is defined for each QStyleOption subclass.
+
+    \value Type The type of style option provided (\l{SO_Frame} for this class).
+
+    The type is used internally by QStyleOption, its subclasses, and
+    qstyleoption_cast() to determine the type of style option. In
+    general you do not need to worry about this unless you want to
+    create your own QStyleOption subclass and your own styles.
+
+    \sa StyleOptionVersion
 */
 
 /*!
-    \enum QStyleOptionViewItemV4::StyleOptionVersion
+    \enum QStyleOptionFrame::StyleOptionVersion
 
-    This enum is used to hold information about the version of the
-    style option, and is defined for each QStyleOption subclass.
+    This enum is used to hold information about the version of the style option, and
+    is defined for each QStyleOption subclass.
 
-    \value Version 4
+    \value Version 3
 
     The version is used by QStyleOption subclasses to implement
     extensions without breaking compatibility. If you use
@@ -1089,80 +547,47 @@ QStyleOptionViewItemV3::QStyleOptionViewItemV3(int version)
 */
 
 /*!
-    \enum QStyleOptionViewItemV4::ViewItemPosition
+    \variable QStyleOptionFrame::lineWidth
+    \brief the line width for drawing the frame
 
-    This enum is used to represent the placement of the item on
-    a row. This can be used to draw items differently depending
-    on their placement, for example by putting rounded edges at
-    the beginning and end, and straight edges in between.
+    The default value is 0.
 
-    \value Invalid   The ViewItemPosition is unknown and should be
-                     disregarded.
-    \value Beginning The item appears at the beginning of the row.
-    \value Middle    The item appears in the middle of the row.
-    \value End       The item appears at the end of the row.
-    \value OnlyOne   The item is the only one on the row, and is
-                     therefore both at the beginning and the end.
+    \sa QFrame::lineWidth
 */
 
-
 /*!
-    Constructs a QStyleOptionViewItemV4 object.
-*/
-QStyleOptionViewItemV4::QStyleOptionViewItemV4()
-: QStyleOptionViewItemV3(Version), checkState(Qt::Unchecked), viewItemPosition(QStyleOptionViewItemV4::Invalid)
-{
-}
+    \variable QStyleOptionFrame::midLineWidth
+    \brief the mid-line width for drawing the frame
 
-/*!
-    \fn QStyleOptionViewItemV4::QStyleOptionViewItemV4(const QStyleOptionViewItemV4 &other)
+    This is usually used in drawing sunken or raised frames.
 
-    Constructs a copy of \a other.
+    The default value is 0.
+
+    \sa QFrame::midLineWidth
 */
 
 /*!
-    Constructs a QStyleOptionViewItemV4 copy of the \a other style option
-    which can be either of the QStyleOptionViewItemV3 or
-    QStyleOptionViewItem types.
+    \enum QStyleOptionFrame::FrameFeature
+
+    This enum describes the different types of features a frame can have.
 
-    \sa version
+    \value None Indicates a normal frame.
+    \value Flat Indicates a flat frame.
 */
-QStyleOptionViewItemV4::QStyleOptionViewItemV4(const QStyleOptionViewItem &other)
-    : QStyleOptionViewItemV3(Version)
-{
-    (void)QStyleOptionViewItemV4::operator=(other);
-}
 
 /*!
-    Assigns the \a other style option to this style option. The \a
-    other style option can be either of the QStyleOptionViewItemV3 or
-    QStyleOptionViewItem types.
+    \variable QStyleOptionFrame::features
+    \brief a bitwise OR of the features that describe this frame.
+
+    \sa FrameFeature
 */
-QStyleOptionViewItemV4 &QStyleOptionViewItemV4::operator = (const QStyleOptionViewItem &other)
-{
-    QStyleOptionViewItemV3::operator=(other);
-    if (const QStyleOptionViewItemV4 *v4 = qstyleoption_cast<const QStyleOptionViewItemV4*>(&other)) {
-        index = v4->index;
-        checkState = v4->checkState;
-        text = v4->text;
-        viewItemPosition = v4->viewItemPosition;
-        backgroundBrush = v4->backgroundBrush;
-        icon = v4->icon;
-    } else {
-        viewItemPosition = QStyleOptionViewItemV4::Invalid;
-        checkState = Qt::Unchecked;
-    }
-    return *this;
-}
 
 /*!
-    \internal
+    \variable QStyleOptionFrame::frameShape
+    \brief This property holds the frame shape value of the frame.
+
+    \sa QFrame::frameShape
 */
-QStyleOptionViewItemV4::QStyleOptionViewItemV4(int version)
-    : QStyleOptionViewItemV3(version)
-{
-}
-#endif // QT_NO_ITEMVIEWS
 
 /*!
     \class QStyleOptionGroupBox
@@ -1264,7 +689,7 @@ QStyleOptionViewItemV4::QStyleOptionViewItemV4(int version)
 
     The frame is flat by default.
 
-    \sa QStyleOptionFrameV2::FrameFeature
+    \sa QStyleOptionFrame::FrameFeature
 */
 
 /*!
@@ -1281,7 +706,7 @@ QStyleOptionViewItemV4::QStyleOptionViewItemV4(int version)
     variables to their default values.
 */
 QStyleOptionGroupBox::QStyleOptionGroupBox()
-    : QStyleOptionComplex(Version, Type), features(QStyleOptionFrameV2::None),
+    : QStyleOptionComplex(Version, Type), features(QStyleOptionFrame::None),
       textAlignment(Qt::AlignLeft), lineWidth(0), midLineWidth(0)
 {
 }
@@ -1296,7 +721,7 @@ QStyleOptionGroupBox::QStyleOptionGroupBox()
     \internal
 */
 QStyleOptionGroupBox::QStyleOptionGroupBox(int version)
-    : QStyleOptionComplex(version, Type), features(QStyleOptionFrameV2::None),
+    : QStyleOptionComplex(version, Type), features(QStyleOptionFrame::None),
       textAlignment(Qt::AlignLeft), lineWidth(0), midLineWidth(0)
 {
 }
@@ -1808,13 +1233,11 @@ QStyleOptionToolBar::QStyleOptionToolBar(int version)
     \inmodule QtWidgets
  
     The QStyleOptionTab class is used for drawing several built-in Qt
-    widgets including \l QTabBar and the panel for \l QTabWidget. Note
-    that to describe the parameters necessary for drawing a frame in
-    Qt 4.1 or above, you must use the QStyleOptionFrameV2 subclass.
+    widgets including \l QTabBar and the panel for \l QTabWidget.
 
-    An instance of the QStyleOptiontabV2 class has
+    An instance of the QStyleOptionTab class has
     \l{QStyleOption::type} {type} \l SO_Tab and
-    \l{QStyleOption::version} {version} 1. The type is used internally
+    \l{QStyleOption::version} {version} 3. The type is used internally
     by QStyleOption, its subclasses, and qstyleoption_cast() to
     determine the type of style option. In general you do not need to
     worry about this unless you want to create your own QStyleOption
@@ -1823,13 +1246,24 @@ QStyleOptionToolBar::QStyleOptionToolBar(int version)
     compatibility. If you use qstyleoption_cast(), you normally do not
     need to check it.
 
-    If you create your own QStyle subclass, you should handle both
-    QStyleOptionTab and QStyleOptionTabV2.
-
     For an example demonstrating how style options can be used, see
     the \l {widgets/styles}{Styles} example.
 
-    \sa QStyleOptionTabV2, QStyleOption
+    \sa QStyleOption
+*/
+
+/*!
+    \typedef QStyleOptionTabV2
+    \relates QStyleOptionTab
+
+    Synonym for QStyleOptionTab.
+*/
+
+/*!
+    \typedef QStyleOptionTabV3
+    \relates QStyleOptionTab
+
+    Synonym for QStyleOptionTab.
 */
 
 /*!
@@ -1842,7 +1276,8 @@ QStyleOptionTab::QStyleOptionTab()
       shape(QTabBar::RoundedNorth),
       row(0),
       position(Beginning),
-      selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets)
+      selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets),
+      documentMode(false)
 {
 }
 
@@ -1854,7 +1289,8 @@ QStyleOptionTab::QStyleOptionTab(int version)
       shape(QTabBar::RoundedNorth),
       row(0),
       position(Beginning),
-      selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets)
+      selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets),
+      documentMode(false)
 {
 }
 
@@ -1886,7 +1322,7 @@ QStyleOptionTab::QStyleOptionTab(int version)
     This enum is used to hold information about the version of the style option, and
     is defined for each QStyleOption subclass.
 
-    \value Version 1
+    \value Version 3
 
     The version is used by QStyleOption subclasses to implement
     extensions without breaking compatibility. If you use
@@ -1917,351 +1353,109 @@ QStyleOptionTab::QStyleOptionTab(int version)
     \value LeftCornerWidget  Left corner widget
     \value RightCornerWidget Right corner widget
 
-    \sa cornerWidgets
-*/
-
-/*! \enum QStyleOptionTab::SelectedPosition
-
-    This enum describes the position of the selected tab. Some styles
-    need to draw a tab differently depending on whether or not it is
-    adjacent to the selected tab.
-
-    \value NotAdjacent The tab is not adjacent to a selected tab (or is the selected tab).
-    \value NextIsSelected The next tab (typically the tab on the right) is selected.
-    \value PreviousIsSelected The previous tab (typically the tab on the left) is selected.
-
-    \sa selectedPosition
-*/
-
-/*!
-    \variable QStyleOptionTab::selectedPosition
-    \brief the position of the selected tab in relation to this tab
-
-    The default value is NotAdjacent, i.e. the tab is not adjacent to
-    a selected tab nor is it the selected tab.
-*/
-
-/*!
-    \variable QStyleOptionTab::cornerWidgets
-    \brief an OR combination of CornerWidget values indicating the
-    corner widgets of the tab bar
-
-    The default value is NoCornerWidgets.
-
-    \sa CornerWidget
-*/
-
-
-/*!
-    \variable QStyleOptionTab::shape
-    \brief the tab shape used to draw the tab; by default
-    QTabBar::RoundedNorth
-
-    \sa QTabBar::Shape
-*/
-
-/*!
-    \variable QStyleOptionTab::text
-    \brief the text of the tab
-
-    The default value is an empty string.
-*/
-
-/*!
-    \variable QStyleOptionTab::icon
-    \brief the icon for the tab
-
-    The default value is an empty icon, i.e. an icon with neither a
-    pixmap nor a filename.
-*/
-
-/*!
-    \variable QStyleOptionTab::row
-    \brief which row the tab is currently in
-
-    The default value is 0, indicating the front row.  Currently this
-    property can only be 0.
-*/
-
-/*!
-    \variable QStyleOptionTab::position
-    \brief the position of the tab in the tab bar
-
-    The default value is \l Beginning, i.e. the tab is the first tab
-    in the tab bar.
-*/
-
-/*!
-    \class QStyleOptionTabV2
-    \brief The QStyleOptionTabV2 class is used to describe the
-    parameters necessary for drawing a tabs in Qt 4.1 or above.
-
-    \since 4.1
-    \inmodule QtWidgets
-
-    An instance of the QStyleOptionTabV2 class has
-    \l{QStyleOption::type} {type} \l SO_Tab and
-    \l{QStyleOption::version} {version} 2. The type is used internally
-    by QStyleOption, its subclasses, and qstyleoption_cast() to
-    determine the type of style option. In general you do not need to
-    worry about this unless you want to create your own QStyleOption
-    subclass and your own styles. The version is used by QStyleOption
-    subclasses to implement extensions without breaking
-    compatibility. If you use qstyleoption_cast(), you normally do not
-    need to check it.
-
-    If you create your own QStyle subclass, you should handle both
-    QStyleOptionTab and QStyleOptionTabV2. One way to achieve this is
-    to use the QStyleOptionTabV2 copy constructor. For example:
-
-    \snippet doc/src/snippets/qstyleoption/main.cpp 3
-
-    In the example above: If \c tabOption's version is 1, the extra
-    member (\l iconSize) will be set to an invalid size for \c tabV2.
-    If \c tabOption's version is 2, the constructor will simply copy
-    the \c tab's iconSize.
-
-    For an example demonstrating how style options can be used, see
-    the \l {widgets/styles}{Styles} example.
-
-    \sa QStyleOptionTab, QStyleOption
-*/
-
-/*!
-    \enum QStyleOptionTabV2::StyleOptionVersion
-
-    This enum is used to hold information about the version of the style option, and
-    is defined for each QStyleOption subclass.
-
-    \value Version 2
-
-    The version is used by QStyleOption subclasses to implement
-    extensions without breaking compatibility. If you use
-    qstyleoption_cast(), you normally do not need to check it.
-
-    \sa StyleOptionType
-*/
-
-/*!
-    \variable QStyleOptionTabV2::iconSize
-    \brief the size for the icons
-
-    The default value is QSize(-1, -1), i.e. an invalid size; use
-    QStyle::pixelMetric() to find the default icon size for tab bars.
-
-    \sa QTabBar::iconSize()
-*/
-
-/*!
-    Constructs a QStyleOptionTabV2.
-*/
-QStyleOptionTabV2::QStyleOptionTabV2()
-    : QStyleOptionTab(Version)
-{
-}
-
-/*!
-    \internal
-*/
-QStyleOptionTabV2::QStyleOptionTabV2(int version)
-    : QStyleOptionTab(version)
-{
-}
-
-/*!
-    \fn QStyleOptionTabV2::QStyleOptionTabV2(const QStyleOptionTabV2 &other)
-
-    Constructs a copy of the \a other style option.
-*/
-
-/*!
-    Constructs a QStyleOptionTabV2 copy of the \a other style option
-    which can be either of the QStyleOptionTabV2 or QStyleOptionTab
-    types.
-
-    If the other style option's version is 1, the new style option's
-    \c iconSize is set to an invalid value. If its version is 2, its
-    \c iconSize value is simply copied to the new style option.
-*/
-QStyleOptionTabV2::QStyleOptionTabV2(const QStyleOptionTab &other)
-    : QStyleOptionTab(Version)
-{
-    if (const QStyleOptionTabV2 *tab = qstyleoption_cast<const QStyleOptionTabV2 *>(&other)) {
-        *this = *tab;
-    } else {
-        *((QStyleOptionTab *)this) = other;
-        version = Version;
-    }
-}
-
-/*!
-    Assigns the \a other style option to this QStyleOptionTabV2. The
-    \a other style option can be either of the QStyleOptionTabV2 or
-    QStyleOptionTab types.
-
-    If the other style option's version is 1, this style option's \c
-    iconSize is set to an invalid size. If its version is 2, its \c
-    iconSize value is simply copied to this style option.
-*/
-QStyleOptionTabV2 &QStyleOptionTabV2::operator=(const QStyleOptionTab &other)
-{
-    QStyleOptionTab::operator=(other);
-
-    if (const QStyleOptionTabV2 *tab = qstyleoption_cast<const QStyleOptionTabV2 *>(&other))
-        iconSize = tab->iconSize;
-    else
-        iconSize = QSize();
-    return *this;
-}
-
-/*!
-    \class QStyleOptionTabV3
-    \brief The QStyleOptionTabV3 class is used to describe the
-    parameters necessary for drawing a tabs in Qt 4.5 or above.
-
-    \since 4.5
-    \inmodule QtWidgets
-
-    An instance of the QStyleOptionTabV3 class has
-    \l{QStyleOption::type} {type} \l SO_Tab and
-    \l{QStyleOption::version} {version} 3. The type is used internally
-    by QStyleOption, its subclasses, and qstyleoption_cast() to
-    determine the type of style option. In general you do not need to
-    worry about this unless you want to create your own QStyleOption
-    subclass and your own styles. The version is used by QStyleOption
-    subclasses to implement extensions without breaking
-    compatibility. If you use qstyleoption_cast(), you normally do not
-    need to check it.
-
-    If you create your own QStyle subclass, you should handle both
-    QStyleOptionTab, QStyleOptionTabV2 and QStyleOptionTabV3.
-    One way to achieve this is to use the QStyleOptionTabV3 copy
-    constructor. For example:
+    \sa cornerWidgets
+*/
 
-    \snippet doc/src/snippets/qstyleoption/main.cpp 3
+/*! \enum QStyleOptionTab::SelectedPosition
 
-    In the example above: If \c tabOption's version is 1, the extra
-    member (\l{QStyleOptionTabV2::iconSize}{iconSize}) will be set to
-    an invalid size for \c tabV2.  If \c tabOption's version is 2, the
-    constructor will simply copy the \c tab's iconSize.
+    This enum describes the position of the selected tab. Some styles
+    need to draw a tab differently depending on whether or not it is
+    adjacent to the selected tab.
 
-    For an example demonstrating how style options can be used, see
-    the \l {widgets/styles}{Styles} example.
+    \value NotAdjacent The tab is not adjacent to a selected tab (or is the selected tab).
+    \value NextIsSelected The next tab (typically the tab on the right) is selected.
+    \value PreviousIsSelected The previous tab (typically the tab on the left) is selected.
 
-    \sa QStyleOptionTab, QStyleOption
+    \sa selectedPosition
 */
 
 /*!
-    \enum QStyleOptionTabV3::StyleOptionVersion
+    \variable QStyleOptionTab::selectedPosition
+    \brief the position of the selected tab in relation to this tab
 
-    This enum is used to hold information about the version of the style option, and
-    is defined for each QStyleOption subclass.
+    The default value is NotAdjacent, i.e. the tab is not adjacent to
+    a selected tab nor is it the selected tab.
+*/
 
-    \value Version 3
+/*!
+    \variable QStyleOptionTab::cornerWidgets
+    \brief an OR combination of CornerWidget values indicating the
+    corner widgets of the tab bar
 
-    The version is used by QStyleOption subclasses to implement
-    extensions without breaking compatibility. If you use
-    qstyleoption_cast(), you normally do not need to check it.
+    The default value is NoCornerWidgets.
 
-    \sa StyleOptionType
+    \sa CornerWidget
 */
 
+
 /*!
-    \variable QStyleOptionTabV3::documentMode
-    \brief whether the tabbar is in document mode.
+    \variable QStyleOptionTab::shape
+    \brief the tab shape used to draw the tab; by default
+    QTabBar::RoundedNorth
 
-    The default value is false;
+    \sa QTabBar::Shape
 */
 
 /*!
-    \variable QStyleOptionTabV3::leftButtonSize
-    \brief the size for the left widget on the tab.
+    \variable QStyleOptionTab::text
+    \brief the text of the tab
 
-    The default value is QSize(-1, -1), i.e. an invalid size;
+    The default value is an empty string.
 */
 
 /*!
-    \variable QStyleOptionTabV3::rightButtonSize
-    \brief the size for the right widget on the tab.
+    \variable QStyleOptionTab::icon
+    \brief the icon for the tab
 
-    The default value is QSize(-1, -1), i.e. an invalid size;
+    The default value is an empty icon, i.e. an icon with neither a
+    pixmap nor a filename.
 */
 
 /*!
-    Constructs a QStyleOptionTabV3.
-*/
+    \variable QStyleOptionTab::row
+    \brief which row the tab is currently in
 
-QStyleOptionTabV3::QStyleOptionTabV3()
-    : QStyleOptionTabV2(Version)
-    , documentMode(false)
-{
-}
+    The default value is 0, indicating the front row.  Currently this
+    property can only be 0.
+*/
 
 /*!
-    \internal
-*/
-QStyleOptionTabV3::QStyleOptionTabV3(int version)
-    : QStyleOptionTabV2(version)
-{
-}
+    \variable QStyleOptionTab::position
+    \brief the position of the tab in the tab bar
 
+    The default value is \l Beginning, i.e. the tab is the first tab
+    in the tab bar.
+*/
 /*!
-    \fn QStyleOptionTabV3::QStyleOptionTabV3(const QStyleOptionTabV3 &other)
+    \variable QStyleOptionTab::iconSize
+    \brief the size for the icons
 
-    Constructs a copy of the \a other style option.
+    The default value is QSize(-1, -1), i.e. an invalid size; use
+    QStyle::pixelMetric() to find the default icon size for tab bars.
+
+    \sa QTabBar::iconSize()
 */
 
 /*!
-    \fn QStyleOptionTabV3::QStyleOptionTabV3(const QStyleOptionTabV2 &other)
+    \variable QStyleOptionTab::documentMode
+    \brief whether the tabbar is in document mode.
 
-    Constructs a copy of the \a other style option.
+    The default value is false;
 */
 
 /*!
-    Constructs a QStyleOptionTabV3 copy of the \a other style option
-    which can be either of the QStyleOptionTabV3, QStyleOptionTabV2
-    or QStyleOptionTab types.
+    \variable QStyleOptionTab::leftButtonSize
+    \brief the size for the left widget on the tab.
 
-    If the other style option's version is 1 or 2, the new style option's
-    \c leftButtonSize and \c rightButtonSize is set to an invalid value.  If
-    its version is 3, its \c leftButtonSize and \c rightButtonSize values
-    are simply copied to the new style option.
+    The default value is QSize(-1, -1), i.e. an invalid size;
 */
-QStyleOptionTabV3::QStyleOptionTabV3(const QStyleOptionTab &other)
-    : QStyleOptionTabV2(Version)
-{
-    if (const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(&other)) {
-        *this = *tab;
-    } else {
-        *((QStyleOptionTabV2 *)this) = other;
-        version = Version;
-    }
-}
 
 /*!
-    Assigns the \a other style option to this QStyleOptionTabV3. The
-    \a other style option can be either of the QStyleOptionTabV3,
-    QStyleOptionTabV2 or QStyleOptionTab types.
+    \variable QStyleOptionTab::rightButtonSize
+    \brief the size for the right widget on the tab.
 
-    If the other style option's version is 1 or 2, the new style option's
-    \c leftButtonSize and \c rightButtonSize is set to an invalid value.  If
-    its version is 3, its \c leftButtonSize and \c rightButtonSize values
-    are simply copied to the new style option.
+    The default value is QSize(-1, -1), i.e. an invalid size;
 */
-QStyleOptionTabV3 &QStyleOptionTabV3::operator=(const QStyleOptionTab &other)
-{
-    QStyleOptionTabV2::operator=(other);
-
-    if (const QStyleOptionTabV3 *tab = qstyleoption_cast<const QStyleOptionTabV3 *>(&other)) {
-        leftButtonSize = tab->leftButtonSize;
-        rightButtonSize = tab->rightButtonSize;
-    } else {
-        leftButtonSize = QSize();
-        rightButtonSize = QSize();
-        documentMode = false;
-    }
-    return *this;
-}
 
 #endif // QT_NO_TABBAR
 
@@ -2271,12 +1465,9 @@ QStyleOptionTabV3 &QStyleOptionTabV3::operator=(const QStyleOptionTab &other)
     parameters necessary for drawing a progress bar.
 
     \inmodule QtWidgets
-    Since Qt 4.1, Qt uses the QStyleOptionProgressBarV2 subclass for
-    drawing QProgressBar.
 
     An instance of the QStyleOptionProgressBar class has type
-    SO_ProgressBar and version 1.
+    SO_ProgressBar and version 2.
 
     The type is used internally by QStyleOption, its subclasses, and
     qstyleoption_cast() to determine the type of style option. In
@@ -2286,13 +1477,17 @@ QStyleOptionTabV3 &QStyleOptionTabV3::operator=(const QStyleOptionTab &other)
     without breaking compatibility. If you use qstyleoption_cast(),
     you normally do not need to check it.
 
-    If you create your own QStyle subclass, you should handle both
-    QStyleOptionProgressBar and QStyleOptionProgressBarV2.
-
     For an example demonstrating how style options can be used, see
     the \l {widgets/styles}{Styles} example.
 
-    \sa QStyleOptionProgressBarV2, QStyleOption
+    \sa QStyleOption
+*/
+
+/*!
+    \typedef QStyleOptionProgressBarV2
+    \relates QStyleOptionProgressBar
+
+    Synonym for QStyleOptionProgressBar.
 */
 
 /*!
@@ -2302,7 +1497,8 @@ QStyleOptionTabV3 &QStyleOptionTabV3::operator=(const QStyleOptionTab &other)
 
 QStyleOptionProgressBar::QStyleOptionProgressBar()
     : QStyleOption(QStyleOptionProgressBar::Version, SO_ProgressBar),
-      minimum(0), maximum(0), progress(0), textAlignment(Qt::AlignLeft), textVisible(false)
+      minimum(0), maximum(0), progress(0), textAlignment(Qt::AlignLeft), textVisible(false),
+      orientation(Qt::Horizontal), invertedAppearance(false), bottomToTop(false)
 {
 }
 
@@ -2311,7 +1507,8 @@ QStyleOptionProgressBar::QStyleOptionProgressBar()
 */
 QStyleOptionProgressBar::QStyleOptionProgressBar(int version)
     : QStyleOption(version, SO_ProgressBar),
-      minimum(0), maximum(0), progress(0), textAlignment(Qt::AlignLeft), textVisible(false)
+      minimum(0), maximum(0), progress(0), textAlignment(Qt::AlignLeft), textVisible(false),
+      orientation(Qt::Horizontal), invertedAppearance(false), bottomToTop(false)
 {
 }
 
@@ -2343,7 +1540,7 @@ QStyleOptionProgressBar::QStyleOptionProgressBar(int version)
     This enum is used to hold information about the version of the style option, and
     is defined for each QStyleOption subclass.
 
-    \value Version 1
+    \value Version 2
 
     The version is used by QStyleOption subclasses to implement
     extensions without breaking compatibility. If you use
@@ -2414,118 +1611,7 @@ QStyleOptionProgressBar::QStyleOptionProgressBar(int version)
 */
 
 /*!
-    \class QStyleOptionProgressBarV2
-    \brief The QStyleOptionProgressBarV2 class is used to describe the
-    parameters necessary for drawing a progress bar in Qt 4.1 or above.
-
-    \since 4.1
-    \inmodule QtWidgets
-
-    An instance of this class has \l{QStyleOption::type} {type}
-    SO_ProgressBar and \l{QStyleOption::version} {version} 2.
-
-    The type is used internally by QStyleOption, its subclasses, and
-    qstyleoption_cast() to determine the type of style option. In
-    general you do not need to worry about this unless you want to
-    create your own QStyleOption subclass and your own styles. The
-    version is used by QStyleOption subclasses to implement extensions
-    without breaking compatibility. If you use qstyleoption_cast(),
-    you normally do not need to check it.
-
-    If you create your own QStyle subclass, you should handle both
-    QStyleOptionProgressBar and QStyleOptionProgressBarV2. One way
-    to achieve this is to use the QStyleOptionProgressBarV2 copy
-    constructor. For example:
-
-    \snippet doc/src/snippets/qstyleoption/main.cpp 2
-
-    In the example above: If the \c progressBarOption's version is 1,
-    the extra members (\l orientation, \l invertedAppearance, and \l
-    bottomToTop) are set to default values for \c progressBarV2. If
-    the \c progressBarOption's version is 2, the constructor will
-    simply copy the extra members to progressBarV2.
-
-    For an example demonstrating how style options can be used, see
-    the \l {widgets/styles}{Styles} example.
-
-    \sa QStyleOptionProgressBar, QStyleOption
-*/
-
-/*!
-    Constructs a QStyleOptionProgressBarV2, initializing he members
-    variables to their default values.
-*/
-
-QStyleOptionProgressBarV2::QStyleOptionProgressBarV2()
-    : QStyleOptionProgressBar(2),
-      orientation(Qt::Horizontal), invertedAppearance(false), bottomToTop(false)
-{
-}
-
-/*!
-    \internal
-*/
-QStyleOptionProgressBarV2::QStyleOptionProgressBarV2(int version)
-    : QStyleOptionProgressBar(version),
-      orientation(Qt::Horizontal), invertedAppearance(false), bottomToTop(false)
-{
-}
-
-/*!
-    Constructs a copy of the \a other style option which can be either
-    of the QStyleOptionProgressBar and QStyleOptionProgressBarV2
-    types.
-
-    If the \a{other} style option's version is 1, the extra members (\l
-    orientation, \l invertedAppearance, and \l bottomToTop) are set
-    to default values for the new style option. If \a{other}'s version
-    is 2, the extra members are simply copied.
-
-    \sa version
-*/
-QStyleOptionProgressBarV2::QStyleOptionProgressBarV2(const QStyleOptionProgressBar &other)
-    : QStyleOptionProgressBar(2), orientation(Qt::Horizontal), invertedAppearance(false), bottomToTop(false)
-{
-    const QStyleOptionProgressBarV2 *pb2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(&other);
-    if (pb2)
-        *this = *pb2;
-    else
-        *((QStyleOptionProgressBar *)this) = other;
-}
-
-/*!
-    Constructs a copy of the \a other style option.
-*/
-QStyleOptionProgressBarV2::QStyleOptionProgressBarV2(const QStyleOptionProgressBarV2 &other)
-    : QStyleOptionProgressBar(2), orientation(Qt::Horizontal), invertedAppearance(false), bottomToTop(false)
-{
-    *this = other;
-}
-
-/*!
-    Assigns the \a other style option to this style option. The \a
-    other style option can be either of the QStyleOptionProgressBarV2
-    or QStyleOptionProgressBar types.
-
-    If the \a{other} style option's version is 1, the extra members
-    (\l orientation, \l invertedAppearance, and \l bottomToTop) are
-    set to default values for this style option. If \a{other}'s
-    version is 2, the extra members are simply copied to this style
-    option.
-*/
-QStyleOptionProgressBarV2 &QStyleOptionProgressBarV2::operator=(const QStyleOptionProgressBar &other)
-{
-    QStyleOptionProgressBar::operator=(other);
-
-    const QStyleOptionProgressBarV2 *pb2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(&other);
-    orientation = pb2 ? pb2->orientation : Qt::Horizontal;
-    invertedAppearance = pb2 ? pb2->invertedAppearance : false;
-    bottomToTop = pb2 ? pb2->bottomToTop : false;
-    return *this;
-}
-
-/*!
-    \variable QStyleOptionProgressBarV2::orientation
+    \variable QStyleOptionProgressBar::orientation
     \brief the progress bar's orientation (horizontal or vertical);
     the default orentation is Qt::Horizontal
 
@@ -2533,7 +1619,7 @@ QStyleOptionProgressBarV2 &QStyleOptionProgressBarV2::operator=(const QStyleOpti
 */
 
 /*!
-    \variable QStyleOptionProgressBarV2::invertedAppearance
+    \variable QStyleOptionProgressBar::invertedAppearance
     \brief whether the progress bar's appearance is inverted
 
     The default value is false.
@@ -2542,7 +1628,7 @@ QStyleOptionProgressBarV2 &QStyleOptionProgressBarV2::operator=(const QStyleOpti
 */
 
 /*!
-    \variable QStyleOptionProgressBarV2::bottomToTop
+    \variable QStyleOptionProgressBar::bottomToTop
     \brief whether the text reads from bottom to top when the progress
     bar is vertical
 
@@ -2552,38 +1638,6 @@ QStyleOptionProgressBarV2 &QStyleOptionProgressBarV2::operator=(const QStyleOpti
 */
 
 /*!
-    \enum QStyleOptionProgressBarV2::StyleOptionType
-
-    This enum is used to hold information about the type of the style option, and
-    is defined for each QStyleOption subclass.
-
-    \value Type The type of style option provided (\l{SO_ProgressBar} for this class).
-
-    The type is used internally by QStyleOption, its subclasses, and
-    qstyleoption_cast() to determine the type of style option. In
-    general you do not need to worry about this unless you want to
-    create your own QStyleOption subclass and your own styles.
-
-    \sa StyleOptionVersion
-*/
-
-/*!
-    \enum QStyleOptionProgressBarV2::StyleOptionVersion
-
-    This enum is used to hold information about the version of the style option, and
-    is defined for each QStyleOption subclass.
-
-    \value Version 2
-
-    The version is used by QStyleOption subclasses to implement
-    extensions without breaking compatibility. If you use
-    qstyleoption_cast(), you normally do not need to check it.
-
-    \sa StyleOptionType
-*/
-
-
-/*!
     \class QStyleOptionMenuItem
     \brief The QStyleOptionMenuItem class is used to describe the
     parameter necessary for drawing a menu item.
@@ -3576,13 +2630,20 @@ QStyleOptionQ3DockWindow::QStyleOptionQ3DockWindow(int version)
 */
 
 /*!
+    \typedef QStyleOptionDockWidgetV2
+    \relates QStyleOptionDockWidget
+
+    Synonym for QStyleOptionDockWidget.
+*/
+
+/*!
     Constructs a QStyleOptionDockWidget, initializing the member
     variables to their default values.
 */
 
 QStyleOptionDockWidget::QStyleOptionDockWidget()
     : QStyleOption(Version, SO_DockWidget), closable(false),
-      movable(false), floatable(false)
+      movable(false), floatable(false), verticalTitleBar(false)
 {
 }
 
@@ -3591,34 +2652,7 @@ QStyleOptionDockWidget::QStyleOptionDockWidget()
 */
 QStyleOptionDockWidget::QStyleOptionDockWidget(int version)
     : QStyleOption(version, SO_DockWidget), closable(false),
-      movable(false), floatable(false)
-{
-}
-
-QStyleOptionDockWidgetV2::QStyleOptionDockWidgetV2()
-    : QStyleOptionDockWidget(Version), verticalTitleBar(false)
-{
-}
-
-QStyleOptionDockWidgetV2::QStyleOptionDockWidgetV2(
-                                    const QStyleOptionDockWidget &other)
-    : QStyleOptionDockWidget(Version)
-{
-    (void)QStyleOptionDockWidgetV2::operator=(other);
-}
-
-QStyleOptionDockWidgetV2 &QStyleOptionDockWidgetV2::operator = (
-                                    const QStyleOptionDockWidget &other)
-{
-    QStyleOptionDockWidget::operator=(other);
-    const QStyleOptionDockWidgetV2 *v2
-        = qstyleoption_cast<const QStyleOptionDockWidgetV2*>(&other);
-    verticalTitleBar = v2 ? v2->verticalTitleBar : false;
-    return *this;
-}
-
-QStyleOptionDockWidgetV2::QStyleOptionDockWidgetV2(int version)
-    : QStyleOptionDockWidget(version), verticalTitleBar(false)
+      movable(false), floatable(false), verticalTitleBar(false)
 {
 }
 
@@ -3650,7 +2684,7 @@ QStyleOptionDockWidgetV2::QStyleOptionDockWidgetV2(int version)
     This enum is used to hold information about the version of the style option, and
     is defined for each QStyleOption subclass.
 
-    \value Version 1
+    \value Version 2
 
     The version is used by QStyleOption subclasses to implement
     extensions without breaking compatibility. If you use
@@ -3693,7 +2727,7 @@ QStyleOptionDockWidgetV2::QStyleOptionDockWidgetV2(int version)
     parameters for drawing a tool button.
 
     \inmodule QtWidgets
+
     QStyleOptionToolButton contains all the information that QStyle
     functions need to draw QToolButton.
 
@@ -3857,7 +2891,7 @@ QStyleOptionToolButton::QStyleOptionToolButton(int version)
     parameter for drawing a combobox.
 
     \inmodule QtWidgets
+
     QStyleOptionButton contains all the information that QStyle
     functions need to draw QComboBox.
 
@@ -3985,7 +3019,7 @@ QStyleOptionComboBox::QStyleOptionComboBox(int version)
     parameters needed for drawing a tool box.
 
     \inmodule QtWidgets
+
     QStyleOptionToolBox contains all the information that QStyle
     functions need to draw QToolBox.
 
@@ -4001,12 +3035,19 @@ QStyleOptionComboBox::QStyleOptionComboBox(int version)
 */
 
 /*!
+    \typedef QStyleOptionToolBoxV2
+    \relates QStyleOptionToolBox
+
+    Synonym for QStyleOptionToolBox.
+*/
+
+/*!
     Creates a QStyleOptionToolBox, initializing the members variables
     to their default values.
 */
 
 QStyleOptionToolBox::QStyleOptionToolBox()
-    : QStyleOption(Version, SO_ToolBox)
+    : QStyleOption(Version, SO_ToolBox), position(Beginning), selectedPosition(NotAdjacent)
 {
 }
 
@@ -4014,7 +3055,7 @@ QStyleOptionToolBox::QStyleOptionToolBox()
     \internal
 */
 QStyleOptionToolBox::QStyleOptionToolBox(int version)
-    : QStyleOption(version, SO_ToolBox)
+    : QStyleOption(version, SO_ToolBox), position(Beginning), selectedPosition(NotAdjacent)
 {
 }
 
@@ -4046,7 +3087,7 @@ QStyleOptionToolBox::QStyleOptionToolBox(int version)
     This enum is used to hold information about the version of the style option, and
     is defined for each QStyleOption subclass.
 
-    \value Version 1
+    \value Version 2
 
     The version is used by QStyleOption subclasses to implement
     extensions without breaking compatibility. If you use
@@ -4064,111 +3105,14 @@ QStyleOptionToolBox::QStyleOptionToolBox(int version)
 */
 
 /*!
-    \variable QStyleOptionToolBox::text
-    \brief the text for the tool box tab
-
-    The default value is an empty string.
-*/
-
-/*!
-    \class QStyleOptionToolBoxV2
-    \brief The QStyleOptionToolBoxV2 class is used to describe the parameters necessary for drawing a frame in Qt 4.3 or above.
-
-    \since 4.3
-    \inmodule QtWidgets
-    QStyleOptionToolBoxV2 inherits QStyleOptionToolBox which is used for
-    drawing the tabs in a QToolBox.
-
-    An instance of the QStyleOptionToolBoxV2 class has
-    \l{QStyleOption::type} {type} SO_ToolBox and
-    \l{QStyleOption::version} {version} 2.  The type is used
-    internally by QStyleOption, its subclasses, and
-    qstyleoption_cast() to determine the type of style option. In
-    general you do not need to worry about this unless you want to
-    create your own QStyleOption subclass and your own styles. The
-    version is used by QStyleOption subclasses to implement extensions
-    without breaking compatibility. If you use qstyleoption_cast(),
-    you normally do not need to check it.
-
-    If you create your own QStyle subclass, you should handle both
-    QStyleOptionToolBox and QStyleOptionToolBoxV2.
-
-    \sa QStyleOptionToolBox, QStyleOption
-*/
-
-/*!
-    Contsructs a QStyleOptionToolBoxV2 object.
-*/
-QStyleOptionToolBoxV2::QStyleOptionToolBoxV2()
-    : QStyleOptionToolBox(Version), position(Beginning), selectedPosition(NotAdjacent)
-{
-}
-
-/*!
-    \fn QStyleOptionToolBoxV2::QStyleOptionToolBoxV2(const QStyleOptionToolBoxV2 &other)
-
-    Constructs a QStyleOptionToolBoxV2 copy of the \a other style option.
-*/
-
-/*!
-    \internal
-*/
-QStyleOptionToolBoxV2::QStyleOptionToolBoxV2(int version)
-    : QStyleOptionToolBox(version), position(Beginning), selectedPosition(NotAdjacent)
-{
-}
-
-/*!
-    Constructs a QStyleOptionToolBoxV2 copy of the \a other style option
-    which can be either of the QStyleOptionToolBoxV2 or
-    QStyleOptionToolBox types.
-
-    If the \a other style option's version is 1, the new style
-    option's \l{QStyleOptionTab::position} {position} value is set to
-    \l QStyleOptionToolBoxV2::Beginning and \l selectedPosition is set
-    to \l QStyleOptionToolBoxV2::NotAdjacent. If its version is 2, the
-    \l{QStyleOptionTab::position} {position} selectedPosition values
-    are simply copied to the new style option.
-
-    \sa version
-*/
-QStyleOptionToolBoxV2::QStyleOptionToolBoxV2(const QStyleOptionToolBox &other)
-{
-    QStyleOptionToolBox::operator=(other);
-
-    const QStyleOptionToolBoxV2 *f2 = qstyleoption_cast<const QStyleOptionToolBoxV2 *>(&other);
-    position = f2 ? f2->position : Beginning;
-    selectedPosition = f2 ? f2->selectedPosition : NotAdjacent;
-    version = Version;
-}
-
-/*!
-    Assigns the \a other style option to this style option. The \a
-    other style option can be either of the QStyleOptionToolBoxV2 or
-    QStyleOptionToolBox types.
+    \variable QStyleOptionToolBox::text
+    \brief the text for the tool box tab
 
-    If the \a{other} style option's version is 1, this style option's
-    \l{QStyleOptionTab::position} {position} and \l selectedPosition
-    values are set to \l QStyleOptionToolBoxV2::Beginning and \l
-    QStyleOptionToolBoxV2::NotAdjacent respectively. If its
-    \l{QStyleOption::version} {version} is 2, these values are simply
-    copied to this style option.
+    The default value is an empty string.
 */
-QStyleOptionToolBoxV2 &QStyleOptionToolBoxV2::operator=(const QStyleOptionToolBox &other)
-{
-    QStyleOptionToolBox::operator=(other);
-
-    const QStyleOptionToolBoxV2 *f2 = qstyleoption_cast<const QStyleOptionToolBoxV2 *>(&other);
-    position = f2 ? f2->position : Beginning;
-    selectedPosition = f2 ? f2->selectedPosition : NotAdjacent;
-    version = Version;
-    return *this;
-}
-
 
 /*!
-    \enum QStyleOptionToolBoxV2::SelectedPosition
+    \enum QStyleOptionToolBox::SelectedPosition
 
     This enum describes the position of the selected tab. Some styles
     need to draw a tab differently depending on whether or not it is
@@ -4182,15 +3126,7 @@ QStyleOptionToolBoxV2 &QStyleOptionToolBoxV2::operator=(const QStyleOptionToolBo
 */
 
 /*!
-    \enum QStyleOptionToolBoxV2::StyleOptionVersion
-
-    This enum holds the version of this style option
-
-    \value Version 2
-*/
-
-/*!
-    \enum QStyleOptionToolBoxV2::TabPosition
+    \enum QStyleOptionToolBox::TabPosition
 
     This enum describes tab positions relative to other tabs.
 
@@ -4202,7 +3138,7 @@ QStyleOptionToolBoxV2 &QStyleOptionToolBoxV2::operator=(const QStyleOptionToolBo
 */
 
 /*!
-    \variable QStyleOptionToolBoxV2::selectedPosition
+    \variable QStyleOptionToolBox::selectedPosition
     \brief the position of the selected tab in relation to this tab
 
     The default value is NotAdjacent, i.e. the tab is not adjacent to
@@ -4216,7 +3152,7 @@ QStyleOptionToolBoxV2 &QStyleOptionToolBoxV2::operator=(const QStyleOptionToolBo
     parameters needed for drawing a rubber band.
 
     \inmodule QtWidgets
+
     QStyleOptionRubberBand contains all the information that
     QStyle functions need to draw QRubberBand.
 
@@ -4307,7 +3243,7 @@ QStyleOptionRubberBand::QStyleOptionRubberBand(int version)
     parameters for drawing a title bar.
 
     \inmodule QtWidgets
+
     QStyleOptionTitleBar contains all the information that QStyle
     functions need to draw the title bar of a QMdiSubWindow.
 
@@ -4412,13 +3348,14 @@ QStyleOptionTitleBar::QStyleOptionTitleBar(int version)
     \sa Qt::WindowFlags
 */
 
+#ifndef QT_NO_ITEMVIEWS
 /*!
     \class QStyleOptionViewItem
     \brief The QStyleOptionViewItem class is used to describe the
     parameters used to draw an item in a view widget.
 
     \inmodule QtWidgets
+
     QStyleOptionViewItem contains all the information that QStyle
     functions need to draw the items for Qt's model/view classes.
 
@@ -4435,6 +3372,27 @@ QStyleOptionTitleBar::QStyleOptionTitleBar(int version)
 */
 
 /*!
+    \typedef QStyleOptionViewItemV2
+    \relates QStyleOptionViewItem
+
+    Synonym for QStyleOptionViewItem.
+*/
+
+/*!
+    \typedef QStyleOptionViewItemV3
+    \relates QStyleOptionViewItem
+
+    Synonym for QStyleOptionViewItem.
+*/
+
+/*!
+    \typedef QStyleOptionViewItemV4
+    \relates QStyleOptionViewItem
+
+    Synonym for QStyleOptionViewItem.
+*/
+
+/*!
     \enum QStyleOptionViewItem::Position
 
     This enum describes the position of the item's decoration.
@@ -4479,7 +3437,8 @@ QStyleOptionViewItem::QStyleOptionViewItem()
     : QStyleOption(Version, SO_ViewItem),
       displayAlignment(Qt::AlignLeft), decorationAlignment(Qt::AlignLeft),
       textElideMode(Qt::ElideMiddle), decorationPosition(Left),
-      showDecorationSelected(false)
+      showDecorationSelected(false), features(None), widget(0),
+      checkState(Qt::Unchecked), viewItemPosition(QStyleOptionViewItem::Invalid)
 {
 }
 
@@ -4490,7 +3449,8 @@ QStyleOptionViewItem::QStyleOptionViewItem(int version)
     : QStyleOption(version, SO_ViewItem),
       displayAlignment(Qt::AlignLeft), decorationAlignment(Qt::AlignLeft),
       textElideMode(Qt::ElideMiddle), decorationPosition(Left),
-      showDecorationSelected(false)
+      showDecorationSelected(false), features(None), widget(0),
+      checkState(Qt::Unchecked), viewItemPosition(QStyleOptionViewItem::Invalid)
 {
 }
 
@@ -4522,7 +3482,7 @@ QStyleOptionViewItem::QStyleOptionViewItem(int version)
     This enum is used to hold information about the version of the style option, and
     is defined for each QStyleOption subclass.
 
-    \value Version 1
+    \value Version 4
 
     The version is used by QStyleOption subclasses to implement
     extensions without breaking compatibility. If you use
@@ -4573,6 +3533,87 @@ QStyleOptionViewItem::QStyleOptionViewItem(int version)
 */
 
 /*!
+    \variable QStyleOptionViewItem::features
+    \brief a bitwise OR of the features that describe this view item
+
+    \sa ViewItemFeature
+*/
+
+/*!
+    \enum QStyleOptionViewItem::ViewItemFeature
+
+    This enum describes the different types of features an item can have.
+
+    \value None      Indicates a normal item.
+    \value WrapText  Indicates an item with wrapped text.
+    \value Alternate Indicates that the item's background is rendered using alternateBase.
+    \value HasCheckIndicator Indicates that the item has a check state indicator.
+    \value HasDisplay        Indicates that the item has a display role.
+    \value HasDecoration     Indicates that the item has a decoration role.
+*/
+
+/*!
+    \variable QStyleOptionViewItem::index
+
+    The model index that is to be drawn.
+*/
+
+/*!
+    \variable QStyleOptionViewItem::checkState
+
+    If this view item is checkable, i.e.,
+    ViewItemFeature::HasCheckIndicator is true, \c checkState is true
+    if the item is checked; otherwise, it is false.
+
+*/
+
+/*!
+    \variable QStyleOptionViewItem::icon
+
+    The icon (if any) to be drawn in the view item.
+*/
+
+
+/*!
+    \variable QStyleOptionViewItem::text
+
+    The text (if any) to be drawn in the view item.
+*/
+
+/*!
+    \variable QStyleOptionViewItem::backgroundBrush
+
+    The QBrush that should be used to paint the view items
+    background.
+*/
+
+/*!
+    \variable QStyleOptionViewItem::viewItemPosition
+
+    Gives the position of this view item relative to other items. See
+    the \l{QStyleOptionViewItem::}{ViewItemPosition} enum for the
+    details.
+*/
+
+/*!
+    \enum QStyleOptionViewItem::ViewItemPosition
+
+    This enum is used to represent the placement of the item on
+    a row. This can be used to draw items differently depending
+    on their placement, for example by putting rounded edges at
+    the beginning and end, and straight edges in between.
+
+    \value Invalid   The ViewItemPosition is unknown and should be
+                     disregarded.
+    \value Beginning The item appears at the beginning of the row.
+    \value Middle    The item appears in the middle of the row.
+    \value End       The item appears at the end of the row.
+    \value OnlyOne   The item is the only one on the row, and is
+                     therefore both at the beginning and the end.
+*/
+
+#endif // QT_NO_ITEMVIEWS
+/*!
     \fn T qstyleoption_cast<T>(const QStyleOption *option)
     \relates QStyleOption
 
@@ -4601,7 +3642,7 @@ QStyleOptionViewItem::QStyleOptionViewItem(int version)
     parameters for drawing the frame around a tab widget.
 
     \inmodule QtWidgets
+
     QStyleOptionTabWidgetFrame contains all the information that
     QStyle functions need to draw the frame around QTabWidget.
 
@@ -4617,6 +3658,13 @@ QStyleOptionViewItem::QStyleOptionViewItem(int version)
 */
 
 /*!
+    \typedef QStyleOptionTabWidgetFrameV2
+    \relates QStyleOptionTabWidgetFrame
+
+    Synonym for QStyleOptionTabWidgetFrame.
+*/
+
+/*!
     Constructs a QStyleOptionTabWidgetFrame, initializing the members
     variables to their default values.
 */
@@ -4661,7 +3709,7 @@ QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(int version)
     This enum is used to hold information about the version of the style option, and
     is defined for each QStyleOption subclass.
 
-    \value Version 1
+    \value Version 2
 
     The version is used by QStyleOption subclasses to implement
     extensions without breaking compatibility. If you use
@@ -4714,30 +3762,7 @@ QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(int version)
 
 
 /*!
-
-    \class QStyleOptionTabWidgetFrameV2
-    \brief The QStyleOptionTabWidgetFrameV2 class is used to describe the
-    parameters for drawing the frame around a tab widget.
-
-    \inmodule QtWidgets
-    QStyleOptionTabWidgetFrameV2 contains all the information that
-    QStyle functions need to draw the frame around QTabWidget.
-
-    For performance reasons, the access to the member variables is
-    direct (i.e., using the \c . or \c -> operator). This low-level feel
-    makes the structures straightforward to use and emphasizes that
-    these are simply parameters used by the style functions.
-
-    For an example demonstrating how style options can be used, see
-    the \l {widgets/styles}{Styles} example.
-
-    \sa QStyleOption, QTabWidget
-*/
-
-
-/*!
-    \variable QStyleOptionTabWidgetFrameV2::tabBarRect
+    \variable QStyleOptionTabWidgetFrame::tabBarRect
     \brief the rectangle containing all the tabs
 
     The default value is a null rectangle, i.e. a rectangle with both
@@ -4745,7 +3770,7 @@ QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(int version)
 */
 
 /*!
-    \variable QStyleOptionTabWidgetFrameV2::selectedTabRect
+    \variable QStyleOptionTabWidgetFrame::selectedTabRect
     \brief the rectangle containing the selected tab
 
     This rectangle is contained within the tabBarRect. The default
@@ -4753,87 +3778,6 @@ QStyleOptionTabWidgetFrame::QStyleOptionTabWidgetFrame(int version)
     and the height set to 0.
 */
 
-
-/*!
-    Constructs a QStyleOptionTabWidgetFrameV2, initializing the members
-    variables to their default values.
-*/
-
-QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2()
-    : QStyleOptionTabWidgetFrame(Version)
-{
-}
-
-
-/*! \internal */
-QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(int version)
-    : QStyleOptionTabWidgetFrame(version)
-{
-}
-
-
-/*! \fn QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrameV2 &other)
-    Constructs a QStyleOptionTabWidgetFrameV2 copy of the \a other style option.
-
-    If the \a other style option's version is 1, the new style option's \l
-    selectedTabRect and tabBarRect will contain null rects
-
-    \sa version
-*/
-
-/*!
-    Constructs a QStyleOptionTabWidgetFrameV2 copy of the \a other style option.
-
-    If the \a other style option's version is 1, the new style option's \l
-    selectedTabRect and tabBarRect will contain null rects
-
-    \sa version
-*/
-QStyleOptionTabWidgetFrameV2::QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrame &other)
-{
-    QStyleOptionTabWidgetFrameV2::operator=(other);
-
-}
-
-
-/*!
-    Assigns the \a other style option to this style option. The \a
-    other style option can be either of the QStyleOptionFrameV2 or
-    QStyleOptionFrame types.
-
-    If the \a{other} style option's version is 1, this style option's
-    QStyleOptionFrameV2::FrameFeature value is set to
-    QStyleOptionFrameV2::None. If its version is 2, its
-    \l{QStyleOptionFrameV2::}{FrameFeature} value is simply copied to
-    this style option.
-*/
-QStyleOptionTabWidgetFrameV2 &QStyleOptionTabWidgetFrameV2::operator=(const QStyleOptionTabWidgetFrame &other)
-{
-    QStyleOptionTabWidgetFrame::operator=(other);
-    if (const QStyleOptionTabWidgetFrameV2 *f2 = qstyleoption_cast<const QStyleOptionTabWidgetFrameV2 *>(&other)) {
-        selectedTabRect = f2->selectedTabRect;
-        tabBarRect = f2->tabBarRect;
-    }
-    return *this;
-}
-
-
-/*!
-    \enum QStyleOptionTabWidgetFrameV2::StyleOptionVersion
-
-    This enum is used to hold information about the version of the style option, and
-    is defined for each QStyleOption subclass.
-
-    \value Version 2
-
-    The version is used by QStyleOption subclasses to implement
-    extensions without breaking compatibility. If you use
-    qstyleoption_cast(), you normally do not need to check it.
-
-    \sa StyleOptionType
-*/
-
-
 #endif // QT_NO_TABWIDGET
 
 #ifndef QT_NO_TABBAR
@@ -4845,7 +3789,7 @@ QStyleOptionTabWidgetFrameV2 &QStyleOptionTabWidgetFrameV2::operator=(const QSty
     overlaps with.
 
     \inmodule QtWidgets
+
     QStyleOptionTabBarBase  contains all the information that QStyle
     functions need to draw the tab bar base. Note that this is only
     drawn for a standalone QTabBar (one that isn't part of a
@@ -4863,17 +3807,26 @@ QStyleOptionTabWidgetFrameV2 &QStyleOptionTabWidgetFrameV2::operator=(const QSty
 */
 
 /*!
+    \typedef QStyleOptionTabBarBaseV2
+    \relates QStyleOptionTabBarBase
+
+    Synonym for QStyleOptionTabBarBase.
+*/
+
+/*!
     Construct a QStyleOptionTabBarBase, initializing the members
     vaiables to their default values.
 */
 QStyleOptionTabBarBase::QStyleOptionTabBarBase()
-    : QStyleOption(Version, SO_TabBarBase), shape(QTabBar::RoundedNorth)
+    : QStyleOption(Version, SO_TabBarBase), shape(QTabBar::RoundedNorth),
+      documentMode(false)
 {
 }
 
 /*! \internal */
 QStyleOptionTabBarBase::QStyleOptionTabBarBase(int version)
-    : QStyleOption(version, SO_TabBarBase), shape(QTabBar::RoundedNorth)
+    : QStyleOption(version, SO_TabBarBase), shape(QTabBar::RoundedNorth),
+      documentMode(false)
 {
 }
 
@@ -4905,7 +3858,7 @@ QStyleOptionTabBarBase::QStyleOptionTabBarBase(int version)
     This enum is used to hold information about the version of the style option, and
     is defined for each QStyleOption subclass.
 
-    \value Version 1
+    \value Version 2
 
     The version is used by QStyleOption subclasses to implement
     extensions without breaking compatibility. If you use
@@ -4940,96 +3893,12 @@ QStyleOptionTabBarBase::QStyleOptionTabBarBase(int version)
 
 
 /*!
-    \class QStyleOptionTabBarBaseV2
-    \brief The QStyleOptionTabBarBaseV2 class is used to describe
-    the base of a tab bar, i.e. the part that the tab bar usually
-    overlaps with.
-    \since 4.5
-    \inmodule QtWidgets
-
-    QStyleOptionTabBarBase  contains all the information that QStyle
-    functions need to draw the tab bar base.
-
-    For performance reasons, the access to the member variables is
-    direct (i.e., using the \c . or \c -> operator). This low-level feel
-    makes the structures straightforward to use and emphasizes that
-    these are simply parameters used by the style functions.
-
-    For an example demonstrating how style options can be used, see
-    the \l {widgets/styles}{Styles} example.
-
-    \sa QStyleOption, QTabBar::drawBase()
-*/
-
-/*!
-    \enum QStyleOptionTabBarBaseV2::StyleOptionVersion
-
-    This enum is used to hold information about the version of the style option, and
-    is defined for each QStyleOption subclass.
-
-    \value Version 2
-
-    The version is used by QStyleOption subclasses to implement
-    extensions without breaking compatibility. If you use
-    qstyleoption_cast(), you normally do not need to check it.
-
-    \sa StyleOptionType
-*/
-
-/*!
-    \variable QStyleOptionTabBarBaseV2::documentMode
+    \variable QStyleOptionTabBarBase::documentMode
     \brief whether the tabbar is in document mode.
 
     The default value is false;
 */
 
-/*!
-    Construct a QStyleOptionTabBarBaseV2, initializing the members
-    vaiables to their default values.
-*/
-QStyleOptionTabBarBaseV2::QStyleOptionTabBarBaseV2()
-    : QStyleOptionTabBarBase(Version)
-    , documentMode(false)
-{
-}
-
-/*!
-    \fn QStyleOptionTabBarBaseV2::QStyleOptionTabBarBaseV2(const QStyleOptionTabBarBaseV2 &other)
-
-    Constructs a copy of \a other.
-*/
-
-/*!
-    Constructs a copy of \a other.
-*/
-QStyleOptionTabBarBaseV2::QStyleOptionTabBarBaseV2(const QStyleOptionTabBarBase &other)
-    : QStyleOptionTabBarBase(Version)
-{
-    (void)QStyleOptionTabBarBaseV2::operator=(other);
-}
-
-/*!
-    Constructs a QStyleOptionTabBarBaseV2 copy of the \a other style option
-    which can be either of the QStyleOptionTabBarBaseV2, or QStyleOptionTabBarBase types.
-
-    If the other style option's version is not 1, the new style option's
-    \c documentMode is set to false.  If its version is 2, its \c documentMode value
-    is simply copied to the new style option.
-*/
-QStyleOptionTabBarBaseV2 &QStyleOptionTabBarBaseV2::operator = (const QStyleOptionTabBarBase &other)
-{
-    QStyleOptionTabBarBase::operator=(other);
-    const QStyleOptionTabBarBaseV2 *v2 = qstyleoption_cast<const QStyleOptionTabBarBaseV2*>(&other);
-    documentMode = v2 ? v2->documentMode : false;
-    return *this;
-}
-
-/*! \internal */
-QStyleOptionTabBarBaseV2::QStyleOptionTabBarBaseV2(int version)
-    : QStyleOptionTabBarBase(version), documentMode(false)
-{
-}
-
 #endif // QT_NO_TABBAR
 
 #ifndef QT_NO_SIZEGRIP
index f812a64..677a48e 100644 (file)
@@ -118,64 +118,36 @@ class Q_WIDGETS_EXPORT QStyleOptionFrame : public QStyleOption
 {
 public:
     enum StyleOptionType { Type = SO_Frame };
-    enum StyleOptionVersion { Version = 1 };
+    enum StyleOptionVersion { Version = 3 };
 
     int lineWidth;
     int midLineWidth;
-
-    QStyleOptionFrame();
-    QStyleOptionFrame(const QStyleOptionFrame &other) : QStyleOption(Version, Type) { *this = other; }
-
-protected:
-    QStyleOptionFrame(int version);
-};
-
-class Q_WIDGETS_EXPORT QStyleOptionFrameV2 : public QStyleOptionFrame
-{
-public:
-    enum StyleOptionVersion { Version = 2 };
     enum FrameFeature {
         None = 0x00,
         Flat = 0x01
     };
     Q_DECLARE_FLAGS(FrameFeatures, FrameFeature)
     FrameFeatures features;
+    QFrame::Shape frameShape;
 
-    QStyleOptionFrameV2();
-    QStyleOptionFrameV2(const QStyleOptionFrameV2 &other) : QStyleOptionFrame(Version) { *this = other; }
-    QStyleOptionFrameV2(const QStyleOptionFrame &other);
-    QStyleOptionFrameV2 &operator=(const QStyleOptionFrame &other);
+    QStyleOptionFrame();
+    QStyleOptionFrame(const QStyleOptionFrame &other) : QStyleOption(Version, Type) { *this = other; }
 
 protected:
-    QStyleOptionFrameV2(int version);
+    QStyleOptionFrame(int version);
 };
 
-Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionFrameV2::FrameFeatures)
-
-
-class Q_WIDGETS_EXPORT QStyleOptionFrameV3 : public QStyleOptionFrameV2
-{
-public:
-    enum StyleOptionVersion { Version = 3 };
-    QFrame::Shape frameShape : 4;
-    uint unused : 28;
-
-    QStyleOptionFrameV3();
-    QStyleOptionFrameV3(const QStyleOptionFrameV3 &other) : QStyleOptionFrameV2(Version) { *this = other; }
-    QStyleOptionFrameV3(const QStyleOptionFrame &other);
-    QStyleOptionFrameV3 &operator=(const QStyleOptionFrame &other);
-
-protected:
-    QStyleOptionFrameV3(int version);
-};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionFrame::FrameFeatures)
 
+typedef QStyleOptionFrame QStyleOptionFrameV2;
+typedef QStyleOptionFrame QStyleOptionFrameV3;
 
 #ifndef QT_NO_TABWIDGET
 class Q_WIDGETS_EXPORT QStyleOptionTabWidgetFrame : public QStyleOption
 {
 public:
     enum StyleOptionType { Type = SO_TabWidgetFrame };
-    enum StyleOptionVersion { Version = 1 };
+    enum StyleOptionVersion { Version = 2 };
 
     int lineWidth;
     int midLineWidth;
@@ -183,6 +155,8 @@ public:
     QSize tabBarSize;
     QSize rightCornerWidgetSize;
     QSize leftCornerWidgetSize;
+    QRect tabBarRect;
+    QRect selectedTabRect;
 
     QStyleOptionTabWidgetFrame();
     inline QStyleOptionTabWidgetFrame(const QStyleOptionTabWidgetFrame &other)
@@ -192,25 +166,8 @@ protected:
     QStyleOptionTabWidgetFrame(int version);
 };
 
-class Q_WIDGETS_EXPORT QStyleOptionTabWidgetFrameV2 : public QStyleOptionTabWidgetFrame
-{
-public:
-    enum StyleOptionVersion { Version = 2 };
-
-    QRect tabBarRect;
-    QRect selectedTabRect;
-
-    QStyleOptionTabWidgetFrameV2();
-    QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrameV2 &other) :
-            QStyleOptionTabWidgetFrame(Version) { *this = other; }
-    QStyleOptionTabWidgetFrameV2(const QStyleOptionTabWidgetFrame &other);
-    QStyleOptionTabWidgetFrameV2 &operator=(const QStyleOptionTabWidgetFrame &other);
-
-protected:
-    QStyleOptionTabWidgetFrameV2(int version);
-};
-
-#endif
+typedef QStyleOptionTabWidgetFrame QStyleOptionTabWidgetFrameV2;
+#endif // QT_NO_TABWIDGET
 
 
 #ifndef QT_NO_TABBAR
@@ -218,11 +175,12 @@ class Q_WIDGETS_EXPORT QStyleOptionTabBarBase : public QStyleOption
 {
 public:
     enum StyleOptionType { Type = SO_TabBarBase };
-    enum StyleOptionVersion { Version = 1 };
+    enum StyleOptionVersion { Version = 2 };
 
     QTabBar::Shape shape;
     QRect tabBarRect;
     QRect selectedTabRect;
+    bool documentMode;
 
     QStyleOptionTabBarBase();
     QStyleOptionTabBarBase(const QStyleOptionTabBarBase &other) : QStyleOption(Version, Type) { *this = other; }
@@ -231,21 +189,8 @@ protected:
     QStyleOptionTabBarBase(int version);
 };
 
-class Q_WIDGETS_EXPORT QStyleOptionTabBarBaseV2 : public QStyleOptionTabBarBase
-{
-public:
-    enum StyleOptionVersion { Version = 2 };
-    bool documentMode;
-    QStyleOptionTabBarBaseV2();
-    QStyleOptionTabBarBaseV2(const QStyleOptionTabBarBaseV2 &other) : QStyleOptionTabBarBase(Version) { *this = other; }
-    QStyleOptionTabBarBaseV2(const QStyleOptionTabBarBase &other);
-    QStyleOptionTabBarBaseV2 &operator=(const QStyleOptionTabBarBase &other);
-
-protected:
-    QStyleOptionTabBarBaseV2(int version);
-};
-
-#endif
+typedef QStyleOptionTabBarBase QStyleOptionTabBarBaseV2;
+#endif // QT_NO_TABBAR
 
 class Q_WIDGETS_EXPORT QStyleOptionHeader : public QStyleOption
 {
@@ -304,7 +249,7 @@ class Q_WIDGETS_EXPORT QStyleOptionTab : public QStyleOption
 {
 public:
     enum StyleOptionType { Type = SO_Tab };
-    enum StyleOptionVersion { Version = 1 };
+    enum StyleOptionVersion { Version = 3 };
 
     enum TabPosition { Beginning, Middle, End, OnlyOneTab };
     enum SelectedPosition { NotAdjacent, NextIsSelected, PreviousIsSelected };
@@ -319,6 +264,10 @@ public:
     TabPosition position;
     SelectedPosition selectedPosition;
     CornerWidgets cornerWidgets;
+    QSize iconSize;
+    bool documentMode;
+    QSize leftButtonSize;
+    QSize rightButtonSize;
 
     QStyleOptionTab();
     QStyleOptionTab(const QStyleOptionTab &other) : QStyleOption(Version, Type) { *this = other; }
@@ -329,38 +278,9 @@ protected:
 
 Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionTab::CornerWidgets)
 
-class Q_WIDGETS_EXPORT QStyleOptionTabV2 : public QStyleOptionTab
-{
-public:
-    enum StyleOptionVersion { Version = 2 };
-    QSize iconSize;
-    QStyleOptionTabV2();
-    QStyleOptionTabV2(const QStyleOptionTabV2 &other) : QStyleOptionTab(Version) { *this = other; }
-    QStyleOptionTabV2(const QStyleOptionTab &other);
-    QStyleOptionTabV2 &operator=(const QStyleOptionTab &other);
-
-protected:
-    QStyleOptionTabV2(int version);
-};
-
-class Q_WIDGETS_EXPORT QStyleOptionTabV3 : public QStyleOptionTabV2
-{
-public:
-    enum StyleOptionVersion { Version = 3 };
-    bool documentMode;
-    QSize leftButtonSize;
-    QSize rightButtonSize;
-    QStyleOptionTabV3();
-    QStyleOptionTabV3(const QStyleOptionTabV3 &other) : QStyleOptionTabV2(Version) { *this = other; }
-    QStyleOptionTabV3(const QStyleOptionTabV2 &other) : QStyleOptionTabV2(Version) { *this = other; }
-    QStyleOptionTabV3(const QStyleOptionTab &other);
-    QStyleOptionTabV3 &operator=(const QStyleOptionTab &other);
-
-protected:
-    QStyleOptionTabV3(int version);
-};
-
-#endif
+typedef QStyleOptionTab QStyleOptionTabV2;
+typedef QStyleOptionTab QStyleOptionTabV3;
+#endif // QT_NO_TABBAR
 
 
 #ifndef QT_NO_TOOLBAR
@@ -388,15 +308,13 @@ protected:
 
 Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionToolBar::ToolBarFeatures)
 
-#endif
-
-
+#endif // QT_NO_TOOLBAR
 
 class Q_WIDGETS_EXPORT QStyleOptionProgressBar : public QStyleOption
 {
 public:
     enum StyleOptionType { Type = SO_ProgressBar };
-    enum StyleOptionVersion { Version = 1 };
+    enum StyleOptionVersion { Version = 2 };
 
     int minimum;
     int maximum;
@@ -404,6 +322,9 @@ public:
     QString text;
     Qt::Alignment textAlignment;
     bool textVisible;
+    Qt::Orientation orientation;
+    bool invertedAppearance;
+    bool bottomToTop;
 
     QStyleOptionProgressBar();
     QStyleOptionProgressBar(const QStyleOptionProgressBar &other) : QStyleOption(Version, Type) { *this = other; }
@@ -412,24 +333,7 @@ protected:
     QStyleOptionProgressBar(int version);
 };
 
-// Adds style info for vertical progress bars
-class Q_WIDGETS_EXPORT QStyleOptionProgressBarV2 : public QStyleOptionProgressBar
-{
-public:
-    enum StyleOptionType { Type = SO_ProgressBar };
-    enum StyleOptionVersion { Version = 2 };
-    Qt::Orientation orientation;
-    bool invertedAppearance;
-    bool bottomToTop;
-
-    QStyleOptionProgressBarV2();
-    QStyleOptionProgressBarV2(const QStyleOptionProgressBar &other);
-    QStyleOptionProgressBarV2(const QStyleOptionProgressBarV2 &other);
-    QStyleOptionProgressBarV2 &operator=(const QStyleOptionProgressBar &other);
-
-protected:
-    QStyleOptionProgressBarV2(int version);
-};
+typedef QStyleOptionProgressBar QStyleOptionProgressBarV2;
 
 class Q_WIDGETS_EXPORT QStyleOptionMenuItem : public QStyleOption
 {
@@ -504,12 +408,13 @@ class Q_WIDGETS_EXPORT QStyleOptionDockWidget : public QStyleOption
 {
 public:
     enum StyleOptionType { Type = SO_DockWidget };
-    enum StyleOptionVersion { Version = 1 };
+    enum StyleOptionVersion { Version = 2 };
 
     QString title;
     bool closable;
     bool movable;
     bool floatable;
+    bool verticalTitleBar;
 
     QStyleOptionDockWidget();
     QStyleOptionDockWidget(const QStyleOptionDockWidget &other) : QStyleOption(Version, Type) { *this = other; }
@@ -518,28 +423,15 @@ protected:
     QStyleOptionDockWidget(int version);
 };
 
-class Q_WIDGETS_EXPORT QStyleOptionDockWidgetV2 : public QStyleOptionDockWidget
-{
-public:
-    enum StyleOptionVersion { Version = 2 };
-
-    bool verticalTitleBar;
+typedef QStyleOptionDockWidget QStyleOptionDockWidgetV2;
 
-    QStyleOptionDockWidgetV2();
-    QStyleOptionDockWidgetV2(const QStyleOptionDockWidgetV2 &other)
-        : QStyleOptionDockWidget(Version) { *this = other; }
-    QStyleOptionDockWidgetV2(const QStyleOptionDockWidget &other);
-    QStyleOptionDockWidgetV2 &operator = (const QStyleOptionDockWidget &other);
-
-protected:
-    QStyleOptionDockWidgetV2(int version);
-};
+#ifndef QT_NO_ITEMVIEWS
 
 class Q_WIDGETS_EXPORT QStyleOptionViewItem : public QStyleOption
 {
 public:
     enum StyleOptionType { Type = SO_ViewItem };
-    enum StyleOptionVersion { Version = 1 };
+    enum StyleOptionVersion { Version = 4 };
 
     enum Position { Left, Right, Top, Bottom };
 
@@ -551,18 +443,6 @@ public:
     QFont font;
     bool showDecorationSelected;
 
-    QStyleOptionViewItem();
-    QStyleOptionViewItem(const QStyleOptionViewItem &other) : QStyleOption(Version, Type) { *this = other; }
-
-protected:
-    QStyleOptionViewItem(int version);
-};
-
-class Q_WIDGETS_EXPORT QStyleOptionViewItemV2 : public QStyleOptionViewItem
-{
-public:
-    enum StyleOptionVersion { Version = 2 };
-
     enum ViewItemFeature {
         None = 0x00,
         WrapText = 0x01,
@@ -575,40 +455,9 @@ public:
 
     ViewItemFeatures features;
 
-    QStyleOptionViewItemV2();
-    QStyleOptionViewItemV2(const QStyleOptionViewItemV2 &other) : QStyleOptionViewItem(Version) { *this = other; }
-    QStyleOptionViewItemV2(const QStyleOptionViewItem &other);
-    QStyleOptionViewItemV2 &operator=(const QStyleOptionViewItem &other);
-
-protected:
-    QStyleOptionViewItemV2(int version);
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionViewItemV2::ViewItemFeatures)
-
-class Q_WIDGETS_EXPORT QStyleOptionViewItemV3 : public QStyleOptionViewItemV2
-{
-public:
-    enum StyleOptionVersion { Version = 3 };
-
     QLocale locale;
     const QWidget *widget;
 
-    QStyleOptionViewItemV3();
-    QStyleOptionViewItemV3(const QStyleOptionViewItemV3 &other)
-        : QStyleOptionViewItemV2(Version) { *this = other; }
-    QStyleOptionViewItemV3(const QStyleOptionViewItem &other);
-    QStyleOptionViewItemV3 &operator = (const QStyleOptionViewItem &other);
-
-protected:
-    QStyleOptionViewItemV3(int version);
-};
-
-#ifndef QT_NO_ITEMVIEWS
-class Q_WIDGETS_EXPORT QStyleOptionViewItemV4 : public QStyleOptionViewItemV3
-{
-public:
-    enum StyleOptionVersion { Version = 4 };
     enum ViewItemPosition { Invalid, Beginning, Middle, End, OnlyOne };
 
     QModelIndex index;
@@ -618,52 +467,45 @@ public:
     ViewItemPosition viewItemPosition;
     QBrush backgroundBrush;
 
-    QStyleOptionViewItemV4();
-    QStyleOptionViewItemV4(const QStyleOptionViewItemV4 &other)
-        : QStyleOptionViewItemV3(Version) { *this = other; }
-    QStyleOptionViewItemV4(const QStyleOptionViewItem &other);
-    QStyleOptionViewItemV4 &operator = (const QStyleOptionViewItem &other);
+    QStyleOptionViewItem();
+    QStyleOptionViewItem(const QStyleOptionViewItem &other) : QStyleOption(Version, Type) { *this = other; }
 
 protected:
-    QStyleOptionViewItemV4(int version);
+    QStyleOptionViewItem(int version);
 };
-#endif
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(QStyleOptionViewItem::ViewItemFeatures)
+
+typedef QStyleOptionViewItem QStyleOptionViewItemV2;
+typedef QStyleOptionViewItem QStyleOptionViewItemV3;
+typedef QStyleOptionViewItem QStyleOptionViewItemV4;
+
+#endif // QT_NO_ITEMVIEWS
 
 class Q_WIDGETS_EXPORT QStyleOptionToolBox : public QStyleOption
 {
 public:
     enum StyleOptionType { Type = SO_ToolBox };
-    enum StyleOptionVersion { Version = 1 };
+    enum StyleOptionVersion { Version = 2 };
 
     QString text;
     QIcon icon;
 
-    QStyleOptionToolBox();
-    QStyleOptionToolBox(const QStyleOptionToolBox &other) : QStyleOption(Version, Type) { *this = other; }
-
-protected:
-    QStyleOptionToolBox(int version);
-};
-
-class Q_WIDGETS_EXPORT QStyleOptionToolBoxV2 : public QStyleOptionToolBox
-{
-public:
-    enum StyleOptionVersion { Version = 2 };
     enum TabPosition { Beginning, Middle, End, OnlyOneTab };
     enum SelectedPosition { NotAdjacent, NextIsSelected, PreviousIsSelected };
 
     TabPosition position;
     SelectedPosition selectedPosition;
 
-    QStyleOptionToolBoxV2();
-    QStyleOptionToolBoxV2(const QStyleOptionToolBoxV2 &other) : QStyleOptionToolBox(Version) { *this = other; }
-    QStyleOptionToolBoxV2(const QStyleOptionToolBox &other);
-    QStyleOptionToolBoxV2 &operator=(const QStyleOptionToolBox &other);
+    QStyleOptionToolBox();
+    QStyleOptionToolBox(const QStyleOptionToolBox &other) : QStyleOption(Version, Type) { *this = other; }
 
 protected:
-    QStyleOptionToolBoxV2(int version);
+    QStyleOptionToolBox(int version);
 };
 
+typedef QStyleOptionToolBox QStyleOptionToolBoxV2;
+
 #ifndef QT_NO_RUBBERBAND
 class Q_WIDGETS_EXPORT QStyleOptionRubberBand : public QStyleOption
 {
index 746b721..2b52f5f 100644 (file)
@@ -1033,6 +1033,9 @@ void tst_QItemDelegate::editorEvent()
     QStyleOptionViewItem option;
     option.rect = rect;
     option.state |= QStyle::State_Enabled;
+    // mimic QStyledItemDelegate::initStyleOption logic
+    option.features |= QStyleOptionViewItem::HasCheckIndicator | QStyleOptionViewItem::HasDisplay;
+    option.checkState = Qt::CheckState(checkState);
 
     const int checkMargin = qApp->style()->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, 0) + 1;
     QPoint pos = inCheck ? qApp->style()->subElementRect(QStyle::SE_ViewItemCheckIndicator, &option, 0).center() + QPoint(checkMargin, 0) : QPoint(200,200);
@@ -1181,6 +1184,9 @@ void tst_QItemDelegate::QTBUG4435_keepSelectionOnCheck()
     QTest::qWaitForWindowShown(&view);
     QStyleOptionViewItem option;
     option.rect = view.visualRect(model.index(0, 0));
+    // mimic QStyledItemDelegate::initStyleOption logic
+    option.features = QStyleOptionViewItem::HasDisplay | QStyleOptionViewItem::HasCheckIndicator;
+    option.checkState = Qt::CheckState(model.index(0, 0).data(Qt::CheckStateRole).toInt());
     const int checkMargin = qApp->style()->pixelMetric(QStyle::PM_FocusFrameHMargin, 0, 0) + 1;
     QPoint pos = qApp->style()->subElementRect(QStyle::SE_ViewItemCheckIndicator, &option, 0).center()
                  + QPoint(checkMargin, 0);
index ae35ab3..07e0e4f 100644 (file)
@@ -2978,6 +2978,10 @@ void tst_QTreeWidget::task191552_rtl()
     QStyleOptionViewItem opt;
     opt.initFrom(&tw);
     opt.rect = tw.visualItemRect(item);
+    // mimic QStyledItemDelegate::initStyleOption logic
+    opt.features = QStyleOptionViewItem::HasDisplay | QStyleOptionViewItem::HasCheckIndicator;
+    opt.checkState = Qt::Checked;
+    opt.widget = &tw;
     const QRect checkRect = tw.style()->subElementRect(QStyle::SE_ViewItemCheckIndicator, &opt, &tw);
     QTest::mouseClick(tw.viewport(), Qt::LeftButton, Qt::NoModifier, checkRect.center());
     QTest::qWait(200);