fix: missing timeline toolbar on reopening a file - #599
Merged
FelipeDefensor merged 1 commit intoSep 5, 2026
Merged
Conversation
Opening a file restores the window state saved under its path, and that state includes toolbar visibility. Two things made the saved state wrong. QMainWindow.addToolBar() only shows a toolbar on the next event loop iteration. A toolbar created while a file was loading was therefore still hidden when App.on_open() saved the window state right afterwards, so reopening that file restored the toolbar as hidden. All timeline toolbars also shared the object name "timeline_toolbar". restoreState() matches saved entries to live toolbars by object name, so it could apply one timeline kind's state to a toolbar of another kind, which is why a stale toolbar could stay visible while the right one disappeared. Show a newly added toolbar immediately, give each toolbar class its own object name, and re-derive toolbar visibility from the loaded timelines after restoring the window state, so a stale state cannot outlive a load. Refs TimeLineAnnotator#595, TimeLineAnnotator#407.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the recurring "timeline toolbar is missing" bug. Same root cause as #407; in #595 it is why the beat toolbar is absent and pressing B does nothing.
Root cause
Not a Qt or C++ level problem. Three things in our own code combine:
QtUI.on_file_loadedcallsQMainWindow.restoreState()with a window state stored per absolute file path inQSettings(private/recent_files/<path>/state). That is what makes the bug look machine- and path-dependent: the same file reproduces on one machine and not on another, and moving it to a different directory "fixes" it.timeline_toolbar.restoreState()matches saved entries to live toolbars by object name, in child order, so it can apply one timeline kind's saved state to a toolbar of another kind. That is exactly the Timeline toolbar is not displayed if file is saved in a certain directory (???) #407 report: the harmony toolbar stayed visible while the hierarchy toolbar did not appear.QMainWindow.addToolBar()only shows a toolbar on the next event loop iteration (QLayout::addChildWidgetqueues_q_showIfNotHidden).App.on_opensaves the window state synchronously right after loading, so a toolbar created during that load is still hidden at save time and gets recorded as hidden. Reopening the file then restores it as hidden.Point 3 only bites when the toolbar is created while the main window is already visible, which is why opening a file from the command line looks fine and opening it from the running app does not. It also explains @m-k94's "somehow it loaded fine the first time opening it".
Changes
self.__class__.__name__), sorestoreState()can no longer cross-assign state between timeline kinds.Also drops two unused attributes (
visible,_visible_timelines_count) fromTimelineToolbar.Two regression tests in
tests/ui/test_qtui.py, both verified to fail on0.6.5without the change:Repro bundle
Important deviation from the usual bundle: passing the file on the command line does not reproduce.
boot()callsapp.on_openbeforeui.launch(), so the toolbar is parented to a still-hidden window, which Qt does not treat as hidden, and the saved state records it as shown. The file has to be opened from the running app.Build the fixture, from this branch's checkout (PowerShell on Windows;
$PWDin Git Bash is an MSYS path the interpreter cannot open):See the bug, on the base ref:
See the fix, from this branch's checkout:
Close with
git worktree remove ../tilia-base. In both cases open the fixture through File > Open, using its absolute path, and do it twice in a row.Acceptance criteria
.repro/issue-595.tlavia File > Open, open the same file a second time, then press B.What this bundle does not verify
The scenario, the fix and the tests all come from one analysis, so the before/after pair shows that behaviour changed, not that this is the bug as reported. Not covered: the cross-kind swap from #407 (only the object-name unit test speaks to that), window states written by older TiLiA versions or on another machine, and the beat-timeline behaviour that #595 originally opened with, which is a separate matter.
Refs #595, #407.