[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdevplatform/sublime
From:       David Nolden <david.nolden.kde () art-master ! de>
Date:       2009-11-02 22:29:10
Message-ID: 1257200950.877388.11252.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1044058 by zwabel:

Disable widget updates in many situations, to somewhat reduce the ugly flickering all \
over the place when using Qt 4.6


 M  +15 -0     mainwindow.cpp  
 M  +14 -0     mainwindow_p.cpp  
 M  +16 -0     mainwindow_p.h  


--- trunk/KDE/kdevplatform/sublime/mainwindow.cpp #1044057:1044058
@@ -56,6 +56,9 @@
 }
 
 void MainWindow::setupAreaSelector() {
+    
+    DisableUpdates disableUpdates(this);
+    
     disconnect(d->areaSwitcher->tabBar, SIGNAL(currentChanged(int)), d, \
SLOT(toggleArea(int)));  
     d->areaSwitcher->tabBar->clearTabs();
@@ -95,6 +98,8 @@
 
 void MainWindow::setArea(Area *area)
 {
+    DisableUpdates disableUpdates(this);
+    
     if (d->area)
         disconnect(d->area, 0, this, 0);
     
@@ -153,6 +158,8 @@
 
 void MainWindow::clearArea()
 {
+    DisableUpdates disableUpdates(this);
+    
     emit areaCleared(d->area);
     d->clearArea();
 }
@@ -184,6 +191,8 @@
 
 void MainWindow::activateView(View *view)
 {
+    DisableUpdates disableUpdates(this);
+    
     if (!d->viewContainers.contains(view))
         return;
     
@@ -195,6 +204,8 @@
 
 void MainWindow::setActiveView(View *view)
 {
+    DisableUpdates disableUpdates(this);
+    
     View* oldActiveView = d->activeView;
     
     d->activeView = view;
@@ -208,6 +219,8 @@
 
 void Sublime::MainWindow::setActiveToolView(View *view)
 {
+    DisableUpdates disableUpdates(this);
+    
     d->activeToolView = view;
     emit activeToolViewChanged(view);
 }
@@ -327,6 +340,8 @@
 }
 void MainWindow::loadGeometry(const KConfigGroup &config)
 {
+    DisableUpdates disableUpdates(this);
+    
     // The below code, essentially, is copy-paste from
     // KMainWindow::restoreWindowSize.  Right now, that code is buggy,
     // as per http://permalink.gmane.org/gmane.comp.kde.devel.core/52423
--- trunk/KDE/kdevplatform/sublime/mainwindow_p.cpp #1044057:1044058
@@ -364,6 +364,8 @@
 
 void MainWindowPrivate::viewAdded(Sublime::AreaIndex *index, Sublime::View *view)
 {
+    DisableUpdates disableUpdates(m_mainWindow);
+    
     if(m_leftTabbarCornerWidget)
         m_leftTabbarCornerWidget->setParent(0);
     
@@ -390,11 +392,15 @@
 
 void Sublime::MainWindowPrivate::raiseToolView(Sublime::View * view)
 {
+    DisableUpdates disableUpdates(m_mainWindow);
+    
     idealMainWidget->raiseView(view);
 }
 
 void MainWindowPrivate::aboutToRemoveView(Sublime::AreaIndex *index, Sublime::View \
*view)  {
+    DisableUpdates disableUpdates(m_mainWindow);
+    
     if (!m_indexSplitters.contains(index))
         return;
 
@@ -514,12 +520,16 @@
 
 void MainWindowPrivate::toolViewAdded(Sublime::View* /*toolView*/, Sublime::Position \
position)  {
+    DisableUpdates disableUpdates(m_mainWindow);
+    
     IdealToolViewCreator toolViewCreator(this);
     area->walkToolViews(toolViewCreator, position);
 }
 
 void MainWindowPrivate::aboutToRemoveToolView(Sublime::View *toolView, \
Sublime::Position /*position*/)  {
+    DisableUpdates disableUpdates(m_mainWindow);
+    
     if (!docks.contains(toolView))
         return;
 
@@ -551,6 +561,8 @@
 
 void MainWindowPrivate::switchToArea(QAction *action)
 {
+    DisableUpdates disableUpdates(m_mainWindow);
+    
     kDebug() << "for" << action;
     controller->showArea(m_actionAreas[action], m_mainWindow);
 }
@@ -563,6 +575,8 @@
 
 void MainWindowPrivate::activateFirstVisibleView()
 {
+    DisableUpdates disableUpdates(m_mainWindow);
+    
     if (area->views().count() > 0)
         m_mainWindow->activateView(area->views().first());
 }
--- trunk/KDE/kdevplatform/sublime/mainwindow_p.h #1044057:1044058
@@ -46,6 +46,22 @@
 
 namespace Sublime {
 
+///Little helper class that safely disables updating of a widget. Might be used \
somewhere else. +struct DisableUpdates {
+    DisableUpdates(QWidget* widget) : m_widget(widget), \
m_wasEnabled(widget->updatesEnabled()) { +        if(m_wasEnabled)
+            m_widget->setUpdatesEnabled(false);
+    }
+    
+    ~DisableUpdates() {
+        if(m_wasEnabled)
+            m_widget->setUpdatesEnabled(true);
+    }
+    
+    QWidget* m_widget;
+    bool m_wasEnabled;
+};
+
 class View;
 class Container;
 class Controller;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic