SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
dialoglayoutpersistence.h
Go to the documentation of this file.
1
31#ifndef OPENSWMMVIS_UI_DIALOGS_DIALOGLAYOUTPERSISTENCE_H
32#define OPENSWMMVIS_UI_DIALOGS_DIALOGLAYOUTPERSISTENCE_H
33
34#include <QRect>
35#include <QtGlobal> // Q_OS_MACOS
36#include <QtCore/qnamespace.h> // Qt::WindowFlags, Qt::Tool, Qt::WindowStaysOnTopHint
37
38class QDialog;
39class QScreen;
40class QWidget;
41
42namespace openswmmvis::ui {
43
52void saveDialogLayout(QWidget *root);
53
62bool restoreDialogLayout(QWidget *root);
63
84QRect clampToVisibleScreen(const QRect &saved, int titleBarStrip = -1);
85
97void ensureWindowOnScreen(QWidget *widget, const QScreen *preferred = nullptr);
98
104void applyAlwaysOnTopPolicy(QDialog *d);
105
116inline Qt::WindowFlags floatingPanelFlags()
117{
118#ifdef Q_OS_MACOS
119 return Qt::Dialog;
120#else
121 return Qt::Tool | Qt::WindowStaysOnTopHint;
122#endif
123}
124
129inline Qt::WindowFlags stayAboveAppFlags()
130{
131#ifdef Q_OS_MACOS
132 return Qt::WindowFlags();
133#else
134 return Qt::WindowStaysOnTopHint;
135#endif
136}
137
138} // namespace openswmmvis::ui
139
140#endif // OPENSWMMVIS_UI_DIALOGS_DIALOGLAYOUTPERSISTENCE_H
Definition openswmmvislayer.h:43
void saveDialogLayout(QWidget *root)
Persist the dialog's geometry + every named QSplitter under it.
Definition dialoglayoutpersistence.cpp:165
Qt::WindowFlags floatingPanelFlags()
Window flags for a modeless "floating panel" dialog that must stay above the application's OWN window...
Definition dialoglayoutpersistence.h:116
Qt::WindowFlags stayAboveAppFlags()
Just the "keep above the app's other windows" hint, for full top-level (Qt::Window) dialogs that shou...
Definition dialoglayoutpersistence.h:129
void ensureWindowOnScreen(QWidget *widget, const QScreen *preferred=nullptr)
Move/resize widget's window so it is reachable on a connected screen, using the live frame geometry t...
Definition dialoglayoutpersistence.cpp:134
void applyAlwaysOnTopPolicy(QDialog *d)
Step H — pin the dialog above the main window so a map click doesn't hide it. Idempotent....
Definition dialoglayoutpersistence.cpp:321
QRect clampToVisibleScreen(const QRect &saved, int titleBarStrip=-1)
Clamp a saved top-level geometry into currently-available screen space, so a window can never be rest...
Definition dialoglayoutpersistence.cpp:73
bool restoreDialogLayout(QWidget *root)
Inverse of saveDialogLayout — restore geometry + splitter states.
Definition dialoglayoutpersistence.cpp:227