commit d392df30c09d23a135b6152060e91408c796306b
Author: Stephan Witt <[email protected]>
Date:   Wed May 20 07:51:50 2015 +0200

    #9130 Text in main work area isn't rendered with high resolution
    Correctly guard Qt5 code introduced by change 
c053a9394d1075ecad02ccce2f34c95f08c1f00f

diff --git a/src/frontends/qt4/GuiApplication.cpp 
b/src/frontends/qt4/GuiApplication.cpp
index 6eb968c..8bd22c8 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 589511c..69949f9 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<int>((params.bb.xr - params.bb.xl) * 
pixelRatio);
        int const new_height = static_cast<int>((params.bb.yt - params.bb.yb) * 
pixelRatio);
+#else
+       int const new_width  = static_cast<int>((params.bb.xr - params.bb.xl));
+       int const new_height = static_cast<int>((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 e41a451..7c6a5d2 100644
--- a/src/frontends/qt4/GuiView.cpp
+++ b/src/frontends/qt4/GuiView.cpp
@@ -110,7 +110,9 @@
 #include <QSplitter>
 #include <QStackedWidget>
 #include <QStatusBar>
+#if QT_VERSION >= 0x050000
 #include <QSvgRenderer>
+#endif
 #include <QtConcurrentRun>
 #include <QTime>
 #include <QTimer>
@@ -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));

Reply via email to