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 WBeatSpinBox resizing #1266
Conversation
src/widget/wbeatspinbox.cpp
Outdated
@@ -267,16 +269,27 @@ bool WBeatSpinBox::event(QEvent* pEvent) { | |||
updateTooltip(); | |||
} else if (pEvent->type() == QEvent::FontChange) { | |||
const QFont& fonti = font(); | |||
qDebug() << "WBeatSpinBox::event QEvent::FontChange" << fonti.pixelSize() * m_scaleFactor; | |||
// Change the new font on the fly by casting away its constancy | |||
// using setFont() here, would results into a recursive loop | |||
// resetting the font to the original css values. | |||
// Only scale pixel size fonts, point size fonts are scaled by the OS | |||
if (fonti.pixelSize() > 0) { | |||
const_cast<QFont&>(fonti).setPixelSize(fonti.pixelSize() * m_scaleFactor); |
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 this needed anymore?
Thanks for working on this. This is an interesting work-around.
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.
It is needed for size measuring in QAbstractSpinBox::sizeHint()
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.
It'd be good to add a comment explaining that and also mentioning that scaling the QLineEdit's font is also needed to actually scale the widget.
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.
Done.
I tested and the font scaling works well. The up/down buttons aren't scaled though. It would be nice if they did, but if that's too much trouble, don't worry about it. |
That is the same issue we have in the effect combobox. IMHO it is not worth to solve it with QT4 because it it should be already solved in QT5. |
Okay, then LGTM. |
Thank you for testing. |
Ready for merge? |
Thank you for the remainder. Yes tests have passed. |
https://bugs.launchpad.net/bugs/1693638