From 14dada252f590246ce400e203aed443d33c7462e Mon Sep 17 00:00:00 2001 From: Jaroslaw Staniek Date: Wed, 21 Mar 2018 12:47:46 +0100 Subject: Fix build with Qt 5.6 Summary: QOverload<>::of() is new in Qt 5.7, so "emulate" it with static_cast<>() when building against lower Qt versions. Test Plan: Kexi 3.1.0 builds fine now on openSUSE Leap 42.3 with Qt 5.6.2. Before I got these compiler errors: ``` /home/abuild/rpmbuild/BUILD/kexi-3.1.0/src/widget/KexiFileRequester.cpp: In member function 'void KexiFileRequester::init()': /home/abuild/rpmbuild/BUILD/kexi-3.1.0/src/widget/KexiFileRequester.cpp:479:30: error: 'QOverload' was not declared in this scope connect(d->locationEdit, QOverload<>::of(&KUrlComboBox::returnPressed), ^ /home/abuild/rpmbuild/BUILD/kexi-3.1.0/src/widget/KexiFileRequester.cpp:479:40: error: expected primary-expression before '>' token connect(d->locationEdit, QOverload<>::of(&KUrlComboBox::returnPressed), ^ /home/abuild/rpmbuild/BUILD/kexi-3.1.0/src/widget/KexiFileRequester.cpp:479:41: error: '::of' has not been declared connect(d->locationEdit, QOverload<>::of(&KUrlComboBox::returnPressed), ^ ``` Still builds fine with Qt 5.9.4 and 5.10.0 too... Reviewers: staniek, piggz Reviewed By: staniek Subscribers: #kexi Tags: #kexi Differential Revision: https://phabricator.kde.org/D11544 --- src/widget/KexiFileRequester.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/widget/KexiFileRequester.cpp b/src/widget/KexiFileRequester.cpp index be45db5..3fd4b7e 100644 --- a/src/widget/KexiFileRequester.cpp +++ b/src/widget/KexiFileRequester.cpp @@ -476,8 +476,13 @@ void KexiFileRequester::init() d->locationEdit->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength); connect(d->locationEdit, &KUrlComboBox::editTextChanged, d, &KexiFileRequester::Private::locationEditTextChanged); +#if QT_VERSION >= QT_VERSION_CHECK(5, 7, 0) connect(d->locationEdit, QOverload<>::of(&KUrlComboBox::returnPressed), d, &Private::locationEditReturnPressed); +#else + connect(d->locationEdit, static_cast(&KUrlComboBox::returnPressed), + d, &Private::locationEditReturnPressed); +#endif d->urlCompletion = new KexiUrlCompletion(&d->filterRegExps, &d->filterMimeTypes); d->locationEdit->setCompletionObject(d->urlCompletion); d->locationEdit->setAutoDeleteCompletionObject(true); -- cgit v0.11.2