From d392df30c09d23a135b6152060e91408c796306b Mon Sep 17 00:00:00 2001 From: Stephan Witt Date: Wed, 20 May 2015 07:51:50 +0200 Subject: [PATCH] #9130 Text in main work area isn't rendered with high resolution Correctly guard Qt5 code introduced by change c053a9394d1075ecad02ccce2f34c95f08c1f00f --- src/frontends/qt4/GuiApplication.cpp | 2 ++ src/frontends/qt4/GuiImage.cpp | 9 +++++++++ src/frontends/qt4/GuiView.cpp | 6 ++++++ 3 files changed, 17 insertions(+) diff --git a/src/frontends/qt4/GuiApplication.cpp b/src/frontends/qt4/GuiApplication.cpp index 6eb968cdb0..8bd22c8c03 100644 --- a/src/frontends/qt4/GuiApplication.cpp +++ b/src/frontends/qt4/GuiApplication.cpp @@ -570,12 +570,14 @@ QString iconName(FuncRequest const & f, bool unknown) bool getPixmap(QPixmap & pixmap, QString const & path) { if (pixmap.load(path)) { +#if QT_VERSION >= 0x050000 if (path.endsWith(".svgz") || path.endsWith(".svg") ) { GuiApplication const * guiApp = theGuiApp(); if (guiApp != 0) { pixmap.setDevicePixelRatio(guiApp->pixelRatio()); } } +#endif return true; } return false; diff --git a/src/frontends/qt4/GuiImage.cpp b/src/frontends/qt4/GuiImage.cpp index 589511cb90..69949f9b0a 100644 --- a/src/frontends/qt4/GuiImage.cpp +++ b/src/frontends/qt4/GuiImage.cpp @@ -141,9 +141,14 @@ bool GuiImage::clip(Params const & params) // No clipping is necessary. return false; +#if QT_VERSION >= 0x050000 double const pixelRatio = is_transformed_ ? transformed_.devicePixelRatio() : original_.devicePixelRatio(); int const new_width = static_cast((params.bb.xr - params.bb.xl) * pixelRatio); int const new_height = static_cast((params.bb.yt - params.bb.yb) * pixelRatio); +#else + int const new_width = static_cast((params.bb.xr - params.bb.xl)); + int const new_height = static_cast((params.bb.yt - params.bb.yb)); +#endif QImage const & image = is_transformed_ ? transformed_ : original_; @@ -186,8 +191,12 @@ bool GuiImage::scale(Params const & params) if (params.scale == 100) return false; +#if QT_VERSION >= 0x050000 double const pixelRatio = is_transformed_ ? transformed_.devicePixelRatio() : original_.devicePixelRatio(); qreal scale = qreal(params.scale) / 100.0 * pixelRatio; +#else + qreal scale = qreal(params.scale) / 100.0; +#endif #if (QT_VERSION >= 0x040500) && (QT_VERSION <= 0x040502) // Due to a bug in Qt, LyX will crash for certain diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index e41a4514f2..7c6a5d25ff 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -110,7 +110,9 @@ #include #include #include +#if QT_VERSION >= 0x050000 #include +#endif #include #include #include @@ -162,6 +164,7 @@ public: qt_("version ") + lyx_version : qt_("unknown version"); QString imagedir = "images/"; FileName fname = imageLibFileSearch(imagedir, "banner", "svgz"); +#if QT_VERSION >= 0x050000 QSvgRenderer svgRenderer(toqstr(fname.absFileName())); if (svgRenderer.isValid()) { splash_ = QPixmap(splashSize()); @@ -171,6 +174,9 @@ public: } else { splash_ = getPixmap("images/", "banner", "png"); } +#else + splash_ = getPixmap("images/", "banner", "png"); +#endif QPainter pain(&splash_); pain.setPen(QColor(0, 0, 0)); -- 2.39.2