[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdebase/workspace/kstyles/oxygen
From: Hugo Pereira Da Costa <hugo () oxygen-icons ! org>
Date: 2010-12-23 11:33:30
Message-ID: 20101223113330.D91F03E1F1 () svn ! kde ! org
[Download RAW message or body]
SVN commit 1208813 by hpereiradacosta:
Changed logic for installing background gradient hint.
It is now installed at first QEvent::Show. This prevents false-positive for \
topLevelWindow, and allows to use ->winId()
M +18 -5 oxygenstyle.cpp
M +25 -0 oxygenstyle.h
--- trunk/KDE/kdebase/workspace/kstyles/oxygen/oxygenstyle.cpp #1208812:1208813
@@ -134,6 +134,18 @@
static const QStyle::StyleHint SH_KCustomStyleElement = ( QStyle::StyleHint \
)0xff000001; static const int X_KdeBase = 0xff000000;
+ //_____________________________________________________________________
+ bool TopLevelManager::eventFilter( QObject *object, QEvent *event )
+ {
+
+ // cast to QWidget
+ QWidget *widget = static_cast<QWidget*>( object );
+ if( event->type() == QEvent::Show && _helper.hasDecoration( widget ) )
+ { _helper.setHasBackgroundGradient( widget->winId(), true ); }
+
+ return false;
+ }
+
//______________________________________________________________
Style::Style( void ):
_addLineButtons( DoubleButton ),
@@ -145,6 +157,7 @@
_animations( new Animations( this ) ),
_transitions( new Transitions( this ) ),
_windowManager( new WindowManager( this ) ),
+ _topLevelManager( new TopLevelManager( this, *_helper ) ),
_frameShadowFactory( new FrameShadowFactory( this ) ),
_widgetExplorer( new WidgetExplorer( this ) ),
_tabBarData( new TabBarData( this ) ),
@@ -236,11 +249,7 @@
// set background as styled
widget->setAttribute( Qt::WA_StyledBackground );
-
- // install WM hint
- if( widget->isWindow() )
- { helper().setHasBackgroundGradient( widget->effectiveWinId(), true ); }
-
+ widget->installEventFilter( _topLevelManager );
break;
case Qt::ToolTip:
@@ -260,6 +269,10 @@
}
+// // install WM hint
+// if( helper().hasDecoration( widget ) )
+// { helper().setHasBackgroundGradient( widget->winId(), true ); }
+
if(
qobject_cast<QAbstractItemView*>( widget )
|| qobject_cast<QAbstractSpinBox*>( widget )
--- trunk/KDE/kdebase/workspace/kstyles/oxygen/oxygenstyle.h #1208812:1208813
@@ -68,6 +68,28 @@
class FrameShadowFactory;
class WidgetExplorer;
+ //! toplevel manager
+ class TopLevelManager: public QObject
+ {
+ public:
+
+ //! constructor
+ TopLevelManager( QObject* parent, const StyleHelper& helper ):
+ QObject( parent ),
+ _helper( helper )
+ {}
+
+ //! event filter
+ virtual bool eventFilter(QObject *, QEvent *);
+
+ private:
+
+ //! helper
+ const StyleHelper& _helper;
+
+ };
+
+
//! base class for oxygen style
/*! it is responsible to draw all the primitives to be displayed on screen, on \
request from Qt paint engine */ class Style: public QCommonStyle
@@ -903,6 +925,9 @@
//! window manager
WindowManager* _windowManager;
+ //! toplevel manager
+ TopLevelManager* _topLevelManager;
+
//! frame shadows
FrameShadowFactory* _frameShadowFactory;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic