Results 1 to 3 of 3

Thread: Dynamic sizes in QtQuick 2.0 application

  1. #1
    Join Date
    May 2010
    Location
    Rousse, Bulgaria
    Posts
    25
    Thanks
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Question Dynamic sizes in QtQuick 2.0 application

    Hello,

    I'm struggling to grasp the concept behind QtQuick.Layouts.
    I want to create a 3 column UI that fills up the window without setting fixed sizes. Then in each column there should be multiple rows with no fixed widths.
    So far, I have been unable to achieve this with the code below, instead it shows 3 red, green, blue columns next to each other. Is there some Layout limitation in place or the whole solution is wrong and I should use other means to achieve this?
    All the examples I found use a fixed width/height, but that doesn't work for my goal.
    Thank you!

    view.qml
    Qt Code:
    1. Import QtQuick 2.2
    2. Import QtQuick.Layouts 1.0
    3.  
    4. RowLayout {
    5. spacing: 2
    6.  
    7. Rectangle {
    8. Layout.fillWidth: true
    9. Layout.fillHeight: true
    10. color: "red"
    11.  
    12. ColumnLayout {
    13. spacing: 2
    14.  
    15. Rectangle {
    16. Layout.fillWidth: true
    17. height: 32
    18. color: "black"
    19. }
    20. Rectangle {
    21. Layout.fillWidth: true
    22. height: 32
    23. color: "yellow"
    24. }
    25. Rectangle {
    26. Layout.fillWidth: true
    27. height: 32
    28. color: "pink"
    29. }
    30. Rectangle {
    31. Layout.fillWidth: true
    32. height: 32
    33. color: "brown"
    34. }
    35. }
    36. }
    37.  
    38.  
    39. Rectangle {
    40. Layout.fillWidth: true
    41. Layout.fillHeight: true
    42. color: "green"
    43. }
    44.  
    45.  
    46. Rectangle {
    47. Layout.fillWidth: true
    48. Layout.fillHeight: true
    49. color: "blue"
    50. }
    51. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Dynamic sizes in QtQuick 2.0 application

    What is the output you expect and how does it differ from what you achieve right now? Aren't you missing an "anchors.fill: parent" binding in the column layout? Right now you layout has null size.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    Axtroz (23rd March 2015)

  4. #3
    Join Date
    May 2010
    Location
    Rousse, Bulgaria
    Posts
    25
    Thanks
    9
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Dynamic sizes in QtQuick 2.0 application

    Oh wow, this was embarassing. I've been overlooking that half the day. I guess one could go so on on coffee only. Thank you once again for taking the time to answer my (obvious and ignorant) question.

Similar Threads

  1. libGL/QOpenGLShader errors when starting QtQuick application
    By JamesNZ in forum Installation and Deployment
    Replies: 0
    Last Post: 2nd January 2015, 05:10
  2. qtquick application event handling from c++ class
    By nikhil.patil2010 in forum Qt Quick
    Replies: 1
    Last Post: 19th March 2014, 08:51
  3. Replies: 3
    Last Post: 6th March 2014, 10:09
  4. How to create a QtQuick 1 Application project?
    By TheIndependentAquarius in forum Qt Tools
    Replies: 1
    Last Post: 23rd October 2013, 11:02
  5. Blank screen with a QtQuick application (with Qt 5.1 not with Qt5.0.2)
    By slimittn in forum Installation and Deployment
    Replies: 1
    Last Post: 29th June 2013, 08:47

Tags for this Thread

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.