QFileDialog: restore state from QSettings after creating widgets
After 37ca2224ec
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>
This commit is contained in:
parent
9babaac16d
commit
37b8bb5473
@ -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()));
|
||||
|
Loading…
Reference in New Issue
Block a user