Commit e472ee3c authored by Jakob Leben's avatar Jakob Leben

Qt: subclass QStackedWidget for custom minimumSizeHint()

parent 9078322b
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include "actions_manager.hpp" // killInstance #include "actions_manager.hpp" // killInstance
#include "extensions_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 "util/qt_dirs.hpp" // toNativeSeparators
#include "components/interface_widgets.hpp" // bgWidget, videoWidget #include "components/interface_widgets.hpp" // bgWidget, videoWidget
...@@ -361,7 +361,7 @@ void MainInterface::createMainWidget( QSettings *settings ) ...@@ -361,7 +361,7 @@ void MainInterface::createMainWidget( QSettings *settings )
mainLayout->setSpacing( 0 ); mainLayout->setMargin( 0 ); mainLayout->setSpacing( 0 ); mainLayout->setMargin( 0 );
/* */ /* */
stackCentralW = new QStackedWidget( main ); stackCentralW = new QVLCStackedWidget( main );
/* Bg Cone */ /* Bg Cone */
bgWidget = new BackgroundWidget( p_intf ); bgWidget = new BackgroundWidget( p_intf );
...@@ -690,15 +690,11 @@ void MainInterface::togglePlaylist() ...@@ -690,15 +690,11 @@ void MainInterface::togglePlaylist()
/* Playlist is not visible, show it */ /* Playlist is not visible, show it */
if( stackCentralW->currentWidget() != playlistWidget ) if( stackCentralW->currentWidget() != playlistWidget )
{ {
playlistWidget->forceShow();
showTab( playlistWidget ); showTab( playlistWidget );
} }
else /* Hide it! */ else /* Hide it! */
{ {
restoreStackOldWidget(); restoreStackOldWidget();
stackCentralW->updateGeometry();
// HACK: So it doesn't limit the stackWidget minimumSize
playlistWidget->forceHide();
} }
playlistVisible = ( stackCentralW->currentWidget() == playlistWidget ); playlistVisible = ( stackCentralW->currentWidget() == playlistWidget );
} }
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#include <QLineEdit> #include <QLineEdit>
#include <QPushButton> #include <QPushButton>
#include <QLabel> #include <QLabel>
#include <QStackedWidget>
/** /**
This class provides a QLineEdit which contains a greyed-out hinting This class provides a QLineEdit which contains a greyed-out hinting
...@@ -103,6 +104,16 @@ private: ...@@ -103,6 +104,16 @@ private:
Qt::TextElideMode elideMode; 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 */ /* VLC Key/Wheel hotkeys interactions */
class QKeyEvent; class QKeyEvent;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment