diff --git a/src/gui/DatabaseWidget.cpp b/src/gui/DatabaseWidget.cpp index aa04f6123..b56f019d4 100644 --- a/src/gui/DatabaseWidget.cpp +++ b/src/gui/DatabaseWidget.cpp @@ -151,6 +151,32 @@ void DatabaseWidget::deleteGroup() } } +int DatabaseWidget::addWidget(QWidget* w) +{ + w->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); + + int index = QStackedWidget::addWidget(w); + + adjustSize(); + + return index; +} + +void DatabaseWidget::setCurrentIndex(int index) +{ + if (currentWidget()) { + currentWidget()->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); + } + + QStackedWidget::setCurrentIndex(index); + + if (currentWidget()) { + currentWidget()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); + } + + adjustSize(); +} + void DatabaseWidget::switchToView(bool accepted) { if (m_newGroup) { diff --git a/src/gui/DatabaseWidget.h b/src/gui/DatabaseWidget.h index 1eb8706c8..a9f19fc85 100644 --- a/src/gui/DatabaseWidget.h +++ b/src/gui/DatabaseWidget.h @@ -42,6 +42,8 @@ public: void deleteEntry(); void deleteGroup(); bool canDeleteCurrentGoup(); + int addWidget(QWidget* w); + void setCurrentIndex(int index); Q_SIGNALS: void closeRequest();