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. QML flipable messes up my opacity
Qt 6.11 is out! See what's new in the release blog

QML flipable messes up my opacity

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.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.
  • L Offline
    L Offline
    Lyven
    wrote on last edited by
    #1

    Dear All

    @Flipable{
    id: sheet;

         anchors.fill: parent;
         anchors.leftMargin: 100;
         anchors.topMargin: 20;
         anchors.rightMargin: 20;
         anchors.bottomMargin: 20;
    
         property bool flipped: false;
    
    
    
         front: Rectangle{
             id: frontRect;
             anchors.fill: parent;
             radius: 10;
             color: "#FFFFFF";
             opacity: 0.7;
    
    
         }
    
    
         back: Rectangle{
             id: backRect;
             anchors.fill: parent;
             radius: 10;
             color: "#FFFFFF";
             opacity: 0.7;
    
    
         }
    
    
         transform: Rotation {
            id: rotation;
            origin.x: sheet.width / 2;
            origin.y: sheet.height / 2;
            axis: Qt.vector3d(0, 1, 0);
            angle: 0;    // the default angle
         }
    
         states: State {
             name: "back";
             PropertyChanges {
                 target: rotation;
                 angle: 180
             }
    
             when: sheet.flipped
         }
    
         transitions: Transition {
             NumberAnimation { target: rotation; property: "angle"; duration: 450 }
         }
    
         MouseArea {
             anchors.fill: parent
             onClicked: sheet.flipped = !sheet.flipped
         }@
    

    I try this according to the textbook :) but when loading my rectangle is indeed 0.7 opac, but when flipped it goes to 1.0, and when flipping back stays at 1.0. What am i doing wrong here?

    kind regards

    Lieven

    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