Open Vekhir opened 2 months ago
For 2, 3, and 5, the solutions in the respective PRs are good. For 4 and 6, I'd like a second opinion whether my approach is good practice. I don't know enough about the dependency update necessary for 1 to make a PR for that.
For 4 and 6, I'd like a second opinion whether my approach is good practice.
In both cases I would support your proposals.
For topic 4, using |
instead of +
for combining a modifier with a key is not actively promoted and not really documented for Qt 5.15. However the defined and documented values for keys and modifiers make sure that there is no difference in the result. So I do not see a reason why we should not use |
for all Qt versions.
For topic 6: With Qt 6.3 the addAction
functions have been pulled up from the QMenu
to QWidget
, where some simple overloads already existed. At the same time the signature was modified to be more logical (define the key sequence first and then the receiver). I have no doubt that the function is identical, as the documentation for both are also nearly identical, see Qt5.15 QMenu::addAction()
and Qt 6.5 QWidget::addAction()
. However we need the #if
as there is no common signature for all versions.
Thanks. I've made PRs to that effect in #1051 and #1049
Describe the problem The PR #1001 removed many warnings that were cluttering the build logs while improving compatibility and potentially preempting future refactorings. However, not all warnings were removed because they are trickier and might involve larger code changes. This issue shall provide a platform to collect and categorise these warnings and work towards a solution for them. At the time of writing, 6 warnings remain.
Versions Current dev (e9abc43)
Build commands I'm using the
cmake
community build for Arch Linux, thoughqmake
should be similarly affected. Full instructions: PKGBUILDWarnings
1. SingleApplication: QCryptographicHash::addData is deprecated
``` /build/openboard-git/src/OpenBoard/src/singleapplication/singleapplication_p.cpp: In member function ‘void SingleApplicationPrivate::genBlockServerName()’: /build/openboard-git/src/OpenBoard/src/singleapplication/singleapplication_p.cpp:134:20: warning: ‘void QCryptographicHash::addData(const char*, qsizetype)’ is deprecated: Use the QByteArrayView overload instead [-Wdeprecated-declarations] 134 | appData.addData( "SingleApplication", 17 ); | ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/qt6/QtCore/QCryptographicHash:1, from /build/openboard-git/src/OpenBoard/src/singleapplication/singleapplication_p.cpp:40: /usr/include/qt6/QtCore/qcryptographichash.h:79:10: note: declared here 79 | void addData(const char *data, qsizetype length); | ^~~~~~~ ```2. UBPreferencesController.cpp: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20
``` /build/openboard-git/src/OpenBoard/src/core/UBPreferencesController.cpp: In lambda function: /build/openboard-git/src/OpenBoard/src/core/UBPreferencesController.cpp:189:150: warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated] 189 | connect(mPreferencesUI->keyboardPaletteKeyButtonSize, qOverload3. UBPersistenceManager.cpp: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20
``` /build/openboard-git/src/OpenBoard/src/core/UBPersistenceManager.cpp: In lambda function: /build/openboard-git/src/OpenBoard/src/core/UBPersistenceManager.cpp:192:105: warning: implicit capture of ‘this’ via ‘[=]’ is deprecated in C++20 [-Wdeprecated] 192 | std::function4. UBMainWindow.cpp: constexpr QKeyCombination operator+ is deprecated
``` /build/openboard-git/src/OpenBoard/src/gui/UBMainWindow.cpp: In constructor ‘UBMainWindow::UBMainWindow(QWidget*, Qt::WindowFlags)’: /build/openboard-git/src/OpenBoard/src/gui/UBMainWindow.cpp:77:56: warning: ‘constexpr QKeyCombination operator+(Qt::Modifier, Qt::Key)’ is deprecated: Use operator| instead [-Wdeprecated-declarations] 77 | actionQuit->setShortcut(QKeySequence(Qt::ALT + Qt::Key_F4)); | ^~~~~~ In file included from /usr/include/qt6/QtCore/qobjectdefs.h:12, from /usr/include/qt6/QtCore/qobject.h:10, from /usr/include/qt6/QtCore/qabstractanimation.h:7, from /usr/include/qt6/QtCore/QtCore:15, from /usr/include/qt6/QtGui/QtGuiDepends:3, from /usr/include/qt6/QtGui/QtGui:3, from /build/openboard-git/src/OpenBoard/src/gui/UBMainWindow.cpp:30: /usr/include/qt6/QtCore/qnamespace.h:1965:27: note: declared here 1965 | constexpr QKeyCombination operator+(Qt::Modifier modifier, Qt::Key key) noexcept | ^~~~~~~~ ```5. UBNetworkAccessManager.cpp: ‘++’ expression of ‘volatile’-qualified type is deprecated
``` /build/openboard-git/src/OpenBoard/src/network/UBNetworkAccessManager.cpp: In member function ‘void UBNetworkAccessManager::proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)’: /build/openboard-git/src/OpenBoard/src/network/UBNetworkAccessManager.cpp:136:5: warning: ‘++’ expression of ‘volatile’-qualified type is deprecated [-Wvolatile] 136 | mProxyAuthenticationCount++; | ^~~~~~~~~~~~~~~~~~~~~~~~~ ```6. web/simplebrowser/tabwidget.cpp: addAction overload is deprecated
``` /build/openboard-git/src/OpenBoard/src/web/simplebrowser/tabwidget.cpp: In member function ‘void TabWidget::handleContextMenuRequested(const QPoint&)’: /build/openboard-git/src/OpenBoard/src/web/simplebrowser/tabwidget.cpp:123:19: warning: ‘typename std::enable_if<((! std::is_sameProgress
this
(andsettings
). #1050createDocumentProxyStructure
which is static, making the lambda overkill. #1047|
was introduced in Qt 6.0.0 [5][6]. Qt5 sort of works with the | operator due to its arithmetic representation of keys which is also used for +. #1051std::atomic_int
instead? #1048Warning 1 needs a dependency update. For the other warnings, there is a PR for further discussion.
@letsfindaway What do you think of warnings 4 and 6 in particular? Are there better solutions?
-- Vekhir