forked from qt-creator/qt-creator
SettingsDialog: Update size of category view on showing/hiding scrollbar
On a german locale the category view has a horizontal scrollbar. This is because the initial sizeHint is calculated while the vertical scrollbar is not visible. This patch ensures that the sizeHint is updated if the scrollbar is shown. Change-Id: Ic97c0c3650f765dbf6d8f84f2c168630c65ee89f Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -248,6 +248,7 @@ public:
|
|||||||
{
|
{
|
||||||
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
|
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
|
||||||
setItemDelegate(new CategoryListViewDelegate(this));
|
setItemDelegate(new CategoryListViewDelegate(this));
|
||||||
|
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual QSize sizeHint() const
|
virtual QSize sizeHint() const
|
||||||
@@ -257,6 +258,16 @@ public:
|
|||||||
width += verticalScrollBar()->width();
|
width += verticalScrollBar()->width();
|
||||||
return QSize(width, 100);
|
return QSize(width, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// QListView installs a event filter on its scrollbars
|
||||||
|
virtual bool eventFilter(QObject *obj, QEvent *event)
|
||||||
|
{
|
||||||
|
if (obj == verticalScrollBar()
|
||||||
|
&& (event->type() == QEvent::Show
|
||||||
|
|| event->type() == QEvent::Hide))
|
||||||
|
updateGeometry();
|
||||||
|
return QListView::eventFilter(obj, event);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// ----------- SettingsDialog
|
// ----------- SettingsDialog
|
||||||
|
|||||||
Reference in New Issue
Block a user