diff options
author | Volker Krause <vkrause@kde.org> | 2022-02-14 18:12:24 +0100 |
---|---|---|
committer | Volker Krause <vkrause@kde.org> | 2022-02-24 16:43:05 +0000 |
commit | f446af2aa592997f6bc4aa3b5559cf477f9259f8 (patch) | |
tree | 884ce1c859da42351fd9b286680d5d15e916b6d8 /src/gui/CMakeLists.txt | |
parent | 1067eed52a8a1a93581744a5c9d4fc9f8a7d3661 (diff) | |
download | kconfig-f446af2aa592997f6bc4aa3b5559cf477f9259f8.tar.gz kconfig-f446af2aa592997f6bc4aa3b5559cf477f9259f8.tar.bz2 |
Add KWindowStateSaver
This is basically the C++ counter-part to
https://invent.kde.org/frameworks/kconfig/-/merge_requests/94
and allows to easily retrofit window size persistence on existing windows/
dialogs, replacing e.g. code like
https://invent.kde.org/pim/pimcommon/-/blob/master/src/pimcommon/widgets/kpimprintpreviewdialog.cpp.
This is a bit more complicated than one might expect, as KWindowConfig
works with QWindows, but that's something freshly created QWidget windows/
dialogs don't have yet. Additionally, we are in a library here that doesn't
depend on Qt::Widgets. To overcome this we move the widget-dependent code
(basically just a call to QWidget::windowHandle()) to inline template code
(and thus into the consumer), use std::function's type erasure to pass it
into the library code, and an event filter on the widget to wait for the
QWindow to become available.
Diffstat (limited to 'src/gui/CMakeLists.txt')
-rw-r--r-- | src/gui/CMakeLists.txt | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index c7474893..e717c1c1 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -11,6 +11,7 @@ target_sources(KF5ConfigGui PRIVATE kstandardshortcut.cpp kstandardshortcutwatcher.cpp kwindowconfig.cpp + kwindowstatesaver.cpp ) ecm_qt_declare_logging_category(KF5ConfigGui @@ -48,6 +49,7 @@ ecm_generate_headers(KConfigGui_HEADERS KStandardShortcut KStandardShortcutWatcher KWindowConfig + KWindowStateSaver REQUIRED_HEADERS KConfigGui_HEADERS ) |