Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Crashing Application at Application Exit

Crashing Application at Application Exit

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
7 Posts 2 Posters 982 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    marcus_1
    wrote on last edited by
    #1

    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.

    [0_1525435415456_template_button_test.zip](Uploading 100%)

    Greetings

    M 1 Reply Last reply
    0
    • M marcus_1

      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.

      [0_1525435415456_template_button_test.zip](Uploading 100%)

      Greetings

      M Offline
      M Offline
      marcus_1
      wrote on last edited by
      #2

      @marcus_1

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

      1 Reply Last reply
      0
      • jpnurmiJ Offline
        jpnurmiJ Offline
        jpnurmi
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0
        • M Offline
          M Offline
          marcus_1
          wrote on last edited by
          #4

          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")
              switch(currentState)
              {
              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")
                  break;
              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
                  break;
              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")
                  break;
              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")
                  break;
              default:
                  console.error("Button currentstate ist not specified.")
                  break;
              }
          }
          
          property double value1: 0.00
          
          NumberAnimation on value1 {
              from: 0.00;
              to: 1.00;
              loops: Animation.Infinite;
              duration: 8000
              running: true
          }
          
          ConicalGradient
          {
              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: ""
                  }
              }
          }
          

          }

          1 Reply Last reply
          0
          • jpnurmiJ Offline
            jpnurmiJ Offline
            jpnurmi
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            1
            • M Offline
              M Offline
              marcus_1
              wrote on last edited by
              #6

              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")
                  }
              }
              

              }

              1 Reply Last reply
              0
              • M Offline
                M Offline
                marcus_1
                wrote on last edited by
                #7

                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

                Greetings

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved