QFileDialog: prevent section collapsing in the main selection area

In the non-native QFileDialog, a QSplitter separates the two central
views (the list view of "places" and the tree view for navigating
the file system).

Unfortunately, that splitter allows sections to be collapsed,
resulting in a weird status where the user doesn't
understand what has just happened and thinks that (s)he may have
broken something. Worse, that gets actually saved into the
application settings, so the splitter may stay collapsed forever.

Instead, let's simply prevent sections from being collapsible.

Task-number: QTBUG-19467
Change-Id: I11ff7c55a5535680a3edce5f4e70c9338291b94f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Giuseppe D'Angelo 2014-11-03 15:14:46 +01:00
parent 305f755d4b
commit d8b45a360f
3 changed files with 7 additions and 1 deletions

View File

@ -510,7 +510,7 @@ bool QFileDialog::restoreState(const QByteArray &state)
if (!d->qFileDialogUi->splitter->restoreState(d->splitterState))
return false;
QList<int> list = d->qFileDialogUi->splitter->sizes();
if (list.count() >= 2 && list.at(0) == 0 && list.at(1) == 0) {
if (list.count() >= 2 && (list.at(0) == 0 || list.at(1) == 0)) {
for (int i = 0; i < list.count(); ++i)
list[i] = d->qFileDialogUi->splitter->widget(i)->sizeHint().width();
d->qFileDialogUi->splitter->setSizes(list);

View File

@ -179,6 +179,9 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="childrenCollapsible">
<bool>false</bool>
</property>
<widget class="QSidebar" name="sidebar">
<property name="accessibleName">
<string>Sidebar</string>

View File

@ -121,6 +121,9 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="childrenCollapsible">
<bool>false</bool>
</property>
<widget class="QSidebar" name="sidebar"/>
<widget class="QFrame" name="frame">
<property name="frameShape">