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. handling Complex QtQuick Layout

handling Complex QtQuick Layout

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 3 Posters 1.5k Views
  • 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.
  • M Offline
    M Offline
    Mammamia
    wrote on last edited by
    #1

    I am designing an application screen which has lot of controls and I need to have the same layout structure in my QML application. I have tried with QGridLayout and individual QRow/QColumnLayouts but no luck.

    Can anyone help me to solve this. Any idea how efficiently the layout can be used in Qt Quick applications?

    0_1505143740916_EQ_Screen_ToDo.png

    The above screen I created using Qt Creator but it uses a lot of hard coded values for position and size and the layout is not aligned properly when resizing.

    E 1 Reply Last reply
    0
    • ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      Hi,

      It depends on desired behaviour.

      Do you want your controls to grow up or only the view (center black rectangle) when maximising the window ?

      I use 'Anchors' for the positioning http://doc.qt.io/qt-5/qtquick-positioning-anchors.html

      LA

      1 Reply Last reply
      0
      • M Mammamia

        I am designing an application screen which has lot of controls and I need to have the same layout structure in my QML application. I have tried with QGridLayout and individual QRow/QColumnLayouts but no luck.

        Can anyone help me to solve this. Any idea how efficiently the layout can be used in Qt Quick applications?

        0_1505143740916_EQ_Screen_ToDo.png

        The above screen I created using Qt Creator but it uses a lot of hard coded values for position and size and the layout is not aligned properly when resizing.

        E Offline
        E Offline
        Eeli K
        wrote on last edited by
        #3

        @Mammamia As @LeLev said "It depends on desired behaviour." Most probably layouts would help you but it's difficult to say anything actually helpful without knowing how it should behave when resizing and what it connected to what. One way to get help is to write a main.qml which has the components shown in your picture, using the three different layouts (not QGridLayout etc. but GridLayout etc. in QML) as you think they should work. Then describe how it doesn't work as you expect.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          Mammamia
          wrote on last edited by
          #4

          @LeLev Yes you are correct, I need the center black rectangle to be resized when resizing the window.

          All other components will be having same size even we resize it.

          I have tried using GridLayout in QML to position it along with multiple Row/ColumnLayout but at some point of time the behaviour changes and the space between the left top buttons increases when resizing..

          I have made it simple in a drawing how it should be aligned with simple rectangles. Which looks like,
          0_1505210647021_EQ_Screen_Wireframe.png

          Which option will be better to use either Positioning Anchors with Row,Column or to use Row/ Coulmn/ Grid Layouts??

          E 1 Reply Last reply
          0
          • M Mammamia

            @LeLev Yes you are correct, I need the center black rectangle to be resized when resizing the window.

            All other components will be having same size even we resize it.

            I have tried using GridLayout in QML to position it along with multiple Row/ColumnLayout but at some point of time the behaviour changes and the space between the left top buttons increases when resizing..

            I have made it simple in a drawing how it should be aligned with simple rectangles. Which looks like,
            0_1505210647021_EQ_Screen_Wireframe.png

            Which option will be better to use either Positioning Anchors with Row,Column or to use Row/ Coulmn/ Grid Layouts??

            E Offline
            E Offline
            Eeli K
            wrote on last edited by
            #5

            @Mammamia said in handling Complex QtQuick Layout:

            I have tried using GridLayout in QML to position it along with multiple Row/ColumnLayout but at some point of time the behaviour changes and the space between the left top buttons increases when resizing..

            I have made it simple in a drawing how it should be aligned with simple rectangles. Which looks like,
            0_1505210647021_EQ_Screen_Wireframe.png

            Nice illustration, it's helpful.

            The space between the buttons naturally increases because the layout tries to occupy space for each cell evenly. There are basically two ways to fix this kind of situation. Either the layout item itself should not be resized (in this case its height should stay fixed) or one item inside it shoud greedily take all extra space. The latter is often easier: just add an extra empty item below the buttons which fills the space:

            Item{Layout.fillHeight: true}
            

            If no other item inside that layout doesn't try to fill height this one will and the other items are packed together.

            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