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. How set position for Dialog in Qt Quick Controls 2 ?
Forum Updated to NodeBB v4.3 + New Features

How set position for Dialog in Qt Quick Controls 2 ?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 3 Posters 4.1k Views 1 Watching
  • 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
    sardar
    wrote on 1 Oct 2016, 11:35 last edited by A Former User 11 Jun 2016, 09:49
    #1

    hi
    i want to use dialog in Qt Quick Controls 2 added in Qt 5.8, but for open dialog in center of page you must use x,y.
    Gallery Sample :

        Dialog {
            id: aboutDialog
            modal: true
            focus: true
            x: (window.width - width) / 2
            y: window.height / 6
            width: Math.min(window.width, window.height) / 3 * 2
            contentHeight: aboutColumn.height
    
            Column {
                id: aboutColumn
                spacing: 20
    
                Label {
                    text: "About"
                    font.bold: true
                }
    
                Label {
                    width: aboutDialog.availableWidth
                    text: "The Qt Quick Controls 2 module delivers the next generation user interface controls based on Qt Quick."
                    wrapMode: Label.Wrap
                    font.pixelSize: 12
                }
            }
        }
    

    i want to use ant way for opening dialog in center of page , have any property for this?
    thanks.

    1 Reply Last reply
    1
    • J Offline
      J Offline
      jpnurmi
      wrote on 4 Nov 2016, 23:33 last edited by jpnurmi 11 May 2016, 09:40
      #2

      The coordinates are relative to the parent. You can set ApplicationWindow.overlay as a parent to use scene coordinates.

      Dialog {
          x: (window.width - width) / 2
          y: (window.height - height) / 2
          parent: ApplicationWindow.overlay
      }
      
      1 Reply Last reply
      7
      • I Offline
        I Offline
        itfanr
        wrote on 17 Feb 2020, 03:30 last edited by
        #3

        Thank you

        1 Reply Last reply
        0

        • Login

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