Skip to content

[Building/Packaging] Remaining warnings by Qt6 and C++20 #1046

@Vekhir

Description

@Vekhir

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, though qmake should be similarly affected. Full instructions: PKGBUILD

Warnings

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, qOverload<int>(&QComboBox::currentIndexChanged), settings->boardKeyboardPaletteKeyBtnSize, [=](int index) {
      |                                                                                                                                                      ^
/build/openboard-git/src/OpenBoard/src/core/UBPreferencesController.cpp:189:150: note: add explicit ‘this’ or ‘*this’ capture
3. 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::function<std::shared_ptr<UBDocumentProxy> (QFileInfo contentInfo)> createDocumentProxyLambda = [=](QFileInfo contentInfo) {
      |                                                                                                         ^
/build/openboard-git/src/OpenBoard/src/core/UBPersistenceManager.cpp:192:105: note: add explicit ‘this’ or ‘*this’ capture
4. 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_same<const char*, Func1>::value) && QtPrivate::IsPointerToTypeDerivedFromQObject<T*>::Value), QAction*>::type QMenu::addAction(const QString&, const Obj*, Func1, const QKeySequence&) [with Obj = TabWidget; Func1 = WebView* (TabWidget::*)(); typename std::enable_if<((! std::is_same<const char*, Func1>::value) && QtPrivate::IsPointerToTypeDerivedFromQObject<T*>::Value), QAction*>::type = QAction*]’ is deprecated: Use addAction(text, shortcut, object, slot) instead. [-Wdeprecated-declarations]
  123 |     menu.addAction(tr("New &Tab"), this, &TabWidget::createTab, QKeySequence::AddTab);
      |     ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/qt6/QtWidgets/QMenu:1,
                 from /build/openboard-git/src/OpenBoard/src/web/simplebrowser/tabwidget.cpp:55:
/usr/include/qt6/QtWidgets/qmenu.h:78:9: note: declared here
   78 |         addAction(const QString &text, const Obj *object, Func1 slot,
      |         ^~~~~~~~~

Progress

Warning 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions