-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix empty editor windows #7515
Fix empty editor windows #7515
Conversation
@michaelgregorius wrote
(1) I think that it fix the bug because I test my code. (2) Bug is result of not proper another bug solution done by PR #7035 So I add another line but restore
as it was before. I tested it against PR #7035 fixed bug steps: 1: place notes on the grid. so line And this code is called, than windows are closed by Ctrl+1 , Ctrl+2, Ctrl+3, Ctrl+4 . (3) Using
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes the bug. Might prefer a signal/slot channel instead of making the private refocus()
public. Not a blocker in my eyes though.
Can someone explain why and how it fixes the bug? What caused the bug in the first place? |
Refactor `MainWindow::refocus` to make it more readable and straight-forward. Replace the Qt collection with a vector so that we can do a simple foreach loop. Also remove the local variable `found` by returning early on success or setting the focus on the main window otherwise. Remove code repetition by fetching the GUI once via `getGUI`.
I have checked the implementation of |
Empty editors window bug is kind of bugs I call "mystical bugs":
My opinion is, that signal/slot channel is "overkill".
It is better and is in LMMS style, so I accept this. [ But I prefer old good (only for my taste illustration):
Modern compilers will make editor register variable, so it will be faster and more compact in result assembler code. But such things not allowed here ... |
src/gui/MainWindow.cpp
Outdated
|
||
for (auto editorParent : editorParents) | ||
{ | ||
if(!editorParent->isHidden()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(!editorParent->isHidden()) | |
if (!editorParent->isHidden()) |
style
Co-authored-by: Dalton Messmer <[email protected]>
Co-authored-by: Dalton Messmer <[email protected]>
Now in refocus() refactoring context I have one question: is MainWindow class is right place for refocus()? What about GuiApplication class? P.S. |
Remove the local variable from `MainWindow::refocus` and add whitespace to the if statement.
Now MainWindow::refocus compiled with clang++ (ver. 14) with exported CXXFLAGS="-Oz" is little bit more compact, than my "old style variant", but assembler listing is near the same ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving this PR as it seems to fix the problem.
Thank You!
May be I find more things in MainWindow and Editor context to refactor. |
@firewall1110, I am currently not sure where to put it. I would have assumed that the other editors would be children of the So for now I'd rather keep the |
Fix the problem with empty windows as described in issue LMMS#7412. The `refocus` method in `MainWindow` is made public so that it can be called from `Editor::closeEvent`. It has also been refactored for better readability. --------- Co-authored-by: Michael Gregorius <[email protected]> Co-authored-by: Dalton Messmer <[email protected]>
(1) Bug affects not only Song Editor window, but also Piano Roll, Pattern Editor, Automation Editor windows (all are extending Editor class). Using MainWindow::refocus() makes closing event handling close to closing by shortcut (from MainWindow code)
(2) This is BugFix PR so I do not change coding convention violation ( variable _ce ).
[Edited: after some refactoring commits by LMMS member I decide to change _ce to event]
Reworks #7035
Fixes #7412