From f930d853ba780ef3ac864b637d53aa983f780086 Mon Sep 17 00:00:00 2001 From: werner Date: Sun, 4 Sep 2016 11:26:45 +0200 Subject: [PATCH] fix #123491: Control-A when editing title-text etc don't show all selected text --- libmscore/barline.cpp | 2 +- libmscore/text.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libmscore/barline.cpp b/libmscore/barline.cpp index 3a10021b51..446328e9ff 100644 --- a/libmscore/barline.cpp +++ b/libmscore/barline.cpp @@ -489,7 +489,7 @@ void BarLine::draw(QPainter* painter) const f.setPointSizeF(12 * spatium() * MScore::pixelRatio / SPATIUM20); f.setBold(true); QString str = m->len() > m->timesig() ? "+" : "-"; - QRectF r = QFontMetricsF(f).boundingRect(str); + QRectF r = QFontMetricsF(f, MScore::paintDevice()).boundingRect(str); painter->setFont(f); painter->drawText(-r.width(), 0.0, str); } diff --git a/libmscore/text.cpp b/libmscore/text.cpp index bf55868663..54eb188851 100644 --- a/libmscore/text.cpp +++ b/libmscore/text.cpp @@ -341,7 +341,7 @@ qreal TextBlock::xpos(int column, const Text* t) const for (const TextFragment& f : _text) { if (column == col) return f.pos.x(); - QFontMetricsF fm(f.font(t)); + QFontMetricsF fm(f.font(t), MScore::paintDevice()); int idx = 0; for (const QChar& c : f.text) { ++idx; @@ -436,7 +436,7 @@ int TextBlock::column(qreal x, Text* t) const ++idx; if (c.isHighSurrogate()) continue; - QFontMetricsF fm(f.font(t)); + QFontMetricsF fm(f.font(t), MScore::paintDevice()); qreal xo = fm.width(f.text.left(idx)); if (x <= f.pos.x() + px + (xo-px)*.5) return col; @@ -993,7 +993,7 @@ QRectF Text::cursorRect() const else font = _textStyle.fontPx(spatium()); - qreal ascent = QFontMetricsF(font).ascent() * .7; + qreal ascent = QFontMetricsF(font, MScore::paintDevice()).ascent() * .7; qreal h = ascent; // lineSpacing(); qreal x = tline.xpos(_cursor->column(), this); qreal y = tline.y(); @@ -1328,7 +1328,7 @@ void Text::layoutFrame() qreal Text::lineSpacing() const { - return QFontMetricsF(textStyle().fontPx(spatium())).lineSpacing(); + return QFontMetricsF(textStyle().fontPx(spatium()), MScore::paintDevice()).lineSpacing(); } //--------------------------------------------------------- @@ -1337,7 +1337,7 @@ qreal Text::lineSpacing() const qreal Text::lineHeight() const { - return QFontMetricsF(textStyle().fontPx(spatium())).height(); + return QFontMetricsF(textStyle().fontPx(spatium()), MScore::paintDevice()).height(); } //--------------------------------------------------------- @@ -1346,7 +1346,7 @@ qreal Text::lineHeight() const qreal Text::baseLine() const { - return QFontMetricsF(textStyle().fontPx(spatium())).ascent(); + return QFontMetricsF(textStyle().fontPx(spatium()), MScore::paintDevice()).ascent(); } //---------------------------------------------------------