Commit e472ee3c authored by Jakob Leben's avatar Jakob Leben

Qt: subclass QStackedWidget for custom minimumSizeHint()

parent 9078322b
......@@ -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 );
}
......
......@@ -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;
......
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