]> git.sesse.net Git - vlc/commitdiff
Qt: apply big and flat attributes to all QToolButton, even if they are sub-children...
authorJean-Baptiste Kempf <jb@videolan.org>
Sun, 19 Apr 2009 15:53:44 +0000 (17:53 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 20 Apr 2009 09:02:17 +0000 (11:02 +0200)
This apply to teletext and DVD menus buttons.
Close #2516.

modules/gui/qt4/components/controller.cpp
modules/gui/qt4/components/controller.hpp

index f3e102ccbc4cd376113c4f970427b117919c8d40..b078d945917e287410f2e955db39dd91517e3dc6 100644 (file)
@@ -426,21 +426,37 @@ QWidget *AbstractController::createWidget( buttonType_e button, int options )
     /* Customize Buttons */
     if( b_flat || b_big )
     {
-        QToolButton *tmpButton = qobject_cast<QToolButton *>(widget);
-        if( tmpButton )
+        QFrame *frame = qobject_cast<QFrame *>(widget);
+        if( frame )
         {
-            if( b_flat )
-                tmpButton->setAutoRaise( b_flat );
-            if( b_big )
-            {
-                tmpButton->setFixedSize( QSize( 32, 32 ) );
-                tmpButton->setIconSize( QSize( 26, 26 ) );
-            }
+            QList<QToolButton *> allTButtons = frame->findChildren<QToolButton *>();
+            for( int i = 0; i < allTButtons.size(); i++ )
+                applyAttributes( allTButtons[i], b_flat, b_big );
+        }
+        else
+        {
+            QToolButton *tmpButton = qobject_cast<QToolButton *>(widget);
+            if( tmpButton )
+                applyAttributes( tmpButton, b_flat, b_big );
         }
     }
     return widget;
 }
 
+void AbstractController::applyAttributes( QToolButton *tmpButton, bool b_flat, bool b_big )
+{
+    if( tmpButton )
+    {
+        if( b_flat )
+            tmpButton->setAutoRaise( b_flat );
+        if( b_big )
+        {
+            tmpButton->setFixedSize( QSize( 32, 32 ) );
+            tmpButton->setIconSize( QSize( 26, 26 ) );
+        }
+    }
+}
+
 QFrame *AbstractController::discFrame()
 {
     /** Disc and Menus handling */
index 39c07ef240408c1ce6c65053c197d2054ec074f4..bf3fe8c2d54537ac6e8e5f353a30e0d42e6cd816 100644 (file)
@@ -51,6 +51,7 @@ class QBoxLayout;
 class QAbstractSlider;
 class QAbstractButton;
 class InputSlider;
+class QToolButton;
 
 class VolumeClickHandler;
 class WidgetListing;
@@ -153,7 +154,7 @@ private:
     static void setupButton( QAbstractButton * );
     QFrame *discFrame();
     QFrame *telexFrame();
-
+    void applyAttributes( QToolButton *, bool b_flat, bool b_big );
 protected slots:
     virtual void setStatus( int );