summaryrefslogtreecommitdiffstats
path: root/src/kernel/qstyle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/qstyle.cpp')
-rw-r--r--src/kernel/qstyle.cpp94
1 files changed, 49 insertions, 45 deletions
diff --git a/src/kernel/qstyle.cpp b/src/kernel/qstyle.cpp
index 4e689c2..c7f4ef4 100644
--- a/src/kernel/qstyle.cpp
+++ b/src/kernel/qstyle.cpp
@@ -54,7 +54,6 @@
#include <limits.h>
-
class QStylePrivate
{
public:
@@ -495,7 +494,7 @@ void QStyle::unPolish( QWidget *widget ) {
\sa unPolish()
*/
-void QStyle::polish( QStyleControlElementData ceData, ControlElementFlags, void *ptr ) {
+void QStyle::polish( const QStyleControlElementData &ceData, ControlElementFlags, void *ptr ) {
if (ceData.widgetObjectTypes.contains("QWidget")) {
// Enable dynamic hide/show of accelerator shortcuts
QWidget* widget = reinterpret_cast<QWidget*>(ptr);
@@ -513,7 +512,7 @@ void QStyle::polish( QStyleControlElementData ceData, ControlElementFlags, void
\sa polish()
*/
-void QStyle::unPolish( QStyleControlElementData ceData, ControlElementFlags, void *ptr ) {
+void QStyle::unPolish( const QStyleControlElementData &ceData, ControlElementFlags, void *ptr ) {
if (ceData.widgetObjectTypes.contains("QWidget")) {
// Disable dynamic hide/show of accelerator shortcuts
QWidget* widget = reinterpret_cast<QWidget*>(ptr);
@@ -555,7 +554,7 @@ void QStyle::unPolish( QApplication *app ) {
\sa unPolish()
*/
-void QStyle::applicationPolish( QStyleControlElementData, ControlElementFlags, void * ) {
+void QStyle::applicationPolish( const QStyleControlElementData&, ControlElementFlags, void * ) {
//
}
@@ -571,7 +570,7 @@ void QStyle::applicationPolish( QStyleControlElementData, ControlElementFlags, v
\sa polish()
*/
-void QStyle::applicationUnPolish( QStyleControlElementData, ControlElementFlags, void * ) {
+void QStyle::applicationUnPolish( const QStyleControlElementData&, ControlElementFlags, void * ) {
//
}
@@ -605,7 +604,7 @@ void QStyle::polishPopupMenu( QPopupMenu *pm ) {
(\l{QPopupMenu::setMouseTracking()}) and whether the menu is
checkable by default (\l{QPopupMenu::setCheckable()}).
*/
-void QStyle::polishPopupMenu( QStyleControlElementData, ControlElementFlags, void * )
+void QStyle::polishPopupMenu( const QStyleControlElementData&, ControlElementFlags, void * )
{
}
@@ -909,7 +908,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r,
*/
/*!
- \fn void QStyle::drawPrimitive( PrimitiveElement pe, QPainter *p, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QRect &r, const QColorGroup &cg, SFlags flags, const QStyleOption& opt) const
+ \fn void QStyle::drawPrimitive( PrimitiveElement pe, QPainter *p, const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QRect &r, const QColorGroup &cg, SFlags flags, const QStyleOption& opt) const
Draws the style PrimitiveElement \a pe using the painter \a p in
the area \a r. Colors are used from the color group \a cg.
@@ -1042,7 +1041,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r,
*/
/*!
- \fn void QStyle::drawControl( ControlElement element, QPainter *p, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QRect &r, const QColorGroup &cg, SFlags how, const QStyleOption& opt, const QWidget *widget) const
+ \fn void QStyle::drawControl( ControlElement element, QPainter *p, const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QRect &r, const QColorGroup &cg, SFlags how, const QStyleOption& opt, const QWidget *widget) const
Draws the ControlElement \a element using the painter \a p in the
area \a r. Colors are used from the color group \a cg.
@@ -1201,7 +1200,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r,
*/
/*!
- \fn void QStyle::drawControlMask( ControlElement element, QPainter *p, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QRect &r, const QStyleOption& opt, const QWidget *widget) const
+ \fn void QStyle::drawControlMask( ControlElement element, QPainter *p, const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QRect &r, const QStyleOption& opt, const QWidget *widget) const
Draw a bitmask for the ControlElement \a element using the painter
\a p in the area \a r. See drawControl() for an explanation of the
@@ -1274,7 +1273,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r,
*/
/*!
- \fn QRect QStyle::subRect( SubRect subrect, const QStyleControlElementData ceData, const ControlElementFlags elementFlags, const QWidget *widget ) const;
+ \fn QRect QStyle::subRect( SubRect subrect, const QStyleControlElementData &ceData, const ControlElementFlags elementFlags, const QWidget *widget ) const;
Returns the sub-area \a subrect for the \a widget in logical
coordinates.
@@ -1406,7 +1405,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r,
*/
/*!
- \fn void QStyle::drawComplexControl( ComplexControl control, QPainter *p, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QRect &r, const QColorGroup &cg, SFlags how, SCFlags sub, SCFlags subActive, const QStyleOption& opt, const QWidget *widget ) const
+ \fn void QStyle::drawComplexControl( ComplexControl control, QPainter *p, const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QRect &r, const QColorGroup &cg, SFlags how, SCFlags sub, SCFlags subActive, const QStyleOption& opt, const QWidget *widget ) const
Draws the ComplexControl \a control using the painter \a p in the
area \a r. Colors are used from the color group \a cg. The \a sub
@@ -1504,7 +1503,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r,
*/
/*!
- \fn void QStyle::drawComplexControlMask( ComplexControl control, QPainter *p, const QStyleControlElementData ceData, const ControlElementFlags elementFlags, const QRect &r, const QStyleOption& opt, const QWidget *widget) const
+ \fn void QStyle::drawComplexControlMask( ComplexControl control, QPainter *p, const QStyleControlElementData &ceData, const ControlElementFlags elementFlags, const QRect &r, const QStyleOption& opt, const QWidget *widget) const
Draw a bitmask for the ComplexControl \a control using the painter
\a p in the area \a r. See drawComplexControl() for an explanation
@@ -1524,7 +1523,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r,
*/
/*!
- \fn QRect QStyle::querySubControlMetrics( ComplexControl control, QStyleControlElementData ceData, ControlElementFlags elementFlags, SubControl subcontrol, const QStyleOption& opt = QStyleOption::Default, const QWidget *widget = 0 ) const;
+ \fn QRect QStyle::querySubControlMetrics( ComplexControl control, const QStyleControlElementData &ceData, ControlElementFlags elementFlags, SubControl subcontrol, const QStyleOption& opt = QStyleOption::Default, const QWidget *widget = 0 ) const;
Returns the rect for the SubControl \a subcontrol for \a widget in
logical coordinates.
@@ -1546,7 +1545,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r,
*/
/*!
- \fn SubControl QStyle::querySubControl( ComplexControl control, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QPoint &pos, const QStyleOption& opt = QStyleOption::Default, const QWidget *widget = 0 ) const;
+ \fn SubControl QStyle::querySubControl( ComplexControl control, const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QPoint &pos, const QStyleOption& opt = QStyleOption::Default, const QWidget *widget = 0 ) const;
Returns the SubControl for \a widget at the point \a pos. The \a
widget argument is a pointer to a QWidget or one of its
@@ -1672,7 +1671,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r,
*/
/*!
- \fn int QStyle::pixelMetric( PixelMetric metric, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QWidget *widget = 0 ) const;
+ \fn int QStyle::pixelMetric( PixelMetric metric, const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QWidget *widget = 0 ) const;
Returns the pixel metric for \a metric.
@@ -1734,7 +1733,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r,
*/
/*!
- \fn QSize QStyle::sizeFromContents( ContentsType contents, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QSize &contentsSize, const QStyleOption& opt = QStyleOption::Default, const QWidget *widget = 0 ) const;
+ \fn QSize QStyle::sizeFromContents( ContentsType contents, const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QSize &contentsSize, const QStyleOption& opt = QStyleOption::Default, const QWidget *widget = 0 ) const;
Returns the size of \a widget based on the contents size \a
contentsSize.
@@ -1924,7 +1923,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r,
*/
/*!
- \fn int QStyle::styleHint( StyleHint stylehint, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QStyleOption &opt = QStyleOption::Default, QStyleHintReturn *returnData = 0, const QWidget *widget = 0 ) const;
+ \fn int QStyle::styleHint( StyleHint stylehint, const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QStyleOption &opt = QStyleOption::Default, QStyleHintReturn *returnData = 0, const QWidget *widget = 0 ) const;
Returns the style hint \a stylehint for \a widget. Currently, \a
widget, \a opt, and \a returnData are unused; they're included to
@@ -1971,7 +1970,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r,
*/
/*!
- \fn QPixmap QStyle::stylePixmap( StylePixmap stylepixmap, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QStyleOption& opt = QStyleOption::Default, const QWidget *widget = 0 ) const;
+ \fn QPixmap QStyle::stylePixmap( StylePixmap stylepixmap, const QStyleControlElementData &ceData, ControlElementFlags elementFlags, const QStyleOption& opt = QStyleOption::Default, const QWidget *widget = 0 ) const;
Returns a pixmap for \a stylepixmap.
@@ -2011,7 +2010,7 @@ void QStyle::drawItem( QPainter *p, const QRect &r,
function is provided to aid style implementors in supporting
right-to-left mode.
- Note that this function is deprecated in favor of visualRect( const QRect &logical, const QStyleControlElementData ceData, const ControlElementFlags elementFlags );
+ Note that this function is deprecated in favor of visualRect( const QRect &logical, const QStyleControlElementData &ceData, const ControlElementFlags elementFlags );
\sa QApplication::reverseLayout()
*/
@@ -2023,7 +2022,7 @@ QRect QStyle::visualRect( const QRect &logical, const QWidget *w )
}
/*!
- \fn QRect QStyle::visualRect( const QRect &logical, const QStyleControlElementData ceData, const ControlElementFlags elementFlags );
+ \fn QRect QStyle::visualRect( const QRect &logical, const QStyleControlElementData &ceData, const ControlElementFlags elementFlags );
Returns the rect \a logical in screen coordinates. The bounding
rect for the widget described by \a ceData and \a elementFlags
@@ -2033,7 +2032,7 @@ QRect QStyle::visualRect( const QRect &logical, const QWidget *w )
\sa QApplication::reverseLayout()
*/
-QRect QStyle::visualRect( const QRect &logical, const QStyleControlElementData ceData, const ControlElementFlags elementFlags )
+QRect QStyle::visualRect( const QRect &logical, const QStyleControlElementData &ceData, const ControlElementFlags elementFlags )
{
Q_UNUSED(elementFlags)
@@ -2065,15 +2064,15 @@ QRect QStyle::visualRect( const QRect &logical, const QRect &boundingRect )
}
/*!
- \fn void QStyle::installObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler );
+ \fn void QStyle::installObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler );
Intercepts events generated by \a source and sends them to \a handler via
- the bool QStyle::objectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QEvent *e ) virtual method.
+ the bool QStyle::objectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QEvent *e ) virtual method.
\sa void QStyle::removeObjectEventHandler( QObject* source, QStyle* handler )
- \sa bool QStyle::objectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QEvent *e )
+ \sa bool QStyle::objectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QEvent *e )
*/
-void QStyle::installObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) {
+void QStyle::installObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) {
bool cbret = false;
if (m_eventHandlerInstallationHook) {
cbret = (*m_eventHandlerInstallationHook)(ceData, elementFlags, source, handler);
@@ -2090,13 +2089,13 @@ void QStyle::installObjectEventHandler( QStyleControlElementData ceData, Control
}
/*!
- \fn void QStyle::removeObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler );
+ \fn void QStyle::removeObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler );
Stops intercepting events generated by \a source.
- \sa void QStyle::installObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler )
+ \sa void QStyle::installObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler )
*/
-void QStyle::removeObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) {
+void QStyle::removeObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ) {
bool cbret = false;
if (m_eventHandlerRemovalHook) {
cbret = (*m_eventHandlerRemovalHook)(ceData, elementFlags, source, handler);
@@ -2117,9 +2116,9 @@ void QStyle::removeObjectEventHandler( QStyleControlElementData ceData, ControlE
Sets a callback function \a hook which will be called whenever a new intercept request
is made via the QStyle::installObjectEventHandler method. The callback function must
- use this definition: bool callbackFunction( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ).
+ use this definition: bool callbackFunction( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ).
- \sa void QStyle::installObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler )
+ \sa void QStyle::installObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler )
*/
void QStyle::setEventHandlerInstallationHook( EventHandlerInstallationHook hook ) {
m_eventHandlerInstallationHook = hook;
@@ -2130,24 +2129,24 @@ void QStyle::setEventHandlerInstallationHook( EventHandlerInstallationHook hook
Sets a callback function \a hook which will be called whenever a new intercept deactivation request
is made via the QStyle::removeObjectEventHandler method. The callback function must
- use this definition: bool callbackFunction( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ).
+ use this definition: bool callbackFunction( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ).
- \sa void QStyle::removeObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler )
+ \sa void QStyle::removeObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler )
*/
void QStyle::setEventHandlerRemovalHook( EventHandlerRemovalHook hook ) {
m_eventHandlerRemovalHook = hook;
}
/*!
- \fn bool QStyle::objectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QEvent *e );
+ \fn bool QStyle::objectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QEvent *e );
Override this virtual function to intercept events requested by a previous call to
QStyle::installObjectEventHandler.
- \sa void QStyle::installObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler )
- \sa void QStyle::removeObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler )
+ \sa void QStyle::installObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler )
+ \sa void QStyle::removeObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler )
*/
-bool QStyle::objectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QEvent *e ) {
+bool QStyle::objectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QEvent *e ) {
Q_UNUSED(ceData);
Q_UNUSED(elementFlags);
Q_UNUSED(source);
@@ -2193,20 +2192,20 @@ bool QStyle::eventFilter(QObject *o, QEvent *e) {
Sets a callback function \a hook which will be called whenever a new widget action request
is made via the QStyle::installObjectEventHandler method. The callback function must
- use this definition: bool callbackFunction( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ).
+ use this definition: bool callbackFunction( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ).
- \sa void QStyle::installObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler )
+ \sa void QStyle::installObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler )
*/
void QStyle::setWidgetActionRequestHook( WidgetActionRequestHook hook ) {
m_widgetActionRequestHook = hook;
}
/*!
- \fn bool widgetActionRequestHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, WidgetActionRequest request );
+ \fn bool widgetActionRequestHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, WidgetActionRequest request );
Handles widget action requests. Return FALSE to continue processing in base classes, TRUE to eat the request and halt processing.
*/
-bool QStyle::widgetActionRequest( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, WidgetActionRequest request, QStyleWidgetActionRequestData requestData ) {
+bool QStyle::widgetActionRequest( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, WidgetActionRequest request, QStyleWidgetActionRequestData requestData ) {
bool cbret = false;
if (m_widgetActionRequestHook) {
cbret = (*m_widgetActionRequestHook)(ceData, elementFlags, source, request, requestData);
@@ -2327,20 +2326,20 @@ bool QStyle::widgetActionRequest( QStyleControlElementData ceData, ControlElemen
Sets a callback function \a hook which will be called whenever a new application action request
is made via the QStyle::installObjectEventHandler method. The callback function must
- use this definition: bool callbackFunction( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ).
+ use this definition: bool callbackFunction( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler ).
- \sa void QStyle::installObjectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QStyle* handler )
+ \sa void QStyle::installObjectEventHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, QStyle* handler )
*/
void QStyle::setApplicationActionRequestHook( ApplicationActionRequestHook hook ) {
m_applicationActionRequestHook = hook;
}
/*!
- \fn bool applicationActionRequestHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, ApplicationActionRequest request );
+ \fn bool applicationActionRequestHandler( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, ApplicationActionRequest request );
Handles application action requests. Return FALSE to continue processing in base classes, TRUE to eat the request and halt processing.
*/
-bool QStyle::applicationActionRequest( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, ApplicationActionRequest request, QStyleApplicationActionRequestData requestData ) {
+bool QStyle::applicationActionRequest( const QStyleControlElementData &ceData, ControlElementFlags elementFlags, void* source, ApplicationActionRequest request, QStyleApplicationActionRequestData requestData ) {
bool cbret = false;
if (m_applicationActionRequestHook) {
cbret = (*m_applicationActionRequestHook)(ceData, elementFlags, source, request, requestData);
@@ -2579,7 +2578,11 @@ QSize QStyle::sizeFromContents(ContentsType contents,
int QStyle::styleHint(StyleHint sh, const QWidget * w, const QStyleOption &so, QStyleHintReturn *shr) const
{
- QStyleControlElementData ceData = populateControlElementDataFromWidget(w, so, false);
+ bool ceDataNotNeeded = false;
+ if (sh == SH_Widget_ShareActivation) {
+ ceDataNotNeeded = true;
+ }
+ QStyleControlElementData ceData = populateControlElementDataFromWidget(w, so, false, ceDataNotNeeded);
return styleHint(sh, ceData, getControlElementFlagsForObject(w, ceData.widgetObjectTypes, QStyleOption(), false), so, shr, w);
}
@@ -2605,6 +2608,7 @@ QPixmap QStyle::stylePixmap(StylePixmap sp, const QWidget *w, const QStyleOption
*/
QStyleControlElementData::QStyleControlElementData() {
+ isNull = true;
activePainter = 0;
tickMarkSetting = 0;
comboBoxLineEditFlags = 0;