Help...Image on Qt for Symbian is not showing



  • Guys, please help...I wrote this code

    @

        TextField {
            id: txtInput
            x: 3
            y: 92
            anchors.left: parent.left
            anchors.leftMargin: 3
            anchors.bottom: parent.bottom
            anchors.bottomMargin: 498
            anchors.top: parent.top
            anchors.topMargin: 92
            anchors.right: parent.right
            anchors.rightMargin: -3
            maximumLength: 10
            readOnly: false
            platformLeftMargin: 3
    
            Image {
                     anchors { top: parent.top; right: parent.right; margins: platformStyle.paddingMedium }
                     id: clearText
                     fillMode: Image.PreserveAspectFit
                     smooth: true; visible: clearable.text
                     source: "image://MyResources/equal.png"  //problem
                     height: parent.height - platformStyle.paddingMedium * 2
                     width: parent.height - platformStyle.paddingMedium * 2
    
                     MouseArea {
                         id: clear
                         anchors { horizontalCenter: parent.horizontalCenter; verticalCenter: parent.verticalCenter }
                         height: clearable.height; width: clearable.height
                         onClicked: {
                             clearable.text = ""
                             clearable.forceActiveFocus()
                         }
                     }
                 }
    

    @

    I am having problem with using my image "clear_left.png" I added to my Resources "myResources"
    !Libraries\Pictures\qt.png(image)!

    and also "onClicked:{}" is not working :(


  • Moderators

    Your sample image isn't visible. Check the path.

    What is clearable and where is it defined? When you say onClicked isn't working, what is happening?

    Also, your source for your image is wrong for a resource. Is "myResources" the name of your resource file? Or is a prefix in the resource file?
    try:
    @
    source: ":/someoptionalprefixintheqrcfile/equal.png"
    @
    or
    @
    source: "qrc:/someoptionalprefixintheqrcfile/equal.png"
    @
    (assuming the resource file path has a prefix. Otherwise just ":/equal.png" or "qrc:/equal.png")

    (Brain to terminal. YMMV)



  • Thanks for your reply.
    I just tried both of your given options, it is not still working. The following are what I am using
    @source: "://equal.png"@

    resource name is "myResource"
    prefix is "/"
    And the "onClicked" should clear a TextField


Log in to reply
 

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