Important: Please read the Qt Code of Conduct -

Crashing Application at Application Exit

  • Hello together,

    I want to use a ConicalGradient int T.Button Element, because we need some special effetcts. So we overwrite the standard behaviour of the Button Element.

    But the ConicalGradient Element in the T.Button Definitions seems to cause the crash at application exit.
    I have no idea why is it so. Maybe someone has an Idea whats's going on.

    I have a minimal example uploaded to show the problem.

    [](Uploading 100%)


  • @marcus_1

    It seems that i don't have enough privileges to upload the example. Maybe my description is enough to understand the problem.

  • Just copy and paste the contents of the main .qml file. We don't need the C++ main() boilerplate. :)

  • Ok Here the Listing for the Button.qml i use:

    import QtQuick 2.9
    import QtQuick.Controls 2.2
    import QtQuick.Controls.impl 2.1
    import QtQuick.Templates 2.2 as T

    import QtGraphicalEffects 1.0
    import QtQuick.Controls.Styles 1.4

    T.Button {
    id: myButton

    readonly property color teleBtnTxtClrDis: "#989998"
    readonly property color teleBtnTxtClrOff: "#F2F2F2"
    readonly property color teleBtnTxtClrOn:  "#958F8E"
    readonly property color teleBtnTxtClrReq: "#B2B2B1"
    readonly property color teleBtnBgClrDis: "#888988"
    readonly property color teleBtnBgClrOff: "#888988"
    readonly property color teleBtnBgClrOn:  "#FFFEFD"
    readonly property color teleBtnBgClrReq: "#888988"
    readonly property color teleBtnBrdClrDis: "black"
    readonly property color teleBtnBrdClrOff: "blue"
    readonly property color teleBtnBrdClrOn:  "white"
    readonly property color teleBtnBrdClrReq: "white"
    // Text
    readonly property int stdTextSize: 14
    // Available button states
    readonly property int  btn_STATE_INACTIVE:      1
    readonly property int  btn_STATE_OFF:           2
    readonly property int  btn_STATE_ON:            3
    readonly property int  btn_STATE_REQ:           4
    property url btnImgDis: ""
    property url btnImgOff: ""
    property url btnImgOn:  ""
    property url btnImgReq: ""
    property alias  bgrectani: bgrectani
    //text: qsTr("Button text can be long")
    width: 80
    height: width
    bottomPadding: 0
    topPadding: 0
    rightPadding: 4
    leftPadding: 4
    padding: 0
    checkable: false
    property double scalefactor: 1.0
    property int currentState
    property color bgcolor: teleBtnBgClrDis
    property color textcolor: teleBtnTxtClrDis
    property color bordercolor:teleBtnBrdClrDis
    property int margin: 0
    property bool bAni: false
    property bool bVis: false
    contentItem: Text {
        width: parent.width
        height: parent.height
        wrapMode: Text.WordWrap
        font.pixelSize: stdTextSize
        color: textcolor
        text: parent.text
        bottomPadding: parent.bottomPadding
        topPadding: parent.topPadding
        rightPadding: parent.rightPadding
        leftPadding: parent.leftPadding
        padding: parent.padding
        horizontalAlignment: Text.AlignHCenter
        verticalAlignment: Text.AlignVCenter
    onCurrentStateChanged: {
        // console.log("T.Button onCurrentStateChanged")
        case btn_STATE_INACTIVE:
            bgcolor =   teleBtnBgClrDis
            textcolor = teleBtnTxtClrDis
            bordercolor = teleBtnBrdClrDis
            myImage.source = btnImgDis
            margin =  0
            bAni = false
            bVis = false
            // console.log("T.Button btn_STATE_INACTIVE")
        case btn_STATE_OFF:
            bgcolor =   teleBtnBgClrOff
            textcolor = teleBtnTxtClrOff
            bordercolor = teleBtnBrdClrOff
            // console.log("btnImgOff "+ btnImgOff)
            myImage.source = btnImgOff
            //console.log("T.Button btn_STATE_OFF")
            margin =  0
            bAni = false
            bVis = false
        case btn_STATE_ON:
            bgcolor =   teleBtnBgClrOn
            textcolor = teleBtnTxtClrOn
            bordercolor = teleBtnBrdClrOn
            myImage.source = btnImgOn
            margin =  0
            bAni = false
            bVis = false
            //console.log("T.Button btn_STATE_ON")
        case btn_STATE_REQ:
            bgcolor =   teleBtnBgClrReq
            textcolor = teleBtnTxtClrReq
            bordercolor = teleBtnBrdClrReq
            myImage.source = btnImgReq
            margin =  4
            bAni = true
            bVis = true
            //console.log("T.Button btn_STATE_REQ")
            console.error("Button currentstate ist not specified.")
    property double value1: 0.00
    NumberAnimation on value1 {
        from: 0.00;
        to: 1.00;
        loops: Animation.Infinite;
        duration: 8000
        running: true
        source: bgrectani
        anchors.fill: bgrectani
        gradient: Gradient
            GradientStop { position: 0.00; color: "lightgrey" }
            GradientStop { position: value1 ; color: "lightgrey" }
            GradientStop { position: value1 + 0.01; color: "transparent" }
            GradientStop { position: 1.00; color: "transparent" }
        visible: true
    background: Rectangle {
        id: bgrectani
        width: myButton.width
        height: myButton.height
        color: bgcolor
        radius: bgrectani.width / 2
        Rectangle {
            id: rctbg
            width: myButton.width - margin
            height: myButton.height - margin
            border.color: bordercolor
            color: bgcolor
            border.width: 0
            radius: rctbg.width/2
            anchors.horizontalCenter: bgrectani.horizontalCenter
            anchors.verticalCenter: bgrectani.verticalCenter
            Image {
                id: myImage
                anchors.fill: parent
                source: ""


  • Which Qt version and platform? It doesn't crash for me with Qt 5.10.1 on Linux or Windows. I tried with:

    // main.qml
    import QtQuick 2.9
    import QtQuick.Window 2.2
    Window {
        visible: true
        width: 640
        height: 480
        Button {
            anchors.centerIn: parent

    and Button.qml with the given content in the same folder.

  • And the main.qml:

    import QtQuick 2.7
    import QtQuick.Controls 2.0
    import QtQuick.Layouts 1.3
    import "myStyle"

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

    Rectangle {     
        Button {
            id: button1
            x: 256
            y: 86
            text: qsTr("Press Me")


  • Sorry, i forgot this information .

    My Computer has Windows 10 installed.

    We run the app under Msys64 with mingw32 started.
    Qt has the version 5.9.2


Log in to reply