mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-17 04:04:13 +02:00
Reflect unsaved-changes state in the main window title
On macOS in particular there's currently no way to tell from the window chrome alone whether the active project has unsaved changes. The main window's title is set once in the constructor to a static string and never updated afterward, and QET never sets Qt's windowModified property anywhere -- so the native "document modified" indicator (the dot in the close button on macOS; an asterisk in the title on platforms that render it as text) never appears. Add QETDiagramEditor::updateWindowModifiedState(), which sets the window title to "<project>[*] - QElectroTech" (the "[*]" is Qt's own placeholder convention for this) and calls setWindowModified() with the active project's own modified flag. Call it from two places: - subWindowActivated(), the single existing choke point already used whenever the visible MDI tab changes, so switching projects immediately reflects the newly active one's own state. - A new per-project connection to QETProject::projectModified, added in addProject() alongside the existing undo-stack registration, filtered to only act when the modified project is the currently active one. With no project open, the title and modified flag both revert to the original static, unmodified state. Implements https://github.com/qelectrotech/qelectrotech-source-mirror/discussions/596
This commit is contained in:
@@ -98,6 +98,7 @@ class QETDiagramEditor : public QETMainWindow
|
||||
ProjectView *findProject(const QString &) const;
|
||||
QMdiSubWindow *subWindowForWidget(QWidget *) const;
|
||||
void updateUsageTrackersActiveState();
|
||||
void updateWindowModifiedState();
|
||||
|
||||
signals:
|
||||
void syncElementsPanel();
|
||||
|
||||
Reference in New Issue
Block a user