Skip to content

Fix discard and deprecation warnings - #869

Open
kriben wants to merge 2 commits into
githubuser0xFFFF:masterfrom
kriben:fix-discard-and-deprecation-warnings
Open

Fix discard and deprecation warnings#869
kriben wants to merge 2 commits into
githubuser0xFFFF:masterfrom
kriben:fix-discard-and-deprecation-warnings

Conversation

@kriben

@kriben kriben commented Sep 4, 2026

Copy link
Copy Markdown

Fix compiler warnings with GCC 15 / Qt 6.10

Building the library and demo with GCC 15.2 and Qt 6.10.2 produces a few warnings. This PR fixes them in two small commits.

Check return value of QFile::open when loading stylesheets
QFile::open is marked nodiscard in Qt 6, so ignoring its result triggers -Wunused-result. The stylesheet loading in
CDockManager, the demo's main.cpp and CMainWindow::applyVsStyle now only read the file when it was opened successfully. Behaviour
is unchanged: a missing file still results in an empty stylesheet.

Replace deprecated QApplication::setActiveWindow with QWidget::activateWindow
QApplication::setActiveWindow is deprecated since Qt 6.5 and triggers -Wdeprecated-declarations. QWidget::activateWindow is the
recommended replacement and is available in both Qt 5 and Qt 6, so no version guard is needed.

After these changes the library, all examples and the demo build without warnings, also with -Wall -Wextra.

Fixes -Wunused-result warnings with GCC 15, since QFile::open is
marked nodiscard in Qt 6. Stylesheets in the dock manager and the demo
are now only read when the file was opened successfully; a missing file
still results in an empty stylesheet as before.
…teWindow

QApplication::setActiveWindow is deprecated since Qt 6.5 and produces a
-Wdeprecated-declarations warning. QWidget::activateWindow is available
in both Qt 5 and Qt 6 and is the recommended replacement.
@kriben
kriben force-pushed the fix-discard-and-deprecation-warnings branch from 8f03f9e to aef3086 Compare September 4, 2026 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant