Results 1 to 4 of 4

Thread: QGridLayout or QFormLayout like Grid in QML

  1. #1
    Join Date
    Dec 2011
    Posts
    21
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default QGridLayout or QFormLayout like Grid in QML

    I'm using QML Desktop Components 0.1 with QtQuick 1.1.
    I'm wondering how to make in QML layout of items that behaves the same as QGridLayout or QFormLayout.
    There is Grid, but items within it don't scale to fill the grid.

    I need to make form like layout so there are labels and text fields. Text fields should resize to fill parent (window resize).
    There anchors, but for eg, i have 20 text areas with labels and I don't want to set anchor for every single item ... It's not efficient.

    How to do that properly with QML?

  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: QGridLayout or QFormLayout like Grid in QML

    Grid should work fine. Just make sure you anchor it properly.
    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. #3
    Join Date
    Dec 2011
    Posts
    21
    Thanks
    2
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QGridLayout or QFormLayout like Grid in QML

    Unfortunately not: https://qt-project.org/doc/qt-4.8/qm...ml#limitations
    When I'm using anchors warnings are printed in console and not always everything works as it should ...

  4. #4
    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: QGridLayout or QFormLayout like Grid in QML

    You can always do something like this:

    javascript Code:
    1. Rectangle {
    2. width: 360
    3. height: 360
    4. Column {
    5. id: c1
    6. width: 0.5*parent.width
    7. anchors.left: parent.left
    8. Rectangle { color: "red"; height: 200; width: parent.width}
    9. }
    10. Column {
    11. id: c2
    12. anchors.left: c1.right
    13. anchors.right: parent.right
    14. Rectangle { color: "blue"; height: 200; width: parent.width }
    15. }
    16. }
    To copy to clipboard, switch view to plain text mode 
    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.


Similar Threads

  1. How to extract data from QFormLayout?
    By szisziszilvi in forum Qt Programming
    Replies: 5
    Last Post: 17th May 2011, 09:18
  2. Make QVBoxLayout act like QFormLayout
    By petwoip in forum Qt Programming
    Replies: 7
    Last Post: 9th March 2011, 21:13
  3. remove row of QFormLayout
    By jorg in forum Newbie
    Replies: 1
    Last Post: 31st January 2011, 05:19
  4. qformlayout: no addSpacing?
    By mattc in forum Qt Programming
    Replies: 0
    Last Post: 11th October 2009, 19:30
  5. Delete a QGridLayout and New QGridLayout at runtime
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 5th November 2007, 13:01

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.