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. Image movement
Qt 6.11 is out! See what's new in the release blog

Image movement

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 758 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.
  • D Offline
    D Offline
    Darq
    wrote on last edited by
    #1

    Hello

    I want to edit the code that calls the icon. The editing is to move the developed image (icon) to the right and left from the designated image anchor point. The code specifies several images (I have, for example, 4 icons in a line and depending on which one is pressed, it should move). The icon has several states, i.e. the basic part of the name is constant, e.g. settings. States (different colors of icons) have names such as settings_activ, settings_inactiv, settings_selected, etc. How to make an icon in the _selected state move, and not move in other states?

            HmiImage {
                id: Icon
                property string postfix: "_active"
                width: 160
                height: 120
                anchors.centerIn: parent
    
                source: _private.getDelegateIcon(moduleDomain, iconUrl, postfix)
                fillMode: Image.PreserveAspectFit
                smooth: true
            }
    
            states : [
                State {
                    name:"activepressed"
                    when: !isActiveDomain && itemMouseArea.pressed
                    PropertyChanges {target: Icon; postfix: "_activepressed"}
                },
                State {
                    name:"pressed"
                    when: isActiveDomain && itemMouseArea.pressed
                    PropertyChanges {target: Icon; postfix: "_selectedpressed"}
                },
                State {
                    name:"selected"
                    when: isActiveDomain
                    PropertyChanges {target: Icon; postfix: "_selected"}
                },
                State {
                    name:"active"
                    when: !isActiveDomain
                    PropertyChanges {target: Icon; postfix: "_active"}
                }
            ]
    
    1 Reply Last reply
    0
    • fcarneyF Offline
      fcarneyF Offline
      fcarney
      wrote on last edited by
      #2
      PropertyChanges {target: Icon; postfix: "_activepressed"; x: 10; y: -5}
      

      Just provide x and y values for moving it around. When state is no longer in affect it will pop back to default.

      C++ is a perfectly valid school of magic.

      D 1 Reply Last reply
      0
      • fcarneyF fcarney
        PropertyChanges {target: Icon; postfix: "_activepressed"; x: 10; y: -5}
        

        Just provide x and y values for moving it around. When state is no longer in affect it will pop back to default.

        D Offline
        D Offline
        Darq
        wrote on last edited by
        #3

        @fcarney Unfortunately, specifying x and y values does not make the png file move or shift it.

        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