Showing with 38 additions and 3 deletions.
  1. +1 −1 .travis.yml
  2. +1 −0 src/kst/main.cpp
  3. +11 −1 src/libkstapp/plotitem.cpp
  4. +11 −1 src/libkstapp/viewitem.cpp
  5. +14 −0 src/widgets/curveappearance.cpp
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ install:
script:
#- ./cmake/travis.sh qt4
- ./cmake/travis.sh qt5
- ./cmake/travis.sh qt5 x64
#- ./cmake/travis.sh qt5 x64

branches:
only:
Expand Down
1 change: 1 addition & 0 deletions src/kst/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <QTranslator>
#include <QLocale>
#include <QDebug>
#include <time.h>

#ifdef Q_CC_MSVC
__declspec(dllexport)
Expand Down
12 changes: 11 additions & 1 deletion src/libkstapp/plotitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,17 @@ void PlotItem::updatePlotPixmap() {
return;
}

QPixmap pixmap(rect().width()+1, rect().height()+1);
#ifdef QT5
int device_pixel_ratio = view()->devicePixelRatio();
#else
int device_pixel_ratio = 1;
#endif

QPixmap pixmap(device_pixel_ratio*(rect().width()+1), device_pixel_ratio*(rect().height()+1));
#ifdef QT5
pixmap.setDevicePixelRatio(device_pixel_ratio);
#endif

pixmap.fill(Qt::transparent);
QPainter pixmapPainter(&pixmap);

Expand Down
12 changes: 11 additions & 1 deletion src/libkstapp/viewitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1274,7 +1274,17 @@ void ViewItem::startDragging(QWidget *widget, const QPointF& hotspot) {
qreal w = fabs(rect().width()*cos(theta)) + fabs(rect().height()*sin(theta));
qreal h = fabs(rect().width()*sin(theta)) + fabs(rect().height()*cos(theta));

QPixmap pixmap(w+2, h+2);
#ifdef QT5
int device_pixel_ratio = view()->devicePixelRatio();
#else
int device_pixel_ratio = 1;
#endif

QPixmap pixmap(device_pixel_ratio*(w+2), device_pixel_ratio*(h+2));

#ifdef QT5
pixmap.setDevicePixelRatio(device_pixel_ratio);
#endif

if (ApplicationSettings::self()->transparentDrag()) {
pixmap.fill(Qt::transparent);
Expand Down
14 changes: 14 additions & 0 deletions src/widgets/curveappearance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,11 @@ void CurveAppearance::populateSymbolCombos() {


void CurveAppearance::populateSymbolCombo(QComboBox *combo, QColor symbolColor) {
#ifdef QT5
int pixel_ratio = combo->devicePixelRatio();
#else
int pixel_ratio = 1;
#endif

if (symbolColor == Qt::transparent) {
symbolColor = Qt::black;
Expand All @@ -96,7 +100,10 @@ void CurveAppearance::populateSymbolCombo(QComboBox *combo, QColor symbolColor)

// fill the point type dialog with point types
QPixmap ppix( 4*h*pixel_ratio, h*pixel_ratio );

#ifdef QT5
ppix.setDevicePixelRatio(pixel_ratio);
#endif

int pix_w = ppix.width()/pixel_ratio;
int pix_h = ppix.height()/pixel_ratio;
Expand Down Expand Up @@ -453,13 +460,20 @@ void CurveAppearance::drawSampleLine() {
// logical pixels are not physical pixels. However, not all Qt functions
// seem to play well in this universe, requiring some... entertainment.

#ifdef QT5
int pixel_ratio = _label->devicePixelRatio();
#else
int pixel_ratio = 1;
#endif

int h = fontMetrics().lineSpacing()*3/2;
_label->resize(h*5, h);
QPixmap pix(_label->contentsRect().width()*pixel_ratio,
_label->contentsRect().height()*pixel_ratio);

#ifdef QT5
pix.setDevicePixelRatio(pixel_ratio);
#endif

int pix_w = pix.width()/pixel_ratio;
int pix_h = pix.height()/pixel_ratio;
Expand Down