Skip to content

Commit

Permalink
Added HiDPI support to QgsWebView
Browse files Browse the repository at this point in the history
The DPI value is get from QDesktopWidget and
the QWebView widget is zoomed if needed.

Fixes #13747
  • Loading branch information
elpaso committed Nov 7, 2015
1 parent 4cc6650 commit dbd9b9b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
11 changes: 10 additions & 1 deletion src/core/qgswebview.h
Expand Up @@ -16,11 +16,13 @@
#ifndef QGSWEBVIEW_H
#define QGSWEBVIEW_H


#include <QWidget>
#include <QPrinter>

#ifdef WITH_QTWEBKIT
#include <QWebView>
#include <QDesktopWidget>

class CORE_EXPORT QgsWebView : public QWebView
{
Expand All @@ -29,7 +31,14 @@ class CORE_EXPORT QgsWebView : public QWebView
public:
explicit QgsWebView( QWidget* parent = 0 )
: QWebView( parent )
{}
{
QDesktopWidget desktop;
// Apply zoom factor for HiDPI screens
if ( desktop.physicalDpiX( ) > 96 )
{
setZoomFactor( desktop.physicalDpiX( ) / 96 );
}
}
};
#else
#include "qgswebpage.h"
Expand Down
6 changes: 5 additions & 1 deletion src/gui/editorwidgets/qgsphotowidgetwrapper.h
Expand Up @@ -22,7 +22,11 @@
#include <QLabel>
#include <QPushButton>
#include <QLineEdit>
#include "qgswebview.h"

#ifdef WITH_QTWEBKIT
#include <QWebView>
#endif


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

0 comments on commit dbd9b9b

Please sign in to comment.