-
-
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
Align the rename box for tracks #7414
Conversation
Wow, another dev returns. |
Looks like this is related to #7114 and #7209, @michaelgregorius you have any idea? |
I think it would be better for the renaming box to be "inlined" with the text box. When the user wants to rename the track, it would replace the text box with the renaming box itself, but that might be more work. |
@sakertooth i agree. That should be the default approach, @BaraMGB hope you can implement that method without much issues. |
Yes, I will have a look at this. Shouldn't be that difficult. |
In how far do you think it is related? As in "is caused by it"? IIRC, #7209 only undoes some of the changes that have been made with #7114. |
I reverted the hiding approach and lined up the ReadLine to the TrackLabelButtons text. |
I suspected that #7114 caused it. About the undoing, i thought the rename line edit was left out, causing the bug. |
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.
Style review. Also might help if you posted a screenshot demonstrating the fix.
src/gui/tracks/TrackLabelButton.cpp
Outdated
@@ -60,8 +63,8 @@ TrackLabelButton::TrackLabelButton( TrackView * _tv, QWidget * _parent ) : | |||
else | |||
{ | |||
setFixedSize( 160, 29 ); | |||
m_renameLineEdit->move( 30, ( height() / 2 ) - ( m_renameLineEdit->sizeHint().height() / 2 ) ); | |||
m_renameLineEdit->setFixedWidth( width() - 33 ); | |||
m_renameLineEdit->move(25, ( height() / 2 - m_renameLineEdit->sizeHint().height() / 2 ) + 1); |
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.
Just thought of this now, is it possible to use layouts to dynamically place the line edit widget instead of calling move()
explicitly? Sorry for the nitpicks, have to do this.
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.
Is there an example of using layouts in the code base? So I can see, how it works?
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.
I believe the MixerChannelView
now uses layout to handle something similar.
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.
I will have a look. I need to build for Windows and Mac, too. So I can see if it looks all the same on all systems.
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.
@BaraMGB, if you search for QVBoxLayout
, QHBoxLayout
or QBoxLayout
you should find several places in the code. Another type of layout is QGridLayout
.
I think it might even make sense to add a new widget for the label/line edit combination which implements the switching.
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.
Actually, I don't see the benefits of your idea. The current implementation is clean and works perfect. Actually this is only a simple bug fix PR. I don't see, why we should it make more complicated as it is. If someone wants to make the width of the track header dynamic one day, he could do it. But in my opinion, this goes beyond the purpose of this pull request.
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.
I believe TrackContentWidget
already uses a QHBoxLayout
and calling move() explicitly might have different results depending on the host system.
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.
Actually, I don't see the benefits of your idea. The current implementation is clean and works perfect. Actually this is only a simple bug fix PR. I don't see, why we should it make more complicated as it is. If someone wants to make the width of the track header dynamic one day, he could do it. But in my opinion, this goes beyond the purpose of this pull request.
I think it might be a bit more stable solution than the current one as can be seen by this issue. I agree that it is not in the scope of this PR though. It was just meant as some food for thought.
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.
@michaelgregorius I guess, the best option for this, is to use the QLineEdit itself. There should not need a stacked widget, because the QLineEdit has got 2 modes, a label mode and an edit mode. I try to push a new commit in the next days. Thank you for your thoughts.
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.
[...] the QLineEdit has got 2 modes, a label mode and an edit mode.
That sounds even better! 😃
Make sure that the rename line edit of the `TrackLabelButton` has the same font size as the widget itself. Because the font size is defined via style sheets the font size of the line edit has to be set when the actual renaming starts and not in the constructor. The reason is that style sheets are set after the constructor has run. Rename the local variable `txt` to the more speaking name `trackName`. Ensure that the line edit is moved to the correct place for different icon sizes by taking the icon size into account. To make this work this also has to be done in the `rename` method.
Streamline the default style sheet of `TrackLabelButton` by removing repeated properties that are inherited from the "main" style sheet, i.e. that are already part of `lmms--gui--TrackLabelButton`. Interestingly, the `background-color` property had to be repeated for `lmms--gui--TrackLabelButton:hover`.
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.
I have merged this pull request now as it solves the problem. Any potential further improvements can be done in separate pull requests. |
Align the rename line edit for tracks. Make sure that the rename line edit of the `TrackLabelButton` has the same font size as the widget itself. Because the font size is defined via style sheets the font size of the line edit has to be set when the actual renaming starts and not in the constructor. The reason is that style sheets are set after the constructor has run. Rename the local variable `txt` to the more speaking name `trackName`. Ensure that the line edit is moved to the correct place for different icon sizes by taking the icon size into account. To make this work this also has to be done in the `rename` method. ## Other changes Streamline the default style sheet of `TrackLabelButton` by removing repeated properties that are inherited from the "main" style sheet, i.e. that are already part of `lmms--gui--TrackLabelButton`. Interestingly, the `background-color` property had to be repeated for `lmms--gui--TrackLabelButton:hover`. --------- Co-authored-by: Michael Gregorius <[email protected]>
Fixing #7413 , on rename we set the text of the TrackLabelButton to an empty String. After renaming we set the text to the tracks name.
It's my first PR after a cuple of years. I hope I did it right.;)