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

List:       kde-commits
Subject:    [kdelibs/frameworks] staging/frameworkintegration: Update ToolButtonStyle plus tests
From:       Àlex_Fiestas <afiestas () kde ! org>
Date:       2013-08-29 1:54:50
Message-ID: E1VErRi-0003mC-HY () scm ! kde ! org
[Download RAW message or body]

Git commit 887c13220586da7eae5f452e81808a764b9ba634 by Àlex Fiestas.
Committed on 29/08/2013 at 00:29.
Pushed by afiestas into branch 'frameworks'.

Update ToolButtonStyle plus tests

M  +1    -1    staging/frameworkintegration/autotests/kdeplatformtheme_changed_kdeglobals
 M  +5    -0    staging/frameworkintegration/autotests/kdeplatformtheme_unittest.cpp
M  +17   -0    staging/frameworkintegration/src/platformtheme/khintssettings.cpp

http://commits.kde.org/kdelibs/887c13220586da7eae5f452e81808a764b9ba634

diff --git a/staging/frameworkintegration/autotests/kdeplatformtheme_changed_kdeglobals \
b/staging/frameworkintegration/autotests/kdeplatformtheme_changed_kdeglobals index \
                817025c..b313f9a 100644
--- a/staging/frameworkintegration/autotests/kdeplatformtheme_changed_kdeglobals
+++ b/staging/frameworkintegration/autotests/kdeplatformtheme_changed_kdeglobals
@@ -3,7 +3,7 @@ CursorBlinkRate=1022
 DoubleClickInterval=401
 StartDragDist=35
 StartDragTime=501
-ToolButtonStyle=textonly
+ToolButtonStyle=textundericon
 SingleClick=false
 IconsTheme=non-existent-icon-theme
 WidgetStyle=non-existent-widget-style
diff --git a/staging/frameworkintegration/autotests/kdeplatformtheme_unittest.cpp \
b/staging/frameworkintegration/autotests/kdeplatformtheme_unittest.cpp index \
                5d00f11..0b8fe7f 100644
--- a/staging/frameworkintegration/autotests/kdeplatformtheme_unittest.cpp
+++ b/staging/frameworkintegration/autotests/kdeplatformtheme_unittest.cpp
@@ -181,6 +181,11 @@ class KdePlatformTheme_UnitTest : public QObject
 
             QCOMPARE(qApp->wheelScrollLines(), 122);
             QCOMPARE(qApp->testAttribute(Qt::AA_DontShowIconsInMenus), true);
+
+            sendNotifyChange(KHintsSettings::ToolbarStyleChanged, 2);
+            m_loop.exec();
+
+            QCOMPARE(m_qpa->themeHint(QPlatformTheme::ToolButtonStyle).toInt(), \
(int) Qt::ToolButtonTextUnderIcon);  }
 };
 
diff --git a/staging/frameworkintegration/src/platformtheme/khintssettings.cpp \
b/staging/frameworkintegration/src/platformtheme/khintssettings.cpp index \
                6064a12..63703fb 100644
--- a/staging/frameworkintegration/src/platformtheme/khintssettings.cpp
+++ b/staging/frameworkintegration/src/platformtheme/khintssettings.cpp
@@ -27,6 +27,7 @@
 #include <QString>
 #include <QFileInfo>
 #include <QToolBar>
+#include <QToolButton>
 #include <QMainWindow>
 #include <QApplication>
 #include <QGuiApplication>
@@ -123,6 +124,22 @@ void KHintsSettings::slotNotifyChange(int type, int arg)
         }
         break;
     }
+    case ToolbarStyleChanged: {
+        KSharedConfig::Ptr ptr = KSharedConfig::openConfig("kdeglobals");
+        ptr->reparseConfiguration();
+        KConfigGroup cg(ptr, "KDE");
+        m_hints[QPlatformTheme::ToolButtonStyle] = toolButtonStyle(cg);
+        //from gtksymbol.cpp
+        QWidgetList widgets = QApplication::allWidgets();
+        for (int i = 0; i < widgets.size(); ++i) {
+            QWidget *widget = widgets.at(i);
+            if (qobject_cast<QToolButton*>(widget)) {
+                QEvent event(QEvent::StyleChange);
+                QApplication::sendEvent(widget, &event);
+            }
+        }
+        break;
+    }
     default:
         qWarning() << "Unknown type of change in KGlobalSettings::slotNotifyChange: \
" << type;  }


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

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