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

Correctly guard Qt5 code introduced by change c053a9394d
This commit is contained in:
Stephan Witt 2015-05-20 07:51:50 +02:00
parent 27b8b06879
commit d392df30c0
3 changed files with 17 additions and 0 deletions

View 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;

View 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

View File

@ -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));