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)
{
}
\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.
rect = widget->rect();
palette = widget->palette();
fontMetrics = widget->fontMetrics();
+ styleObject = const_cast<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)
{
}
rect = other.rect;
fontMetrics = other.fontMetrics;
palette = other.palette;
+ styleObject = other.styleObject;
return *this;
}
*/
/*!
+ \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
debug << ',' << (option.direction == Qt::RightToLeft ? "RightToLeft" : "LeftToRight");
debug << ',' << option.state;
debug << ',' << option.rect;
+ debug << ',' << option.styleObject;
debug << ')';
#else
Q_UNUSED(option);