Review Request 115478: Add QFileDialog unit autotest for filters (which reveals a QPA bug)
Alex Merry
kde at randomguy3.me.uk
Tue Feb 4 17:17:42 UTC 2014
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/115478/#review48954
-----------------------------------------------------------
Has the Qt patch been submitted upstream?
- Alex Merry
On Feb. 4, 2014, 5:07 p.m., Dominik Haumann wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://git.reviewboard.kde.org/r/115478/
> -----------------------------------------------------------
>
> (Updated Feb. 4, 2014, 5:07 p.m.)
>
>
> Review request for KDE Frameworks, Àlex Fiestas and Gregor Mi.
>
>
> Repository: frameworkintegration
>
>
> Description
> -------
>
> The following QPA integration does not work as expected:
>
> QStringList nameFilterList = QStringList() << "c (*.cpp)" << "h (*.h)";
> dialog.setNameFilters(nameFilterList);
>
> QString selectNameFilter("h (*.h)");
> dialog.selectNameFilter(selectNameFilter);
> // QCOMPARE(dialog.selectedNameFilter(), selectNameFilter); // (1) always fails, no matter what
>
> dialog.show();
> QCOMPARE(dialog.selectedNameFilter(), selectNameFilter); // (2) currently also fails, Qt patch required
>
> The problem is described in detail in:
> http://mail.kde.org/pipermail/kde-frameworks-devel/2014-February/010691.html
>
>
> The Qt patches that make (2) work are as follows:
>
> diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp
> index da026d2..72b2310 100644
> --- a/src/widgets/dialogs/qfiledialog.cpp
> +++ b/src/widgets/dialogs/qfiledialog.cpp
> @@ -627,7 +627,8 @@ void QFileDialogPrivate::helperPrepareShow(QPlatformDialogHelper *)
> options->setInitialDirectory(directory.exists() ?
> QUrl::fromLocalFile(directory.absolutePath()) :
> QUrl());
> - options->setInitiallySelectedNameFilter(q->selectedNameFilter());
> + if (options->initiallySelectedNameFilter().isEmpty())
> + options->setInitiallySelectedNameFilter(q->selectedNameFilter());
> if (options->initiallySelectedFiles().isEmpty())
> options->setInitiallySelectedFiles(userSelectedFiles());
> }
> @@ -1447,6 +1448,7 @@ void QFileDialog::selectNameFilter(const QString &filter)
> {
> Q_D(QFileDialog);
> if (!d->usingWidgets()) {
> + d->options->setInitiallySelectedNameFilter(filter);
> d->selectNameFilter_sys(filter);
> return;
> }
>
> However, the QCOMPARE in (1) is still an open issue. And no fix in sight...
>
> Ok to commit this to frameworksintegration (and therewith make it unstable?)
>
>
> Diffs
> -----
>
> autotests/kfiledialog_unittest.cpp PRE-CREATION
> autotests/CMakeLists.txt fb58b3a
>
> Diff: https://git.reviewboard.kde.org/r/115478/diff/
>
>
> Testing
> -------
>
> The attached unit test currently fails due to a bug in the Qt QPA.
>
> With the Qt patch above, (2) in the unit test passes, so one is able to call QFileDialog::selectNameFilter().
> However, (1) remains broken.
>
>
> Thanks,
>
> Dominik Haumann
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20140204/f8b127ac/attachment-0001.html>
More information about the Kde-frameworks-devel
mailing list