#9130 Text in main work area isn't rendered with high resolution

Constify splash image coordinates
This commit is contained in:
Stephan Witt 2014-10-21 13:48:14 +02:00
parent 84e6b98562
commit 16e979298e

View File

@ -160,38 +160,34 @@ public:
QPainter pain(&splash_); QPainter pain(&splash_);
pain.setPen(QColor(0, 0, 0)); pain.setPen(QColor(0, 0, 0));
double const multiplier = splashPixelRatio() / pixelRatio();
int const size = toqstr(lyxrc.font_sizes[FONT_SIZE_LARGE]).toDouble() * multiplier;
int const x = 190 * multiplier;
int const y = 225 * multiplier;
LYXERR(Debug::GUI,
"widget pixel ratio: " << pixelRatio() <<
" splash pixel ratio: " << splashPixelRatio() <<
" version text size,position: " << size << "@" << x << "+" << y);
QFont font; QFont font;
// The font used to display the version info // The font used to display the version info
font.setStyleHint(QFont::SansSerif); font.setStyleHint(QFont::SansSerif);
font.setWeight(QFont::Bold); font.setWeight(QFont::Bold);
int size = int(toqstr(lyxrc.font_sizes[FONT_SIZE_LARGE]).toDouble());
size *= splashPixelRatio() / pixelRatio();
font.setPointSize(size); font.setPointSize(size);
pain.setFont(font); pain.setFont(font);
int x = 190;
int y = 225;
x *= splashPixelRatio() / pixelRatio();
y *= splashPixelRatio() / pixelRatio();
LYXERR(Debug::GUI,
"widget pixel ratio: " << pixelRatio() <<
" splash pixel ratio: " << splashPixelRatio() <<
" text position: @" << x << "+" << y);
pain.drawText(x, y, text); pain.drawText(x, y, text);
setFocusPolicy(Qt::StrongFocus); setFocusPolicy(Qt::StrongFocus);
} }
void paintEvent(QPaintEvent *) void paintEvent(QPaintEvent *)
{ {
int w = splash_.width(); int const w = splash_.width() / splashPixelRatio();
int h = splash_.height(); int const h = splash_.height() / splashPixelRatio();
w /= splashPixelRatio(); int const x = (width() - w) / 2;
h /= splashPixelRatio(); int const y = (height() - h) / 2;
int x = (width() - w) / 2;
int y = (height() - h) / 2;
LYXERR(Debug::GUI, LYXERR(Debug::GUI,
"widget pixel ratio: " << pixelRatio() << "widget pixel ratio: " << pixelRatio() <<
" splash pixel ratio: " << splashPixelRatio() << " splash pixel ratio: " << splashPixelRatio() <<
" paint pixmap: " << w << "x" << h << "@" << x << "+" << y); " paint pixmap: " << w << "x" << h << "@" << x << "+" << y);
QPainter pain(this); QPainter pain(this);
pain.drawPixmap(x, y, w, h, splash_); pain.drawPixmap(x, y, w, h, splash_);
} }