[vlc-commits] Qt: Force custom toolbars not to follow RTL auto layout changes.

Francois Cartegnie git at videolan.org
Sun Sep 18 01:42:53 CEST 2011


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Sep 17 20:32:11 2011 +0200| [3a6c8349d8f165036d98aa915f9d07935cb88be6] | committer: Francois Cartegnie

Qt: Force custom toolbars not to follow RTL auto layout changes.

Some widgets can't handle RTL (timebar, ...) and
custom toolbars need special logic when reversed (next/prev...)

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

 modules/gui/qt4/components/controller.cpp |    5 ++++-
 modules/gui/qt4/dialogs/toolbar.cpp       |    1 +
 modules/gui/qt4/qt4.hpp                   |    3 +++
 3 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/modules/gui/qt4/components/controller.cpp b/modules/gui/qt4/components/controller.cpp
index fb956e2..c83af0f 100644
--- a/modules/gui/qt4/components/controller.cpp
+++ b/modules/gui/qt4/components/controller.cpp
@@ -623,12 +623,12 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
                                 QWidget *_parent ) :
                                 AbstractController( _p_i, _parent )
 {
+    RTL_UNAFFECTED_WIDGET
     /* advanced Controls handling */
     b_advancedVisible = b_advControls;
 #ifdef DEBUG_LAYOUT
     setStyleSheet( "background: red ");
 #endif
-
     setAttribute( Qt::WA_MacBrushedMetal);
     QVBoxLayout *controlLayout = new QVBoxLayout( this );
     controlLayout->setContentsMargins( 4, 1, 0, 0 );
@@ -675,6 +675,7 @@ void ControlsWidget::toggleAdvanced()
 AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i, QWidget *_parent ) :
                                      AbstractController( _p_i, _parent )
 {
+    RTL_UNAFFECTED_WIDGET
     controlLayout = new QHBoxLayout( this );
     controlLayout->setMargin( 0 );
     controlLayout->setSpacing( 0 );
@@ -691,6 +692,7 @@ AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i, QWidget *_parent ) :
 InputControlsWidget::InputControlsWidget( intf_thread_t *_p_i, QWidget *_parent ) :
                                      AbstractController( _p_i, _parent )
 {
+    RTL_UNAFFECTED_WIDGET
     controlLayout = new QHBoxLayout( this );
     controlLayout->setMargin( 0 );
     controlLayout->setSpacing( 0 );
@@ -707,6 +709,7 @@ InputControlsWidget::InputControlsWidget( intf_thread_t *_p_i, QWidget *_parent
 FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i, QWidget *_parent )
                            : AbstractController( _p_i, _parent )
 {
+    RTL_UNAFFECTED_WIDGET
     i_mouse_last_x      = -1;
     i_mouse_last_y      = -1;
     b_mouse_over        = false;
diff --git a/modules/gui/qt4/dialogs/toolbar.cpp b/modules/gui/qt4/dialogs/toolbar.cpp
index f1c8302..483f4e1 100644
--- a/modules/gui/qt4/dialogs/toolbar.cpp
+++ b/modules/gui/qt4/dialogs/toolbar.cpp
@@ -490,6 +490,7 @@ DroppingController::DroppingController( intf_thread_t *_p_intf,
                                         QWidget *_parent )
                    : AbstractController( _p_intf, _parent )
 {
+    RTL_UNAFFECTED_WIDGET
     rubberband = NULL;
     b_draging = false;
     setAcceptDrops( true );
diff --git a/modules/gui/qt4/qt4.hpp b/modules/gui/qt4/qt4.hpp
index d525f96..8ea99e0 100644
--- a/modules/gui/qt4/qt4.hpp
+++ b/modules/gui/qt4/qt4.hpp
@@ -117,6 +117,9 @@ struct intf_sys_t
 #define TOGGLEV( x ) { if( x->isVisible() ) x->hide();          \
             else  x->show(); }
 
+/* for widgets which must not follow the RTL auto layout changes */
+#define RTL_UNAFFECTED_WIDGET setLayoutDirection( Qt::LeftToRight );
+
 #define getSettings() p_intf->p_sys->mainSettings
 
 #define QT_VOLUME_DEFAULT AOUT_VOLUME_DEFAULT



More information about the vlc-commits mailing list