0

I'm developing a GUI that embeds a web browser using QtWebEngineView. Whenever I add it, a scaling issue comes up. The pointer is not aligned correctly, and everything becomes fuzzy.

I have already looked at the problems referenced here, however I am still looking for a different solution:

PyQt5 QWebEngineView causes blurry/fuzzy scaling issue

PyQt WebEngineView interferes with MainMenu

The scaling issue does get fixed when I use main.showFullScreen() (but then my combobox doesn't show any options, however you can still chose them, though this isn't the immediate issue.) The other solution was to rollback the graphics driver but I didn't find it practical since I'm trying to distribute this application company wide.

from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWebEngineWidgets import QWebEngineView

import sys
import pandas as pd

districtDF = pd.read_csv('districts.csv')
distlist = []


class Web(QWebEngineView):
    def load(self, url):
        self.setUrl(QUrl(url))


class main_window(QMainWindow):
    def __init__(self, *args, **kwargs):
        super(main_window, self).__init__(*args, **kwargs)

        self.setWindowTitle('Test')
        self.setGeometry(50, 50, 600, 700)

        layout = QVBoxLayout()

        combo = QComboBox(self)
        for x in districtDF['dist']:
            combo.addItem(x)
        combo.move(50,50)
        combo.setGeometry(225, 50, 150, 30)

        web = Web()
        web.load("https://www.google.com/")

        layout.addWidget(combo)
        layout.addWidget(web)

        widget = QWidget()
        widget.setLayout(layout)
        self.setCentralWidget(widget)

        self.show()

app = QApplication(sys.argv)
main = main_window()
main.showFullScreen()
app.exec_()

Is there any way to fix this and be able to keep a windowed view?

eyllanesc
  • 235,170
  • 19
  • 170
  • 241
geistmate
  • 525
  • 2
  • 5
  • 14
  • unfortunately the problem does not depend on Qt but on the driver versions supported by chromium (which is the base library of Qt WebEngine), so the only solution is to use a minimal version of the driver. – eyllanesc Jun 19 '19 at 16:13
  • I see.. That's unfortunate; hopefully it gets fixed in future versions. For now I'll just have the html pop up in a new window so it doesn't affect everything else. It's just a folium map so I guess it won't be too big of a compromise. – geistmate Jun 19 '19 at 19:25
  • It is not a chromium bug but rather a requirement. – eyllanesc Jun 19 '19 at 19:27

0 Answers0