Commit c5d5657c authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Don't cut off zoomed font sizes to the nearest integer point size

This caused it to go to 0 when for example displaying size 9 at 10%,
which is an invalid value so it caused the text to revert back to the
default size.

It also caused zooming to sometimes appearing to have no effect. For
example zooming size 9 to 110% would still yield size 9 rather than 9.9.

Task-number: QTCREATORBUG-2744
Task-number: QTCREATORBUG-2745
Reviewed-by: Robert Loehning
Reviewed-by: hjk
parent 4af1d095
...@@ -2096,17 +2096,17 @@ void DebuggerPluginPrivate::connectEngine(DebuggerEngine *engine, bool notify) ...@@ -2096,17 +2096,17 @@ void DebuggerPluginPrivate::connectEngine(DebuggerEngine *engine, bool notify)
notifyCurrentEngine(RequestActivationRole, true); notifyCurrentEngine(RequestActivationRole, true);
} }
static void changeFontSize(QWidget *widget, int size) static void changeFontSize(QWidget *widget, qreal size)
{ {
QFont font = widget->font(); QFont font = widget->font();
font.setPointSize(size); font.setPointSizeF(size);
widget->setFont(font); widget->setFont(font);
} }
void DebuggerPluginPrivate::fontSettingsChanged void DebuggerPluginPrivate::fontSettingsChanged
(const TextEditor::FontSettings &settings) (const TextEditor::FontSettings &settings)
{ {
int size = settings.fontZoom() * settings.fontSize() / 100; qreal size = settings.fontZoom() * settings.fontSize() / 100.;
changeFontSize(m_breakWindow, size); changeFontSize(m_breakWindow, size);
changeFontSize(m_logWindow, size); changeFontSize(m_logWindow, size);
changeFontSize(m_localsWindow, size); changeFontSize(m_localsWindow, size);
......
...@@ -4722,7 +4722,7 @@ void BaseTextEditor::changeEvent(QEvent *e) ...@@ -4722,7 +4722,7 @@ void BaseTextEditor::changeEvent(QEvent *e)
|| e->type() == QEvent::FontChange) { || e->type() == QEvent::FontChange) {
if (d->m_extraArea) { if (d->m_extraArea) {
QFont f = d->m_extraArea->font(); QFont f = d->m_extraArea->font();
f.setPointSize(font().pointSize()); f.setPointSizeF(font().pointSizeF());
d->m_extraArea->setFont(f); d->m_extraArea->setFont(f);
slotUpdateExtraAreaWidth(); slotUpdateExtraAreaWidth();
d->m_extraArea->update(); d->m_extraArea->update();
......
...@@ -172,7 +172,7 @@ QTextCharFormat FontSettings::toTextCharFormat(const QString &category) const ...@@ -172,7 +172,7 @@ QTextCharFormat FontSettings::toTextCharFormat(const QString &category) const
if (category == textCategory) { if (category == textCategory) {
tf.setFontFamily(m_family); tf.setFontFamily(m_family);
tf.setFontPointSize(m_fontSize * m_fontZoom / 100); tf.setFontPointSize(m_fontSize * m_fontZoom / 100.);
tf.setFontStyleStrategy(m_antialias ? QFont::PreferAntialias : QFont::NoAntialias); tf.setFontStyleStrategy(m_antialias ? QFont::PreferAntialias : QFont::NoAntialias);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment