-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Set minimumWidth of WLabel according to the content's maximum possible width #11194
Conversation
This fixes the wiggling off the horicontal knob position during adjusting the value.
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.
LGTM, thanks for the fixup!
Just a question, and please remove the debug output (--amend)
This screws up the label alignment in Tango and LateNight, though by looking at the Shade knobs xml I discovered how to simplify the Tango/LateNight knob templates. |
…elide This fixes issue mixxxdj#7913
Re-implementing the sizeHint() Function did finally the trick. Please test again. |
Unfortunately it's not yet working as desired, and I couldn't figure why, yet. |
I guess the minimumSizeHint doesn't consider the padding.
However, this is what happens: |
src/widget/wlabel.cpp
Outdated
m_widthHint = metrics.size(0, m_longText).width() + frameWidth(); | ||
QString elidedText = metrics.elidedText(m_longText, m_elideMode, width() - frameWidth()); |
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.
m_widthHint = metrics.size(0, m_longText).width() + frameWidth(); | |
QString elidedText = metrics.elidedText(m_longText, m_elideMode, width() - frameWidth()); | |
m_widthHint = metrics.size(0, m_longText).width() + 2 * frameWidth(); | |
QString elidedText = metrics.elidedText(m_longText, m_elideMode, width() - 2 * frameWidth()); |
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 think that was it.
At least now the size doesn't change anymore...
edit maybe add a comment that frameWidth()
is the sum of margin, padding, border from stylesheets?
Though I think we should try to figure why the label shrinks when parameters are swapped.
optimumWidth = math_max( | ||
optimumWidth, | ||
metrics.size(0, m_text).width()); | ||
m_widthHint = optimumWidth; |
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.
let's rename optimumWidth
to valueWidth
and
optimumWidth = math_max( | |
optimumWidth, | |
metrics.size(0, m_text).width()); | |
m_widthHint = optimumWidth; | |
int optimumWidth = math_max( | |
valueWidth, | |
metrics.size(0, m_text).width()); | |
m_widthHint = optimumWidth + 2 * frameWidth(); |
and remove the debug ouput below
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.
with this the labels are okay, besides the fact that they are initially (before swapping parameters) expanded compared to 2.4
Thank you for the good testing. For me it is working now. Also after parameter swapping. |
@daschuer Ignore this "good"/harmless regression, or investiagte once more? |
Let's just merge this. It is IMHO good enough. |
This fixes the wiggling off the knob position during adjusting the value.
A regression caused by the switch between value and label.