Make DatabaseWidget ignore the size hint of non-active widgets.

This commit is contained in:
Felix Geyer 2012-04-24 10:51:22 +02:00
parent e026f3d1eb
commit 3aac16f03e
2 changed files with 28 additions and 0 deletions

View File

@ -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) void DatabaseWidget::switchToView(bool accepted)
{ {
if (m_newGroup) { if (m_newGroup) {

View File

@ -42,6 +42,8 @@ public:
void deleteEntry(); void deleteEntry();
void deleteGroup(); void deleteGroup();
bool canDeleteCurrentGoup(); bool canDeleteCurrentGoup();
int addWidget(QWidget* w);
void setCurrentIndex(int index);
Q_SIGNALS: Q_SIGNALS:
void closeRequest(); void closeRequest();