[vlc-commits] commit: Qt: subclass QStackedWidget for custom minimumSizeHint() ( Jakob Leben )
git at videolan.org
git at videolan.org
Sun Mar 28 19:40:40 CEST 2010
vlc | branch: master | Jakob Leben <jleben at videolan.org> | Sun Mar 28 19:18:43 2010 +0200| [e472ee3c154b8e4ce0f22bf7e71c3b9d98660975] | committer: Jakob Leben
Qt: subclass QStackedWidget for custom minimumSizeHint()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e472ee3c154b8e4ce0f22bf7e71c3b9d98660975
---
modules/gui/qt4/main_interface.cpp | 8 ++------
modules/gui/qt4/util/customwidgets.hpp | 11 +++++++++++
2 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index 5b1fa63..ba45a68 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -34,7 +34,7 @@
#include "actions_manager.hpp" // killInstance
#include "extensions_manager.hpp" // killInstance
-#include "util/customwidgets.hpp" // qtEventToVLCKey
+#include "util/customwidgets.hpp" // qtEventToVLCKey, QVLCStackedWidget
#include "util/qt_dirs.hpp" // toNativeSeparators
#include "components/interface_widgets.hpp" // bgWidget, videoWidget
@@ -361,7 +361,7 @@ void MainInterface::createMainWidget( QSettings *settings )
mainLayout->setSpacing( 0 ); mainLayout->setMargin( 0 );
/* */
- stackCentralW = new QStackedWidget( main );
+ stackCentralW = new QVLCStackedWidget( main );
/* Bg Cone */
bgWidget = new BackgroundWidget( p_intf );
@@ -690,15 +690,11 @@ void MainInterface::togglePlaylist()
/* Playlist is not visible, show it */
if( stackCentralW->currentWidget() != playlistWidget )
{
- playlistWidget->forceShow();
showTab( playlistWidget );
}
else /* Hide it! */
{
restoreStackOldWidget();
- stackCentralW->updateGeometry();
- // HACK: So it doesn't limit the stackWidget minimumSize
- playlistWidget->forceHide();
}
playlistVisible = ( stackCentralW->currentWidget() == playlistWidget );
}
diff --git a/modules/gui/qt4/util/customwidgets.hpp b/modules/gui/qt4/util/customwidgets.hpp
index 266d954..c903ba7 100644
--- a/modules/gui/qt4/util/customwidgets.hpp
+++ b/modules/gui/qt4/util/customwidgets.hpp
@@ -30,6 +30,7 @@
#include <QLineEdit>
#include <QPushButton>
#include <QLabel>
+#include <QStackedWidget>
/**
This class provides a QLineEdit which contains a greyed-out hinting
@@ -103,6 +104,16 @@ private:
Qt::TextElideMode elideMode;
};
+class QVLCStackedWidget : public QStackedWidget
+{
+public:
+ QVLCStackedWidget( QWidget *parent ) : QStackedWidget( parent ) { }
+ QSize minimumSizeHint () const
+ {
+ return currentWidget() ? currentWidget()->minimumSizeHint() : QSize();
+ }
+};
+
/* VLC Key/Wheel hotkeys interactions */
class QKeyEvent;
More information about the vlc-commits
mailing list