Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Auto scale Widgets when i resize the Window
Forum Updated to NodeBB v4.3 + New Features

Auto scale Widgets when i resize the Window

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 2.5k Views 2 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.
  • E Offline
    E Offline
    ELEMENTICY
    wrote on last edited by
    #1

    Hello,i got a problem on my Application
    Im making a code editor with QT and i wanna auto scale the widgets when i resize the window.
    I check google for a long time and tried horizontal layout,grid layout.... etc.
    But the result is not what i want,this is what my editor looks like:
    Screenshot 2020-12-29 133415.png

    and when i make it maximum,it become this:

    Screenshot 2020-12-29 133426.png

    i wanna make it auto scale,i tried grid layout and i dont like it is because it make a small grid between them.I want all of them stick together.

    and yea,if i use grid layout,the left list view and right code area will become same width.And i cant change it.

    Please help me,thank you

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #4

      Hi
      Did you try the layoutStretch
      alt text

      It tells how to share the space. normal its even shared but you can tell it to
      share so one widget get less than others etc.

      alt text

      When you set the stretching values, it will keep this layout even when you maximize.

      ps. i used horizontalLayout

      E 1 Reply Last reply
      1
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #2

        Hi,

        If you would like to be able to adjust both widgets you might want to consider using QSplitter.

        Otherwise you have to give more details about the structure of your GUI.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        E 1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          If you would like to be able to adjust both widgets you might want to consider using QSplitter.

          Otherwise you have to give more details about the structure of your GUI.

          E Offline
          E Offline
          ELEMENTICY
          wrote on last edited by ELEMENTICY
          #3

          @SGaist Okay i will give more details about my UI
          Im making a code editor as the picture i sent above.
          And i used Grid Layout but then there will have Gap between all widgets,can i ask how do i remove the gap?
          I used right click the mainwidows and click layout and click grid layout.Please help me,thank you = D

          My english is sucks sorry

          1 Reply Last reply
          0
          • mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by mrjj
            #4

            Hi
            Did you try the layoutStretch
            alt text

            It tells how to share the space. normal its even shared but you can tell it to
            share so one widget get less than others etc.

            alt text

            When you set the stretching values, it will keep this layout even when you maximize.

            ps. i used horizontalLayout

            E 1 Reply Last reply
            1
            • mrjjM mrjj

              Hi
              Did you try the layoutStretch
              alt text

              It tells how to share the space. normal its even shared but you can tell it to
              share so one widget get less than others etc.

              alt text

              When you set the stretching values, it will keep this layout even when you maximize.

              ps. i used horizontalLayout

              E Offline
              E Offline
              ELEMENTICY
              wrote on last edited by
              #5

              @mrjj Alright,i found the way myself from you.Thank you for helping me,I made a layout of mainwindow,and i change the scretch by clicking centrelwidget button

              Thanks for your help

              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