]> git.lyx.org Git - lyx.git/commitdiff
#9130 Text in main work area isn't rendered with high resolution
authorStephan Witt <switt@lyx.org>
Wed, 20 May 2015 05:51:50 +0000 (07:51 +0200)
committerStephan Witt <switt@lyx.org>
Wed, 20 May 2015 05:52:30 +0000 (07:52 +0200)
Correctly guard Qt5 code introduced by change c053a9394d1075ecad02ccce2f34c95f08c1f00f

src/frontends/qt4/GuiApplication.cpp
src/frontends/qt4/GuiImage.cpp
src/frontends/qt4/GuiView.cpp

index 6eb968cdb0dbceffa81fd25943ee1a633cd5407c..8bd22c8c0385134b495e7ca234e05871047199e2 100644 (file)
@@ -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;
index 589511cb90b3819eed547d8d005087e5d00bb820..69949f9b0a1e58584d36b499f6cc35bd38dc244d 100644 (file)
@@ -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
index e41a4514f26c973e9c33f6b888d00b89796e1aad..7c6a5d25ff76adc0f7bd047cf9ac3a6ec2739e54 100644 (file)
 #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));