From: Peter Penz Date: Wed, 2 Feb 2011 16:30:25 +0000 (+0100) Subject: Provide a default size-hint for all panels X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/28f00f36d74572510aee58111f1a9f884e148f6b Provide a default size-hint for all panels This fixes the issue that the initial size of the Filter Panel is too small. --- diff --git a/src/panels/folders/folderspanel.cpp b/src/panels/folders/folderspanel.cpp index 5cfce59e2..43d7b6412 100644 --- a/src/panels/folders/folderspanel.cpp +++ b/src/panels/folders/folderspanel.cpp @@ -70,11 +70,6 @@ FoldersPanel::~FoldersPanel() m_dirLister = 0; // deleted by m_dolphinModel } -QSize FoldersPanel::sizeHint() const -{ - return QSize(200, 400); -} - void FoldersPanel::setShowHiddenFiles(bool show) { FoldersPanelSettings::setShowHiddenFiles(show); diff --git a/src/panels/folders/folderspanel.h b/src/panels/folders/folderspanel.h index 2aa94d1ff..43ae7bdd9 100644 --- a/src/panels/folders/folderspanel.h +++ b/src/panels/folders/folderspanel.h @@ -45,9 +45,6 @@ public: FoldersPanel(QWidget* parent = 0); virtual ~FoldersPanel(); - /** @see QWidget::sizeHint() */ - virtual QSize sizeHint() const; - void setShowHiddenFiles(bool show); bool showHiddenFiles() const; diff --git a/src/panels/information/informationpanel.cpp b/src/panels/information/informationpanel.cpp index 6681dc30d..7759d591a 100644 --- a/src/panels/information/informationpanel.cpp +++ b/src/panels/information/informationpanel.cpp @@ -46,13 +46,6 @@ InformationPanel::~InformationPanel() { } -QSize InformationPanel::sizeHint() const -{ - QSize size = Panel::sizeHint(); - size.setWidth(minimumSizeHint().width()); - return size; -} - void InformationPanel::setSelection(const KFileItemList& selection) { if (!isVisible()) { diff --git a/src/panels/information/informationpanel.h b/src/panels/information/informationpanel.h index 58265f4b5..17f8003ac 100644 --- a/src/panels/information/informationpanel.h +++ b/src/panels/information/informationpanel.h @@ -35,9 +35,6 @@ public: explicit InformationPanel(QWidget* parent = 0); virtual ~InformationPanel(); - /** @see QWidget::sizeHint() */ - virtual QSize sizeHint() const; - signals: void urlActivated(const KUrl& url); diff --git a/src/panels/panel.cpp b/src/panels/panel.cpp index e90970c6e..f26086159 100644 --- a/src/panels/panel.cpp +++ b/src/panels/panel.cpp @@ -47,6 +47,16 @@ QList Panel::customContextMenuActions() const return m_customContextMenuActions; } +QSize Panel::sizeHint() const +{ + // The size hint will be requested already when starting Dolphin even + // if the panel is invisible. For performance reasons most panels delay + // the creation and initialization of widgets until a showEvent() is called. + // Because of this the size-hint of the embedded widgets cannot be used + // and a default size is provided: + return QSize(180, 180); +} + void Panel::setUrl(const KUrl& url) { if (url.equals(m_url, KUrl::CompareWithoutTrailingSlash)) { diff --git a/src/panels/panel.h b/src/panels/panel.h index 83ed3da3b..2e8d46e40 100644 --- a/src/panels/panel.h +++ b/src/panels/panel.h @@ -50,6 +50,9 @@ public: void setCustomContextMenuActions(const QList& actions); QList customContextMenuActions() const; + /** @see QWidget::sizeHint() */ + virtual QSize sizeHint() const; + public slots: /** * This is invoked every time the folder being displayed in the diff --git a/src/panels/terminal/terminalpanel.cpp b/src/panels/terminal/terminalpanel.cpp index fc176837d..3c9c5bd75 100644 --- a/src/panels/terminal/terminalpanel.cpp +++ b/src/panels/terminal/terminalpanel.cpp @@ -46,13 +46,6 @@ TerminalPanel::~TerminalPanel() { } -QSize TerminalPanel::sizeHint() const -{ - QSize size = Panel::sizeHint(); - size.setHeight(200); - return size; -} - void TerminalPanel::terminalExited() { emit hideTerminalPanel(); diff --git a/src/panels/terminal/terminalpanel.h b/src/panels/terminal/terminalpanel.h index b9508279e..831c97f32 100644 --- a/src/panels/terminal/terminalpanel.h +++ b/src/panels/terminal/terminalpanel.h @@ -42,9 +42,6 @@ public: TerminalPanel(QWidget* parent = 0); virtual ~TerminalPanel(); - /** @see QWidget::sizeHint() */ - virtual QSize sizeHint() const; - public slots: void terminalExited();