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. [Not Answered] How to handle GUI objects sizes for different screen resolutions?
Forum Updated to NodeBB v4.3 + New Features

[Not Answered] How to handle GUI objects sizes for different screen resolutions?

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

    Hi,
    I am developing an application on my Laptop using the form classes for GUI Windows/Dialogs.
    Every object inside the parent window/dialog has the default settings for size & I am using Layouts & Spacers as advised in a previous thread.
    I am only hard coding the size of the parent window according to what I feel is good on my Laptop.
    When I run the application on my Desktop (has a slightly different screen resolution), the Main Window does not fit in the screen.
    So I decided to resize every window depending upon a ratio between the resolution of my laptop & the users resolution.
    Example, a window of size 800x400 on my laptop(1000x800) will be 400x200 on my desktop(500x400) <numbers are imaginary for sake of understanding>.
    I am calculating this ratio at startup using data from QDesktop object.
    I would like to know whether my approach is correct?
    If not then what is the standard practise?
    Thank You

    1 Reply Last reply
    0
    • CAD_codingC Offline
      CAD_codingC Offline
      CAD_coding
      wrote on last edited by
      #2

      Still no answer yet.... :(

      1 Reply Last reply
      0
      • Y Offline
        Y Offline
        yhu420
        wrote on last edited by
        #3

        I developed many applications with Qt and I never had to worry about the size of my windows.. Why do you absolutely want to keep a perfectly calculated ratio and everything?
        If you REALLY want a special ratio, try using setFixedSize() or resize()

        1 Reply Last reply
        0
        • CAD_codingC Offline
          CAD_codingC Offline
          CAD_coding
          wrote on last edited by
          #4

          As I said I had chosen the sizes of my windows according to what was looking good on my laptop. But when I ran my application on my desktop, the size of my main window was much larger than the screen resolution, so part of it was not visible.
          That is why I thought it was best to give sizes for main window's according to the users resolution.
          Did you try running your applications on different screen resolutions?
          What were your findings?

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mehrdadsilver
            wrote on last edited by
            #5

            You should use Layout for managing display GUI in different resolutions.

            Mehrdad Abdolghafari, Be silver

            1 Reply Last reply
            0
            • CAD_codingC Offline
              CAD_codingC Offline
              CAD_coding
              wrote on last edited by
              #6

              Yes I am using Layout's for managing displaying of child widgets in a window.
              But the main window still needs some size right?
              I am talking about the size of parent window only & not the child widgets inside it.
              If I am still wrong then does that mean you absolutely dont specify the size of your main window by code at all?
              I did this because it shows the size of the window in the .ui designer.
              The size becomes bold, so it will use the same size on all environments irrespective of the users resolution, right?

              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