QML program doesn't minimize properly
-
Hello,
I'm having a problem with a QML program I am making. It's a full screen program to which I've added a minimize button which calls QtQuick2ApplicationViewer.showMinimized() when clicked. This works fine on the development machine (Win7 x64) but when I deploy it on another computer, it doesn't minimize properly. What happens is that the program's screen doesn't go away but the interface doesn't respond. When I use alt+Tab none of the other open programs will be visible until I manage to guess how many times I have to hit alt+Tab to get back to the program, at which point it responds again. This leads me to believe that the program does "minimize", but something goes wrong so the screen doesn't go away.
I'm posting my main.cpp if that helps:
@#include <QApplication>
#include "qtquick2applicationviewer.h"#include <QDesktopWidget>
#include <QQmlContext>
#include "externalfilestarter.h"#include <QtOpenGL/QGLFormat>
#include <QMessageBox>int main(int argc, char *argv[])
{
QApplication app(argc, argv);if(!(QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_0)) { QMessageBox::critical(0, "Unsupported OpenGL", "This program requires OpenGL v2.0 or higher.\r\nPlease update your graphics card drivers.", QMessageBox::Ok); return -4; } ExternalFileStarter extFile; QtQuick2ApplicationViewer viewer; viewer.rootContext()->setContextProperty("QtQuick2ApplicationViewer", &viewer); viewer.rootContext()->setContextProperty("extFile", &extFile); viewer.setMainQmlFile(QStringLiteral("qml/Design2014Papers/main.qml")); viewer.setResizeMode(QtQuick2ApplicationViewer::SizeRootObjectToView); viewer.setGeometry(app.desktop()->screenGeometry()); viewer.showFullScreen(); return app.exec();
}
@I'll repeat that this problem only appears when I deploy it to other Win7 computers so it sounds like a deployment problem but I'm not sure how to pinpoint the problem. I'm using Qt 5.1 with MinGW.
Cheers,
Lucijan -
I've tested this further and I can get the program to minimize in Qt 5.0.2 but not in 5.1.0. Everything is fine in Qt Creator, yet when I deploy 5.0.2 works, but 5.1.0 doesn't. Is this a bug then?
I have noticed that 5.0.2 requires d3dcompiler_43.dll but 5.1.0 doesn't, and the 5.1.0\mingw48_32\bin folder doesn't contain that file at all, and it's also missing libEGL.dll and GLESv2.dll which were present in 5.0.2. I found them in the Tools\QtCreator\bin folder.
I have a small program which shows what happens, but you will have to deploy it first:
@import QtQuick 2.0
Rectangle {
width: 360
height: 360
Text {
id: minText
text: qsTr("Minimize")
anchors.centerIn: parent
MouseArea {
anchors.fill: parent
onClicked: {
QtQuick2ApplicationViewer.showMinimized();
}
}
}Text { id: quitText text: qsTr("Quit") anchors.left: minText.right anchors.leftMargin: 10 anchors.verticalCenter: minText.verticalCenter MouseArea { anchors.fill: parent onClicked: { Qt.quit(); } } }
}
@Here's the main.cpp file:
@#include <QtGui/QGuiApplication>
#include "qtquick2applicationviewer.h"#include <QQmlContext>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);QtQuick2ApplicationViewer viewer; viewer.rootContext()->setContextProperty("QtQuick2ApplicationViewer", &viewer); viewer.setMainQmlFile(QStringLiteral("qml/MinimizeTest/main.qml")); viewer.showFullScreen(); return app.exec();
}
@This only happens if the program is set to showFullScreen(), but doesn't happen if showExpanded() is used.
So is this a bug in Qt or am I missing something?