Skip to content

Commit 061bdde

Browse files
committedNov 7, 2015
Merge pull request #2426 from elpaso/bugfix-13747-bis
Added HiDPI support to QgsWebView
2 parents f77d6cd + dbd9b9b commit 061bdde

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed
 

‎src/core/qgswebview.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@
1616
#ifndef QGSWEBVIEW_H
1717
#define QGSWEBVIEW_H
1818

19+
1920
#include <QWidget>
2021
#include <QPrinter>
2122

2223
#ifdef WITH_QTWEBKIT
2324
#include <QWebView>
25+
#include <QDesktopWidget>
2426

2527
class CORE_EXPORT QgsWebView : public QWebView
2628
{
@@ -29,7 +31,14 @@ class CORE_EXPORT QgsWebView : public QWebView
2931
public:
3032
explicit QgsWebView( QWidget* parent = 0 )
3133
: QWebView( parent )
32-
{}
34+
{
35+
QDesktopWidget desktop;
36+
// Apply zoom factor for HiDPI screens
37+
if ( desktop.physicalDpiX( ) > 96 )
38+
{
39+
setZoomFactor( desktop.physicalDpiX( ) / 96 );
40+
}
41+
}
3342
};
3443
#else
3544
#include "qgswebpage.h"

‎src/gui/editorwidgets/qgsphotowidgetwrapper.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@
2222
#include <QLabel>
2323
#include <QPushButton>
2424
#include <QLineEdit>
25-
#include "qgswebview.h"
25+
26+
#ifdef WITH_QTWEBKIT
27+
#include <QWebView>
28+
#endif
29+
2630

2731
/**
2832
* Wraps a photo widget. Will show a picture and a file chooser to change the picture.

0 commit comments

Comments
 (0)
Please sign in to comment.