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. [SOLVED] QML Column - how to prevent default functionality

[SOLVED] QML Column - how to prevent default functionality

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 2.7k Views
  • 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
    supaukko
    wrote on 25 Nov 2011, 11:09 last edited by
    #1

    Hi!

    Is there a way to overwrite the default functionality when Column's child goes fully transparent (no transitions)?

    Here is an example code that describes the problem, hopefully (see removeBtn's onClicked slot):
    @
    import QtQuick 1.1
    Rectangle {
    width: 360
    height: 360
    id: window

    Column {
         id: column
    
         property int itemCount: window.inPortrait ? 2 : 4
         property int rectangleHeight: Math.round(column.height / itemCount)
    
         anchors.fill: parent
         anchors.margins:  1
         Rectangle {
             id: red
             width: column.width; height: column.rectangleHeight
             color: "red"
             border.color: "white"
             radius: 15
         }
         Rectangle {
             id: green
             width: column.width; height: column.rectangleHeight
             color: "green"
             border.color: "white"
             radius: 15
         }
         Rectangle {
             id: blue
             width: column.width; height: column.rectangleHeight
             color: "blue"
             border.color: "white"
             radius: 15
         }
     }
    
     Row {
    
         spacing: 10
         anchors.bottom: parent.bottom
         Rectangle {
             width: txtAdd.width + 10
             height: txtAdd.height + 10
             Text {
                 id: txtAdd
                 text: qsTr("Add")
                 anchors.centerIn: parent
             }
             MouseArea {
                 anchors.fill: parent
                 onClicked: {
                     green.opacity = 1;
                 }
             }
         }
         Rectangle {
             id: removeBtn
             anchors.bottom: parent.bottom
             width: txtRem.width + 10
             height: txtRem.height + 10
             Text {
                 id: txtRem
                 text: qsTr("Remove")
                 anchors.centerIn: parent
             }
             MouseArea {
                 anchors.fill: parent
                 onClicked: {
                     // Should be like this green.opacity = 0
                     green.opacity = 0.000001;
                 }
             }
         }
     }
    

    }
    @


    I found the solution..just by "wrapping" a rectangle under a parent item would do the trick:
    @
    Item {
    width: red.width; height: red.height;

    Rectangle {
             id: red
    }
    

    }

    1 Reply Last reply
    0

    1/1

    25 Nov 2011, 11:09

    • Login

    • Login or register to search.
    1 out of 1
    • First post
      1/1
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved