Skip to content
Permalink
Browse files

Added HiDPI support to QgsWebView

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 dbd9b9bc3338b3fea100496df0cf725e05003c0c
Showing with 15 additions and 2 deletions.
  1. +10 −1 src/core/qgswebview.h
  2. +5 −1 src/gui/editorwidgets/qgsphotowidgetwrapper.h
@@ -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
{
@@ -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"
@@ -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.

0 comments on commit dbd9b9b

Please sign in to comment.
You can’t perform that action at this time.