[vlc-devel] commit: Qt: apply big and flat attributes to all QToolButton, even if they are sub-children of a QFrame. (Jean-Baptiste Kempf )

git version control git at videolan.org
Mon Apr 20 11:04:22 CEST 2009


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun Apr 19 17:53:44 2009 +0200| [20b1d363ce6fef6483d546c95f686650d092493c] | committer: Jean-Baptiste Kempf 

Qt: apply big and flat attributes to all QToolButton, even if they are sub-children of a QFrame.

This apply to teletext and DVD menus buttons.
Close #2516.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=20b1d363ce6fef6483d546c95f686650d092493c
---

 modules/gui/qt4/components/controller.cpp |   34 +++++++++++++++++++++-------
 modules/gui/qt4/components/controller.hpp |    3 +-
 2 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/modules/gui/qt4/components/controller.cpp b/modules/gui/qt4/components/controller.cpp
index f3e102c..b078d94 100644
--- a/modules/gui/qt4/components/controller.cpp
+++ b/modules/gui/qt4/components/controller.cpp
@@ -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 */
diff --git a/modules/gui/qt4/components/controller.hpp b/modules/gui/qt4/components/controller.hpp
index 39c07ef..bf3fe8c 100644
--- a/modules/gui/qt4/components/controller.hpp
+++ b/modules/gui/qt4/components/controller.hpp
@@ -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 );
 




More information about the vlc-devel mailing list