Results 1 to 4 of 4

Thread: Qt Quick Components - layout of Dialog

  1. #1
    Join Date
    Aug 2011
    Location
    Denmark
    Posts
    11
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Qt Quick Components - layout of Dialog

    I try to make a Dialog, but I have problems making in look properly. It simply should display two buttons placed in each half of the screen. I haven't been able to find any relevant examples. The only way I can make it work is by placing the two buttons inside a Row, but then the buttons are piled up in the left side of the screen (since this is the way a Row works). I have tried other solutions such as placing the buttons inside an Item, but then only one button is showed!

    Can anyone show me a basic code example of a Dialog with two buttons?

  2. #2
    Join Date
    Jul 2011
    Posts
    11
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Re: Qt Quick Components - layout of Dialog

    Check the row example in this link: http://doc.qt.nokia.com/4.7-snapshot...html#repeaters
    the solution is in how you anchor the buttons to the parent row

    or you can also try inserting 2 columns as children within the row and then each button would be a child of a column

    or you can use a grid (which is the same as the previous solution only easier)

    Good Luck

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

    finngruwier (2nd September 2011)

  4. #3
    Join Date
    Aug 2011
    Location
    Denmark
    Posts
    11
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: Qt Quick Components - layout of Dialog

    Thanks for the input. I actually ended up with a different solution. Here's my code for the dialog:

    Qt Code:
    1. Dialog {
    2. id: exitDialog
    3. anchors.centerIn: parent
    4. title: [
    5. Text {
    6. anchors.top: parent.top
    7. anchors.topMargin: 10
    8. anchors.left: parent.left
    9. anchors.leftMargin: 10
    10. font.bold: true
    11. color: "white"
    12. text: "Keep list?"
    13. }
    14. ]
    15. content: [
    16. Button {
    17. anchors.left: parent.left
    18. anchors.leftMargin: 50
    19. anchors.verticalCenter: parent.verticalCenter
    20. text: "Yes"
    21. },
    22. Button {
    23. anchors.right: parent.right
    24. anchors.rightMargin: 50
    25. anchors.verticalCenter: parent.verticalCenter
    26. text: "No"
    27. }
    28. ]
    29. }
    To copy to clipboard, switch view to plain text mode 

  5. #4
    Join Date
    Jul 2011
    Posts
    11
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Re: Qt Quick Components - layout of Dialog

    That's the beauty of QML..there's always a ton of solutions

Similar Threads

  1. Replies: 1
    Last Post: 10th April 2011, 11:34
  2. Resizeable Dialog/Layout (like Dolphin)
    By kiss-o-matic in forum Qt Programming
    Replies: 2
    Last Post: 20th December 2009, 23:18
  3. Resizing dialog with form layout
    By elizabeth.h1 in forum Qt Programming
    Replies: 2
    Last Post: 30th August 2009, 19:58
  4. Resize all components in a dialog
    By bdQtdev in forum Qt Tools
    Replies: 5
    Last Post: 10th January 2008, 10:13
  5. QT4 layout of complex dialog is very slow
    By cboles in forum Qt Programming
    Replies: 15
    Last Post: 28th April 2006, 19:57

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.