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. How to adjust widgets automatically to screen resolutions

How to adjust widgets automatically to screen resolutions

Scheduled Pinned Locked Moved General and Desktop
5 Posts 3 Posters 9.4k 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.
  • C Offline
    C Offline
    chandradeo
    wrote on last edited by
    #1

    Hi all

    I am very newbie to Qt. I have developed a Qt GUI aplication for Desktops. In my application i have used some buttons and textboxes.
    The problem is that when i deploy it on machine of different resolution the Widgets are going here and there. I dontwant to create widgets through code , i just want to drag from menu and use it .

    Plz tell me how i can make them autoadjustable to diffrent screen resolution.

    Thans in advnce

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AcerExtensa
      wrote on last edited by
      #2

      Take a look at "Layout Management":http://doc.qt.digia.com/qt/layout.html
      and at "Using Layouts in Qt Designer":http://http://qt-project.org/doc/qt-4.8/designer-layouts.html

      God is Real unless explicitly declared as Integer.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        chandradeo
        wrote on last edited by
        #3

        Hi Extensa
        thank u very much for valuable advice. I wnt through th document and was able to create the resulution free GUI but one bigger issue is that i am not able to change the widget property like position, size,color because lauout manager is not allowing that.

        please tll me how to cahnge these properties of widgets.

        Thanking u in advance

        1 Reply Last reply
        0
        • A Offline
          A Offline
          AcerExtensa
          wrote on last edited by
          #4

          bq. All QWidget subclasses can use layouts to manage their children. The QWidget::setLayout() function applies a layout to a widget. When a layout is set on a widget in this way, it takes charge of the following tasks:

          • Positioning of child widgets.
          • Sensible default sizes for windows.
          • Sensible minimum sizes for windows.
          • Resize handling.
          • Automatic updates when contents change:
          • Font size, text or other contents of child widgets.
          • Hiding or showing a child widget.
          • Removal of child widgets.

          So, you can let Layout Manger do that, or you should override events of your main widget and change needed properties dynamically... Like "resizeEvent":http://doc.qt.digia.com/qt/qwidget.html#resizeEvent If you can show us an example of what you are doing and how the properties should be changed, maybe you will get more exact advice...

          God is Real unless explicitly declared as Integer.

          1 Reply Last reply
          0
          • I Offline
            I Offline
            issam
            wrote on last edited by
            #5

            Hi,
            There are 4 ready-made layouts : QVBoxLayout, QHBoxLayout, QGridLayout and QFormLayout. All of them inherit QLayout.
            If any of them doesn't fit your application you can subclass QLayout and create a custom layout :)

            http://www.iissam.com/

            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