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. Transform only parent Item
Forum Updated to NodeBB v4.3 + New Features

Transform only parent Item

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 3 Posters 3.1k 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.
  • S Offline
    S Offline
    sabrog
    wrote on last edited by
    #1

    How to transform only parent item without affection on children?

    For example

    @
    Rectangle {
    id: panel
    width: 400
    height: 200
    x: parent.right-width/2
    color: "white"
    anchors.bottom: parent.bottom
    clip: true

            transform: Rotation {
                origin.x: page.width; origin.y: page.height; axis {x:0; y:0; z:1} angle:0
                NumberAnimation on angle  {
                    from: 0; to: 90;
                    duration: 3000;
                    loops: Animation.Infinite
                }
            }
    
            Image {
                id: image1
                x: 16
                y: 27
                source: "images/qt.svg"
            }
        }
    

    @

    I don't want rotate Qt logo, just stick in "World Position" and hide when parent bounding box live this coordinates.

    QT - Apple QuickTime
    Qt - Nokia's Qt Development Frameworks
    Apple is a competitor of Nokia, so QT != Qt

    1 Reply Last reply
    0
    • M Offline
      M Offline
      moo1
      wrote on last edited by
      #2

      Can you make the rectangle and the image sibling instead of parent-child? Then, the transform to the rect doesn't affect to the image.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        sabrog
        wrote on last edited by
        #3

        [quote author="moo1" date="1299195108"]Can you make the rectangle and the image sibling instead of parent-child? Then, the transform to the rect doesn't affect to the image.[/quote]

        No, I need "clip: true".

        QT - Apple QuickTime
        Qt - Nokia's Qt Development Frameworks
        Apple is a competitor of Nokia, so QT != Qt

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

          You could place the Image at the appropriate offset on a transparent rectangle (or perhaps just a plain Item element) which was anchored at the exact point of panel's rotation, then set the transparent container's rotation to the opposite of pane's (container.rotation: -panel.rotation).

          Software Engineer
          My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

          1 Reply Last reply
          0
          • S Offline
            S Offline
            sabrog
            wrote on last edited by
            #5

            [quote author="mlong" date="1299275809"]You could place the Image at the appropriate offset on a transparent rectangle (or perhaps just a plain Item element) which was anchored at the exact point of panel's rotation, then set the transparent container's rotation to the opposite of pane's (container.rotation: -panel.rotation).[/quote]

            Thanks, it's working
            @
            import QtQuick 1.0

            Rectangle {
            id: mainRec
            width: 600
            height: 600
            color: "grey"

            Rectangle {
                id: page
                anchors.centerIn: parent
                color: "black"
                width: 200
                height: 400
                clip: true
            
                Rectangle {
                    id: pane
                    width: 400
                    height: 400
                    x: parent.right-width/2
                    color: "white"
                    clip: true
            
                    anchors.bottom: parent.bottom
                    transformOrigin: Item.Bottom
            
                    NumberAnimation on rotation {
                        from: 0; to: 90
                        duration: 3000
                        loops: Animation.Infinite
                    }
            
                    Item {
                        id: container
                        width: pane.width
                        height: pane.height
                        anchors.bottom: parent.bottom
                        transformOrigin: Item.Bottom
                        rotation: -parent.rotation
            
                        Image {
                            id: image1
                            x: 16
                            y: 27
                            source: "images/qt.svg"
                        }
                    }
                }
            }
            

            }

            @

            QT - Apple QuickTime
            Qt - Nokia's Qt Development Frameworks
            Apple is a competitor of Nokia, so QT != Qt

            1 Reply Last reply
            0
            • S Offline
              S Offline
              sabrog
              wrote on last edited by
              #6

              But there other problem, how to prevent from moving "container", if parent draggable.

              QT - Apple QuickTime
              Qt - Nokia's Qt Development Frameworks
              Apple is a competitor of Nokia, so QT != Qt

              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