summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2010-10-15 17:19:36 +0200
committerThorbjørn Lindeijer <thorbjorn.lindeijer@nokia.com>2010-10-15 17:44:15 +0200
commitc5d5657c13f70ce2e6b893767fcaa819cc5af0b5 (patch)
tree29995da884c182f4daee3119daa81785a0c57b03
parent4af1d09535c12bc33a3aef6ec346567f8c82e197 (diff)
downloadqt-creator-c5d5657c13f70ce2e6b893767fcaa819cc5af0b5.tar.gz
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
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp6
-rw-r--r--src/plugins/texteditor/basetexteditor.cpp2
-rw-r--r--src/plugins/texteditor/fontsettings.cpp2
3 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 72f6ab983f..7a605bcf07 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -2096,17 +2096,17 @@ void DebuggerPluginPrivate::connectEngine(DebuggerEngine *engine, bool notify)
notifyCurrentEngine(RequestActivationRole, true);
}
-static void changeFontSize(QWidget *widget, int size)
+static void changeFontSize(QWidget *widget, qreal size)
{
QFont font = widget->font();
- font.setPointSize(size);
+ font.setPointSizeF(size);
widget->setFont(font);
}
void DebuggerPluginPrivate::fontSettingsChanged
(const TextEditor::FontSettings &settings)
{
- int size = settings.fontZoom() * settings.fontSize() / 100;
+ qreal size = settings.fontZoom() * settings.fontSize() / 100.;
changeFontSize(m_breakWindow, size);
changeFontSize(m_logWindow, size);
changeFontSize(m_localsWindow, size);
diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp
index bd9e67274e..eaa36330c7 100644
--- a/src/plugins/texteditor/basetexteditor.cpp
+++ b/src/plugins/texteditor/basetexteditor.cpp
@@ -4722,7 +4722,7 @@ void BaseTextEditor::changeEvent(QEvent *e)
|| e->type() == QEvent::FontChange) {
if (d->m_extraArea) {
QFont f = d->m_extraArea->font();
- f.setPointSize(font().pointSize());
+ f.setPointSizeF(font().pointSizeF());
d->m_extraArea->setFont(f);
slotUpdateExtraAreaWidth();
d->m_extraArea->update();
diff --git a/src/plugins/texteditor/fontsettings.cpp b/src/plugins/texteditor/fontsettings.cpp
index 540f2d53a8..6d8b994e90 100644
--- a/src/plugins/texteditor/fontsettings.cpp
+++ b/src/plugins/texteditor/fontsettings.cpp
@@ -172,7 +172,7 @@ QTextCharFormat FontSettings::toTextCharFormat(const QString &category) const
if (category == textCategory) {
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);
}