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. Mirroring in Flipable
Forum Updated to NodeBB v4.3 + New Features

Mirroring in Flipable

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 2.7k 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.
  • G Offline
    G Offline
    gustavo
    wrote on last edited by
    #1

    I'm trying to use Flipable's back to draw some elements (text, rectangles...). Based on examples distributed with Qt code, I've done something like this:

    @
    Flipable {
    id: flipable
    back: Rectangle {
    Text {
    text: 'some text'
    }
    }

    transform: Rotation {
        id: rotation
        origin.x: flipable.width/2
        axis { y: 1; z: 0 }
    }
    
    states: State {
        name: 'back'
        PropertyChanges {
            target: rotation
            angle: 180
        }
    }
    

    }
    @

    My problem is that the elements disposed in the back of the Flipable are being displayed mirrored, and this is a big problem, specially for text.

    What is getting me confused is that the examples in Qt code don't seem to have the same problem. Am I doing something wrong?

    Thanks

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

      Hi,

      The Rectangle used for "back" doesn't have a geometry set (it is 0x0), which seems to be what is causing the issue for Flippable. It you give it an explicit size (or size it to the Text item, etc), it should work properly.

      Regards,
      Michael

      1 Reply Last reply
      0
      • G Offline
        G Offline
        gustavo
        wrote on last edited by
        #3

        Wow! I would never find it by myself! Thanks, Michael!

        Is that behaviour intentional? Or is it more like a bug?
        I'm asking it because it seems to be counterintuitive (at least for me) that a non-declared geometry property on a component has the side effect of a mirroring in it and its children. Why is it like this?

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

          Hi,

          We calculate the transform for the back item by rotating it around the center x- and y-axis of the item. When the item has no geometry, the center is (0,0), which leads to flips. I'm not sure if there is a better method that could be used -- it certainly isn't intuitive to track down what's going wrong when you do hit this issue.

          Regards,
          Michael

          1 Reply Last reply
          0
          • G Offline
            G Offline
            gustavo
            wrote on last edited by
            #5

            Hmm... I see. It does make sense after all, although it isn't really intuitive.

            Thanks for your help

            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