summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2014-02-19 15:42:36 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-20 08:24:34 +0100
commit37b8bb54733ec61559b74ba0bf8127d9218ae9ca (patch)
tree494971aa4ed1cdfb7ace3618dc10317654175fb9 /src/widgets
parent9babaac16da14657ccf8629419328bf05c866eed (diff)
QFileDialog: restore state from QSettings after creating widgets
After 37ca2224eca671200a2710f57f970d2993e62aa5 it's necessary to read the saved QSettings again after creating widgets, in order to deal with the settings which only affect widgets (such as saved bookmarks). It's also necessary to read them if widgets are not used though, because some of the settings affect native dialog options. Task-number: QTBUG-36888 Change-Id: I8cf53db864b173c50a876a1d5ce29c1e073fcaa6 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qfiledialog.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
index 1c580ce143..3e4490e890 100644
--- a/src/widgets/dialogs/qfiledialog.cpp
+++ b/src/widgets/dialogs/qfiledialog.cpp
@@ -2739,9 +2739,8 @@ void QFileDialogPrivate::init(const QString &directory, const QString &nameFilte
q->selectFile(initialSelection(directory));
#ifndef QT_NO_SETTINGS
- QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
- settings.beginGroup(QLatin1String("Qt"));
- q->restoreState(settings.value(QLatin1String("filedialog")).toByteArray());
+ const QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
+ q->restoreState(settings.value(QLatin1String("Qt/filedialog")).toByteArray());
#endif
#if defined(Q_EMBEDDED_SMALLSCREEN)
@@ -2888,6 +2887,11 @@ void QFileDialogPrivate::createWidgets()
createToolButtons();
createMenuActions();
+#ifndef QT_NO_SETTINGS
+ const QSettings settings(QSettings::UserScope, QLatin1String("QtProject"));
+ q->restoreState(settings.value(QLatin1String("Qt/filedialog")).toByteArray());
+#endif
+
// Initial widget states from options
q->setFileMode(static_cast<QFileDialog::FileMode>(options->fileMode()));
q->setAcceptMode(static_cast<QFileDialog::AcceptMode>(options->acceptMode()));