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. [Solved]Crash application with ButtonStyle QtQuickControls
Forum Updated to NodeBB v4.3 + New Features

[Solved]Crash application with ButtonStyle QtQuickControls

Scheduled Pinned Locked Moved QML and Qt Quick
16 Posts 2 Posters 3.3k Views 1 Watching
  • 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.
  • N Offline
    N Offline
    Nexelen
    wrote on last edited by
    #1

    Hello. I tried use QtQuickControls Button with ButtonStyle (QtQuick.Controls.Styles). When programm start, it crash. (System: Windows 8.1 Qt: 5.2.1 mingw48)
    But without ButtonStyle(with standart Button) programm work.
    !http://puu.sh/7kURW.jpg(work)!
    how I can repair it? "Sources":https://github.com/nexelen/Qt5OpenGLStudy/tree/cube

    -----------Updated-------------------
    solution:
    Use Qt5.3 . I think its build bug.

    1 Reply Last reply
    0
    • O Offline
      O Offline
      onek24
      wrote on last edited by
      #2

      Hello,

      • could you please translate us the error into english?
      • Also i couldn't find any buttons in the main.qml Could you please provide us the Button with the ButtonStyle?
      • And is there any debug/console output?
      1 Reply Last reply
      0
      • N Offline
        N Offline
        Nexelen
        wrote on last edited by
        #3

        [quote author="onek24" date="1394104333"]Hello,

        • could you please translate us the error into english?
        • Also i couldn't find any buttons in the main.qml Could you please provide us the Button with the ButtonStyle?
        • And is there any debug/console output?[/quote]

        Ooops, sorry! :D main: "Application "OpenGLStudy" don't work"

        Sure! In cube branch. Update post

        @The program has unexpectedly finished.

        E:\Studing\QtStudy\build-OpenGLStudy-Desktop_Qt_5_2_1_MinGW_32bit-Debug\debug\OpenGLStudy.exe crashed@
        When debug programm it stop in:
        !http://puu.sh/7kVIw.png(stop)!
        !http://puu.sh/7kVKf.png(dll)!

        1 Reply Last reply
        0
        • O Offline
          O Offline
          onek24
          wrote on last edited by
          #4

          Alright, the button works here. Could you please change the line where
          @text: "A button"@
          into
          @text: qsTr("A button")@
          so the button with the custom stylesheet looks like:
          @ Button {
          text: qsTr("A button")
          style: ButtonStyle {
          background: Rectangle {
          implicitWidth: 100
          implicitHeight: 25
          border.width: control.activeFocus ? 2 : 1
          border.color: "#888"
          radius: 4
          gradient: Gradient {
          GradientStop { position: 0 ; color: control.pressed ? "#ccc" : "#eee" }
          GradientStop { position: 1 ; color: control.pressed ? "#aaa" : "#ccc" }
          }
          }
          }
          }@

          1 Reply Last reply
          0
          • N Offline
            N Offline
            Nexelen
            wrote on last edited by
            #5

            [quote author="onek24" date="1394105763"]
            @text: qsTr("A button")@
            [/quote]
            don't work
            This button work without text =(
            !http://puu.sh/7kWuG.jpg(stylebut)!

            1 Reply Last reply
            0
            • O Offline
              O Offline
              onek24
              wrote on last edited by
              #6

              Well i was like 99% sure that the text is the problem due to the fact that it crashes in msvcrt. qStr() was a typo, it is false and has to be qsTr().
              I'll see what i can find, give me a second please.

              --Attach--
              Could you please try the text with an empty string?:
              @text: ""
              text: qsTr("")@

              1 Reply Last reply
              0
              • N Offline
                N Offline
                Nexelen
                wrote on last edited by
                #7

                [quote author="onek24" date="1394106796"]
                Could you please try the text with an empty string?:
                @text: ""
                text: qsTr("")@[/quote]
                Its work.

                1 Reply Last reply
                0
                • O Offline
                  O Offline
                  onek24
                  wrote on last edited by
                  #8

                  -- delete --

                  1 Reply Last reply
                  0
                  • O Offline
                    O Offline
                    onek24
                    wrote on last edited by
                    #9

                    Yes that happens because of:

                    bq. If strCharSet points to a string of zero length, the function returns string.
                    Reference: "strstr":http://msdn.microsoft.com/en-us/library/aa273008(v=vs.60).aspx

                    It looks like in line 0x76d2d88b it nulls al and tries to copy it(null) into edi in line 0x76d2d89f. Maybe the nulling happens because the stylesheet requires a own Text for it so your text moves into no Text or null. Could you please try this workaround:
                    @ Button {
                    style: ButtonStyle {
                    background: Rectangle {
                    implicitWidth: 100
                    implicitHeight: 25
                    border.width: control.activeFocus ? 2 : 1
                    border.color: "#888"
                    radius: 4
                    gradient: Gradient {
                    GradientStop { position: 0 ; color: control.pressed ? "#ccc" : "#eee" }
                    GradientStop { position: 1 ; color: control.pressed ? "#aaa" : "#ccc" }
                    }
                    Text {
                    text: "A button"
                    anchors.fill: parent
                    horizontalAlignment: Text.AlignHCenter
                    verticalAlignment: Text.AlignVCenter
                    }
                    }
                    }
                    }@
                    or this one:
                    @ Button {
                    style: ButtonStyle {
                    background: Rectangle {
                    implicitWidth: 100
                    implicitHeight: 25
                    border.width: control.activeFocus ? 2 : 1
                    border.color: "#888"
                    radius: 4
                    gradient: Gradient {
                    GradientStop { position: 0 ; color: control.pressed ? "#ccc" : "#eee" }
                    GradientStop { position: 1 ; color: control.pressed ? "#aaa" : "#ccc" }
                    }
                    }
                    }
                    Text {
                    text: "A button"
                    anchors.fill: parent
                    horizontalAlignment: Text.AlignHCenter
                    verticalAlignment: Text.AlignVCenter
                    }
                    }@

                    1 Reply Last reply
                    0
                    • N Offline
                      N Offline
                      Nexelen
                      wrote on last edited by
                      #10

                      [quote author="onek24" date="1394108948"]
                      @Button {
                      style: ButtonStyle {
                      background: Rectangle {
                      implicitWidth: 100
                      implicitHeight: 25
                      border.width: control.activeFocus ? 2 : 1
                      border.color: "#888"
                      radius: 4
                      gradient: Gradient {
                      GradientStop { position: 0 ; color: control.pressed ? "#ccc" : "#eee" }
                      GradientStop { position: 1 ; color: control.pressed ? "#aaa" : "#ccc" }
                      }
                      Text {
                      text: "A button"
                      anchors.fill: parent
                      horizontalAlignment: Text.AlignHCenter
                      verticalAlignment: Text.AlignVCenter
                      }
                      }
                      }
                      }@
                      [/quote]

                      Of course its work, but... its like hack :D. Anyway thanks. I think its bug.

                      1 Reply Last reply
                      0
                      • O Offline
                        O Offline
                        onek24
                        wrote on last edited by
                        #11

                        [quote author="Nexelen" date="1394110035"]
                        Of course its work, but... its like hack :D. Anyway thanks. I think its bug. [/quote]
                        Well it's the only solution/workaround i know. Also its not a hack, it's an improvement because you can format the text further, like with font.pixelsize: and so on.

                        1 Reply Last reply
                        0
                        • N Offline
                          N Offline
                          Nexelen
                          wrote on last edited by
                          #12

                          [quote author="onek24" date="1394108948"]
                          It looks like in line 0x76d2d88b it nulls al and tries to copy it(null) into edi in line 0x76d2d89f. Maybe the nulling happens because the stylesheet requires a own Text for it so your text moves into no Text or null. [/quote]

                          I dont understand why it use library for 64-bit application... For 32-bit library in forlder System32.

                          1 Reply Last reply
                          0
                          • O Offline
                            O Offline
                            onek24
                            wrote on last edited by
                            #13

                            I don't know eather, sorry.

                            So the workaround works and you are using it? If you find the solution or why the error occures please provide us the answer, thank you.

                            1 Reply Last reply
                            0
                            • N Offline
                              N Offline
                              Nexelen
                              wrote on last edited by
                              #14

                              [quote author="onek24" date="1394115182"]
                              So the workaround works and you are using it? [/quote]
                              Yep. Thank you =). Ill try build Qt5.3 also I will look as there.

                              1 Reply Last reply
                              0
                              • O Offline
                                O Offline
                                onek24
                                wrote on last edited by
                                #15

                                You're welcome, glad i could help you with that. :)
                                You could report this bug to "Bugreports":https://bugreports.qt-project.org/secure/Dashboard.jspa . Maybe it'll help you or other people.

                                1 Reply Last reply
                                0
                                • N Offline
                                  N Offline
                                  Nexelen
                                  wrote on last edited by
                                  #16

                                  In Qt5.3 (mscv2013-64bit) its works :)

                                  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