2
votes

I can run a boilerplate QT Quick Application (empty project) fine - the window shows and does not crash. If I then update the QML with some simple controls and run the application it shows the window for 3 seconds then crashes. This problem occurs when I run the example QT Quick application projects aswell.

The application output window shows:

The program has unexpectedly finished.
The process was ended forcefully.

What is going wrong and how can I fix this?

Information:

  • I am on Windows 10 64bit, using QT Creator, the project using QMake and mininum QT version allowed is 5.9

  • I am compiling in Debug mode using Desktop QT 5.11.1 MSVC2017 64bit. Note I am not able to compile in any other settings (MSVC2015, MinGW) - I get errors. If I compile in Release mode I still experience the same crash.

  • Desktop QT 5.11.1 MSVC2017 64bit does have an exclamation mark next to it No debugger setup

The following QML works:

import QtQuick 2.11
import QtQuick.Window 2.11

Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")
}

This causes it to crash:

import QtQuick 2.9
import QtQuick.Window 2.2
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3

ApplicationWindow {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")

    menuBar: MenuBar {
        Menu {
            title: 'File'
        }
    }

    header: ToolBar {
        RowLayout {

        }
    }

    TextArea {
        id: area
        anchors.fill: parent
    }
}
1
Just out of curiosity, does setting QT_OPENGL=angle help? Also, you'll need to get a backtrace. I'm not sure how that's done with the packaged Qt... if it doesn't come with debug symbols, you'll need to build Qt yourself. - Mitch
I encountered same problem same as you( Even my environment is the same as you), do u solve it?However, I have no problem before in the same environment till I reinstalled QT by offline package.By the way, QT 5.11.2 MSVC2017 64bit,the same fall. - Crawl.W
I have found that's because Qt Virtual Keyboard installed, then create a Qt Quick project and checked 'Use Qt Virtual Keyboard'.Run then crash.I don't know why, I am a QML newcomer, may a series of operations change enviroment. - Crawl.W
@Mitch Calls, need your help.I made some attempts, this is a must. - Crawl.W

1 Answers

1
votes

I was getting this crash too, with only a rectangle on the Window.

For me the crash was fixed by adding the following line before instantiating my QGuiApplication :

QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);

from the docs, on windows, this tells qt to use the angle. Angle is driver that translates opengl into directx

you can read more about the diferent driver option on http://doc.qt.io/qt-5/windows-requirements.html