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. Dialog containing RowLayout not having correct window size
Forum Updated to NodeBB v4.3 + New Features

Dialog containing RowLayout not having correct window size

Scheduled Pinned Locked Moved Solved QML and Qt Quick
7 Posts 2 Posters 1.4k 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.
  • T Offline
    T Offline
    topse
    wrote on last edited by topse
    #1

    Hi,
    Sorry -- I really dont get it. Strong feeling of beeing dump :-/

    I want to create a Dialog with QML containing a RowLayout but when showing the dialog, the window size is not corrent.

    The Dialog looks like that (its the best result I got after several combinations with width, implicitWidth and Layout.fill):

    Picture Here

    import QtQuick 2.2
    import QtQuick.Controls 1.2
    import QtQuick.Layouts 1.1
    import QtQuick.Dialogs 1.2
    
    Dialog {
      id: kursDialog
    
      standardButtons: StandardButton.Cancel | StandardButton.Ok
    
      Item {
        id: item
    
        RowLayout {
          id: layout
    
          Text {
            id: label1
            text: "Name des Kurses: "
          }
    
          TextField {
            id: nameField
            placeholderText: "Name des Kurses"
          }
        }
      }
    }
    

    Can anyone give me a hint, what is going wrong here?

    Thanks and Best Regards,
    Tobias

    1 Reply Last reply
    0
    • X Offline
      X Offline
      xargs1
      wrote on last edited by
      #2

      Your Item has no width/height, so the Dialog might have trouble laying it out. You could get rid of the Item, or give it a size. This works for me:

      Dialog {
              standardButtons: StandardButton.Cancel | StandardButton.Ok
              width: 300
      
              Item {
                  width: childrenRect.width
                  height: childrenRect.height
      
                  RowLayout {
                      Text { text: "Name des Kurses: " }
                      TextField { placeholderText: "Name des Kurses" }
                  }
       }
      
      1 Reply Last reply
      0
      • T Offline
        T Offline
        topse
        wrote on last edited by
        #3

        Ahhh... its getting better. Still a little problem, see picture:

        Picture2

        The TextEdit is not completly fit in the window... you know, why?

        Thanks again :-/

        1 Reply Last reply
        0
        • X Offline
          X Offline
          xargs1
          wrote on last edited by
          #4

          Did you provide a width for the Dialog as I did in my code?

          T 1 Reply Last reply
          0
          • X xargs1

            Did you provide a width for the Dialog as I did in my code?

            T Offline
            T Offline
            topse
            wrote on last edited by
            #5

            No I didnt... sorry. But: Why do I have to? Manual says, that Dialog will figure out the size of the children by itself?

            1 Reply Last reply
            0
            • X Offline
              X Offline
              xargs1
              wrote on last edited by
              #6

              Manual says, that Dialog will figure out the size of the children by itself?

              But it doesn't say that; it says it will attempt to size itself. From my experiences, it often fails.

              T 1 Reply Last reply
              0
              • X xargs1

                Manual says, that Dialog will figure out the size of the children by itself?

                But it doesn't say that; it says it will attempt to size itself. From my experiences, it often fails.

                T Offline
                T Offline
                topse
                wrote on last edited by
                #7

                OK. But I think then I may have a problem: The application will run on Windows and Android. I think, on both OS'ses the sizes of the Text and the TextField will be very different, because Android will use larger a Font. Do you have such a use-case?

                Tobias

                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