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. Facing problem to arrange UI items.
Qt 6.11 is out! See what's new in the release blog

Facing problem to arrange UI items.

Scheduled Pinned Locked Moved General and Desktop
4 Posts 3 Posters 2.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.
  • M Offline
    M Offline
    mady
    wrote on last edited by
    #1

    Hi,
    This could be a very basic question but I am kind of stuck and not having any clue how to proceed further.
    I am creating a UI which has lot of items e.g. checkBoxs, comboBoxs, labels, textEdit, RadioButtons etc. I have added them successfully but the challenge I am facing is they are getting spread all over the widget based on the space available but I want to keep them where I want. I tried vertical / Horizontal/ Grid layouts but all are arranging automatically which I don't like. I even tried GroupBox but did not get the exact look I want.

    Just to mention I am not using Qt Designer and don't want to use it because I am learning Qt that I feel this is the best way to learn :).

    My questions are,

    • Is there any way to specify the exact position in the widget where I want the item to be appear?
    • Is it possible to disable auto adjust options in layouts. Not sure if this sounds weird :) but some how I hate this auto adjust.
    1 Reply Last reply
    0
    • F Offline
      F Offline
      fluca1978
      wrote on last edited by
      #2

      [quote author="mady" date="1325057308"]

      My questions are,

      • Is there any way to specify the exact position in the widget where I want the item to be appear?
      • Is it possible to disable auto adjust options in layouts. Not sure if this sounds weird :) but some how I hate this auto adjust.
        [/quote]

      You can always use absolute positioning while displaying widgets (e.g., move a widget to a position), but I will not use it. Layouts are good since they adjust the widgets as the main window (or container widgets) changes. Why don't you use a spacer to mangle the space remaining so that it is not used by your widgets?

      1 Reply Last reply
      0
      • A Offline
        A Offline
        andre
        wrote on last edited by
        #3

        If you want to decide where widgets appear exactly, and you feel layouts don't grand you enough freedom, then it is up to you to manage their positioning manually. Only you know how you want your layout to react to changes in form geometry, right? So Qt cannot help you there.

        If you want my advice: get used to using layouts. They are really quite powerful, and they have sane defaults for things like margins and spacings. It really saves you a lot of headaches, and it will make your applications that much more portable (what happens if at another platform, your widgets are slightly smaller or bigger because you are using a different style or font?)

        1 Reply Last reply
        0
        • F Offline
          F Offline
          fluca1978
          wrote on last edited by
          #4

          Moreover, since you are learning Qt, learn it well. I don't know any windowing system that does not provide some kind of layout managers, as well as direct positioning. But in the long distance layout-ing pays much more!

          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