Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-29845

High-DPI support is broken when QQuickView is embedded in QWidget

XMLWordPrintable

    • 5a46251de36e568513bca70b82a1d6cc9c9cb0f3

      I know that QQuickView supports High-DPI well now.
      However, once I embed QQuickView(maybe QWindow?) into QWidget, hight-DPI support is broken.
      Here's sample code:

      #include <QApplication>
      #include <QTemporaryFile>
      #include <QQuickView>
      #include <QWidget>
      
      int main(int argc, char *argv[]) {
      	QApplication app(argc, argv);
      	QTemporaryFile file;
      	file.open();
      	file.write("import QtQuick 2.0\n Text {text: \"Test\"}");
      	file.close();
      
      	QQuickView view;
      	view.setSource(QUrl::fromLocalFile(file.fileName()));
      	view.resize(200, 50);
      	view.setTitle("Window");
      	view.show();
      
      	QWidget widget;
      	widget.winId();
      	widget.resize(200, 50);
      	widget.setWindowTitle("Widget");
      	widget.show();
      	QQuickView *v = new QQuickView(widget.window()->windowHandle());
      	v->setSource(QUrl::fromLocalFile(file.fileName()));
      	v->setGeometry(0, 0, 200, 50);
      	v->show();
      
      	return app.exec();
      }
      

      And the result in HiDPI mode of OS X is attached.
      You can see that "Window" shows clear text while the text of "Widget" is dirty.
      Although the sample code is using Text element for simplicity, You can see same results for any other elements like Image and textures of Open GL, too.

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            sorvig Morten Sørvig
            xylosper Byoung-young Lee
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes