Skip to content
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

Merged
merged 2 commits into from May 30, 2017
Merged

Fix WBeatSpinBox resizing #1266

merged 2 commits into from May 30, 2017

Conversation

daschuer
Copy link
Member

@daschuer daschuer commented May 25, 2017

@@ -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);
Copy link
Member

@Be-ing Be-ing May 25, 2017

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.

Copy link
Member Author

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()

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@Be-ing
Copy link
Member

Be-ing commented May 26, 2017

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.

@daschuer
Copy link
Member Author

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.

@Be-ing
Copy link
Member

Be-ing commented May 26, 2017

Okay, then LGTM.

@daschuer
Copy link
Member Author

Thank you for testing.

@Be-ing
Copy link
Member

Be-ing commented May 30, 2017

Ready for merge?

@daschuer
Copy link
Member Author

Thank you for the remainder. Yes tests have passed.

@daschuer daschuer merged commit 27a110f into mixxxdj:master May 30, 2017
@daschuer daschuer deleted the beatloop_size branch September 26, 2021 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants