Wrong window size and coordinates mapping using QML(QQuickView) on Windows 8 (Acer ICONIA W700) with Intel HD Graphics 4000
-
I have a problem with QML/Qt detecting incorrect screen resolution of Acer W700 (Windows 8) with Intel HD Graphics 4000 (I've tried different versions of the video driver with the same result), while using Qt 5.0.1 for Windows 32-bit (VS 2010).
The actual screen resolution is 1920x1080, while the following code outputs 1536x864:
@
// main.cpp
#include <QGuiApplication>
#include <QtQuick/QQuickView>int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);QQuickView view; view.setSource(QUrl("qrc:///main.qml")); view.setResizeMode( QQuickView::SizeRootObjectToView ); view.showFullScreen(); return app.exec();
}
@@
// main.qml
import QtQuick 2.0Rectangle {
id: mainRect
Text {
id: thisText
anchors.fill: parent
font.pointSize: 30
font.family: "Helvetica"
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: parseInt( mainRect.width ) + "x" + parseInt( mainRect.height )
}
}
@The Rectangle actually fills the entire screen and if I draw anything inside it gets properly anchored (everything is drawn properly if I use relative sizes to mainRect).
Since relative drawing works ok, I would be fine with it, but when I use touch interface the coordinates are reported in the correct resolution scale i.e. x: 0..1920; y: 0..1080, this breaks all the code related to touch, especially properties like pressed(). What is more confusing, if I use MouseArea, coordinates are being translated to this incorrect 1536x864 space.
I though at first that my touch screen drivers are broken, but it looks like Qt itself has a defect. Same code works perfectly fine on Windows 7 with NVidia GeForce GT 610 and NVidia GeForce 310.70 drivers, reporting correct screen resolution.
I was wondering if anyone had similar problems and are there any workarounds for this issue? Or maybe I missed something fundamental about mapping screen resolution and internal widget size?
-
After further investigation, it seems that something more fundamental got broken/changed during transition from Qt 4.8.4 to Qt 5.0.1. The same code for full screen behaves in a similar way if I use QWidget and QApplication classes, so the problem is not Qt Quick / QML specific, moreover I don't have this issue in Qt 4.8.4, only 5.0.1 is affected.
-
Please file a bug. This is an area I know nothing about, unfortunately.
Cheers,
Chris. -
[quote author="chrisadams" date="1362959588"]Please file a bug. This is an area I know nothing about, unfortunately.[/quote]
I have already submitted one: "QTBUG-30063":https://bugreports.qt-project.org/browse/QTBUG-30063
As for now the status is still "Not Evaluated". I hope I used a proper bug tracker. -
Thanks.
Yes, that's the correct bug tracker.
Cheers,
Chris. -
when I see this it reminds me a bit on the "device-pixel-ratio" magic that current smart-phones are using when displaying web-content ... maybe Qt5 is using some similar "logical resolution" thing
... at least there seems to be a bigger change behind the "QDesktopWidget::screenGeometry()" API (Qt5 replaced a lot of the platform specific magic with more streamlined QPA-code)
I first thought QScreen(Qt5) might give some more physical vs. logical information, but on a 2nd look there is not really such a separation ...
-
It turns our that Qt 5.0.1 was not calling SetProcessDPIAware function before the initialization. More details are "here":https://bugreports.qt-project.org/browse/QTBUG-30063?focusedCommentId=198569&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-198569 and "here":http://qt-project.org/forums/viewthread/25605/#118658