Results 1 to 2 of 2

Thread: How to change Rectangle height that is inside a ColumnLayout?

  1. #1
    Join Date
    Nov 2014
    Posts
    33
    Thanks
    1
    Qt products
    Qt5
    Platforms
    Windows Android

    Default How to change Rectangle height that is inside a ColumnLayout?

    I've this code:

    Qt Code:
    1. import QtQuick 2.5
    2. import QtQuick.Layouts 1.1
    3. import QtQuick.Controls 1.4
    4. ColumnLayout {
    5. spacing: 0
    6. Rectangle {
    7. Layout.fillWidth: true
    8. height: 30
    9. color: "blue"
    10. Button {
    11. text: "expand"
    12. onClicked: r.height = 50
    13. }
    14. }
    15. Rectangle {
    16. id: r
    17. Layout.fillWidth: true
    18. height: 20
    19. color: "red"
    20. }
    21. Rectangle {
    22. Layout.fillWidth: true
    23. Layout.fillHeight: true
    24. color: "lightgray"
    25. }
    26. }
    To copy to clipboard, switch view to plain text mode 

    When the button is pushed, the Rectangle r doesn't change the height. However, if the last Rectangle is changed by an Item, the height is changed.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: How to change Rectangle height that is inside a ColumnLayout?

    Interesting.
    The height changes but the layout doesn't update.

    But it works if you use "implicitHeight" instead of "height" for the red rectangle

    Cheers,
    _

Similar Threads

  1. Replies: 7
    Last Post: 24th January 2016, 22:43
  2. How change selected item rectangle on QGraphicsScene
    By xray2000 in forum Qt Programming
    Replies: 1
    Last Post: 18th May 2010, 17:43
  3. Replies: 2
    Last Post: 29th March 2010, 13:34
  4. Replies: 1
    Last Post: 23rd January 2010, 14:16
  5. QGraphicsView : change selected rectangle style
    By kghose in forum Qt Programming
    Replies: 2
    Last Post: 28th July 2008, 19:12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.