[Solved]Crash application with ButtonStyle QtQuickControls



  • 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.



  • 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 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)!



  • 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" }
    }
    }
    }
    }@



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



  • 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("")@



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



  • -- delete --



  • 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
    }
    }@



  • [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.



  • [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.



  • [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.



  • 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.



  • [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.



  • 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.



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.