summaryrefslogtreecommitdiffstats
path: root/src/gui/dialogs
diff options
context:
space:
mode:
authorAlexis Menard <alexis.menard@nokia.com>2009-05-26 14:50:48 (GMT)
committerAlexis Menard <alexis.menard@nokia.com>2009-05-26 14:52:27 (GMT)
commit8bf5a6986db852525582713cc2f2a760df4fdc60 (patch)
treeffb7877cf44aa29d122929a9e578467aceb30812 /src/gui/dialogs
parent36159004508d145646e0755debf5564ce29a8649 (diff)
downloadQt-8bf5a6986db852525582713cc2f2a760df4fdc60.zip
Qt-8bf5a6986db852525582713cc2f2a760df4fdc60.tar.gz
Qt-8bf5a6986db852525582713cc2f2a760df4fdc60.tar.bz2
QFileDialog selection bug when calling it multiple times.
The problem was that we don't clear the selection model if the previous selection was valid. Task-number:251341 Reviewed-by:jasplin
Diffstat (limited to 'src/gui/dialogs')
-rw-r--r--src/gui/dialogs/qfiledialog.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index eeb2743..d42775a 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -776,6 +776,7 @@ void QFileDialog::selectFile(const QString &filename)
}
QModelIndex index = d->model->index(filename);
+ QString file;
if (!index.isValid()) {
// save as dialog where we want to input a default value
QString text = filename;
@@ -790,13 +791,13 @@ void QFileDialog::selectFile(const QString &filename)
)
text = text.remove(0,1);
}
- if (!isVisible() || !d->lineEdit()->hasFocus())
- d->lineEdit()->setText(text);
+ file = text;
} else {
- d->qFileDialogUi->listView->selectionModel()->clear();
- if (!isVisible() || !d->lineEdit()->hasFocus())
- d->lineEdit()->setText(index.data().toString());
+ file = index.data().toString();
}
+ d->qFileDialogUi->listView->selectionModel()->clear();
+ if (!isVisible() || !d->lineEdit()->hasFocus())
+ d->lineEdit()->setText(file);
}
/**