summaryrefslogtreecommitdiffstats
path: root/src/widgets/styles/qstyleoption.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/styles/qstyleoption.cpp')
-rw-r--r--src/widgets/styles/qstyleoption.cpp43
1 files changed, 34 insertions, 9 deletions
diff --git a/src/widgets/styles/qstyleoption.cpp b/src/widgets/styles/qstyleoption.cpp
index bc363d3a31..53c1cf4559 100644
--- a/src/widgets/styles/qstyleoption.cpp
+++ b/src/widgets/styles/qstyleoption.cpp
@@ -41,8 +41,7 @@
#include "qstyleoption.h"
#include "qapplication.h"
-#ifdef Q_WS_MAC
-# include "private/qt_mac_p.h"
+#ifdef Q_OS_MAC
# include "qmacstyle_mac.h"
#endif
#include <qdebug.h>
@@ -155,7 +154,7 @@ QT_BEGIN_NAMESPACE
QStyleOption::QStyleOption(int version, int type)
: version(version), type(type), state(QStyle::State_None),
- direction(QApplication::layoutDirection()), fontMetrics(QFont())
+ direction(QApplication::layoutDirection()), fontMetrics(QFont()), styleObject(0)
{
}
@@ -171,8 +170,8 @@ QStyleOption::~QStyleOption()
\fn void QStyleOption::initFrom(const QWidget *widget)
\since 4.1
- Initializes the \l state, \l direction, \l rect, \l palette, and
- \l fontMetrics member variables based on the specified \a widget.
+ Initializes the \l state, \l direction, \l rect, \l palette, \l fontMetrics
+ and \l styleObject member variables based on the specified \a widget.
This is a convenience function; the member variables can also be
initialized manually.
@@ -206,7 +205,8 @@ void QStyleOption::init(const QWidget *widget)
extern bool qt_mac_can_clickThrough(const QWidget *w); //qwidget_mac.cpp
if (!(state & QStyle::State_Active) && !qt_mac_can_clickThrough(widget))
state &= ~QStyle::State_Enabled;
-
+#endif
+#ifdef Q_OS_MAC
switch (QMacStyle::widgetSizePolicy(widget)) {
case QMacStyle::SizeSmall:
state |= QStyle::State_Small;
@@ -227,6 +227,7 @@ void QStyleOption::init(const QWidget *widget)
rect = widget->rect();
palette = widget->palette();
fontMetrics = widget->fontMetrics();
+ styleObject = const_cast<QWidget*>(widget);
}
/*!
@@ -235,7 +236,7 @@ void QStyleOption::init(const QWidget *widget)
QStyleOption::QStyleOption(const QStyleOption &other)
: version(Version), type(Type), state(other.state),
direction(other.direction), rect(other.rect), fontMetrics(other.fontMetrics),
- palette(other.palette)
+ palette(other.palette), styleObject(other.styleObject)
{
}
@@ -249,6 +250,7 @@ QStyleOption &QStyleOption::operator=(const QStyleOption &other)
rect = other.rect;
fontMetrics = other.fontMetrics;
palette = other.palette;
+ styleObject = other.styleObject;
return *this;
}
@@ -312,6 +314,15 @@ QStyleOption &QStyleOption::operator=(const QStyleOption &other)
*/
/*!
+ \variable QStyleOption::styleObject
+ \brief the object being styled
+
+ The built-in styles support the following types: QWidget, QGraphicsObject and QQuickItem.
+
+ \sa initFrom()
+*/
+
+/*!
\variable QStyleOption::rect
\brief the area that should be used for various calculations and painting
@@ -1271,7 +1282,8 @@ QStyleOptionTab::QStyleOptionTab()
row(0),
position(Beginning),
selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets),
- documentMode(false)
+ documentMode(false),
+ features(QStyleOptionTab::None)
{
}
@@ -1284,7 +1296,8 @@ QStyleOptionTab::QStyleOptionTab(int version)
row(0),
position(Beginning),
selectedPosition(NotAdjacent), cornerWidgets(QStyleOptionTab::NoCornerWidgets),
- documentMode(false)
+ documentMode(false),
+ features(QStyleOptionTab::None)
{
}
@@ -1438,6 +1451,17 @@ QStyleOptionTab::QStyleOptionTab(int version)
*/
/*!
+ \enum QStyleOptionTab::TabFeature
+
+ Describes the various features that a tab button can have.
+
+ \value None A normal tab button.
+ \value HasFrame The tab button is positioned on a tab frame
+
+ \sa features
+*/
+
+/*!
\variable QStyleOptionTab::leftButtonSize
\brief the size for the left widget on the tab.
@@ -4043,6 +4067,7 @@ QDebug operator<<(QDebug debug, const QStyleOption &option)
debug << ',' << (option.direction == Qt::RightToLeft ? "RightToLeft" : "LeftToRight");
debug << ',' << option.state;
debug << ',' << option.rect;
+ debug << ',' << option.styleObject;
debug << ')';
#else
Q_UNUSED(option);