Replies: 2 comments
|
Opened a PR implementing the scope above: #624 |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Forum thread: https://qelectrotech.org/forum/viewtopic.php?pid=17934#p17934
Qt reference: https://doc.qt.io/qt-5/qwidget.html#windowModified-prop
Problem
On macOS there's no way to tell from the window chrome alone whether the active project has unsaved changes — the request specifically points at the small black dot Cocoa apps show inside the red traffic-light close button for a modified document. Qt exposes this natively via the
windowModifiedproperty; QET doesn't set it anywhere today.What exists today
QETDiagramEditor : public QETMainWindow(qetdiagrameditor.h:52) is the actual top-level window. Its title is set once in the constructor to a static string and never updated afterward:setWindowTitle(tr("QElectroTech", "window title"));(qetdiagrameditor.cpp:112).ProjectView(a plainQWidget,projectview.h:79) added as a tab.ProjectView::updateWindowTitle()(projectview.cpp:967-979) setswindowTitle()fromproject->pathNameTitle()(qetproject.cpp:424) — used for the tab label, not the OS window title — and is already wired to fire on every modification:connect(m_project, &QETProject::projectModified, this, &ProjectView::updateWindowTitle);(projectview.cpp:84).QETProjectalready tracks a clean/dirty flag and emits it on change:QETProject::setModified(bool)(qetproject.cpp:1414-1420) flipsm_modifiedand emitsprojectModified(QETProject*, bool), triggered whenever the undo stack leaves the clean state (undoStackChanged,qetproject.h:247) or on save.QETDiagramEditor::activateProject(ProjectView*)(qetdiagrameditor.cpp:2210-2213) is the single choke point already used whenever the visible/active project tab changes.windowModifiedproperty is built exactly for this case: once the top-level widget'swindowTitle()contains a[*]placeholder,QWidget::setWindowModified(true)makes Qt draw the platform-native modified indicator — on macOS, the dot in the close button — with no custom painting needed.Proposed scope
QETDiagramEditor's window title a[*]placeholder, built from the active project's title the same wayProjectView::updateWindowTitle()already does for its tab label (e.g."%1[*] - QElectroTech").setWindowModified(bool)on the main window whenever the active project's modified state changes, via two triggers:QETProject::projectModifiedon whichever project is currently active — same pattern as the existingprojectview.cpp:84connection.QETDiagramEditor::activateProject(ProjectView*), so switching tabs immediately reflects the newly active project's own state instead of carrying over the previous tab's.windowModifiedrendering are unaffected — macOS is where this becomes visible, matching the request.Related, not proposed here
The same forum post also asks why the toolbar save icon stays black instead of greying out after saving. Per scorpio810's reply in the thread, that's existing intentional behavior (kept since ~2010 to support saving a backup without altering "needs save" state) and is out of scope for this proposal.
Happy to build this if the scope above sounds right.
All reactions