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. Setting window size including window frame
QtWS25 Last Chance

Setting window size including window frame

Scheduled Pinned Locked Moved General and Desktop
15 Posts 5 Posters 20.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.
  • T Offline
    T Offline
    Thibaut
    wrote on last edited by
    #1

    Hey.

    I am developping an application that needs to be 1024x768. I set the size in QTDesigner using the minimuSize and maximumSize parameters of the widget. Problem is that these dimensions do not include the Windows frame. I end up with a window that is larger than 1024x768.

    Is there a way to set the window size while including the Windows frame.

    • I need to keep the Windows frame
    • I had a look at the Window Geometry page of the Qt doc. Apparently, the x() and y() parameters are what I am looking for but I just cannot figure out a way to use them.

    Thanks a lot

    1 Reply Last reply
    1
    • V Offline
      V Offline
      vsorokin
      wrote on last edited by
      #2

      I think it is not possible because window frame painting depends on Windows Manager system.

      Also if you set 1024x768 (with frame) and run app on 800x600 it's again will bad.

      Why do you not want using window maximizing?

      @void QWidget::showMaximized()@

      --
      Vasiliy

      1 Reply Last reply
      0
      • T Offline
        T Offline
        Thibaut
        wrote on last edited by
        #3

        This size is the minimum size required in the specifications. The soft is not designed to work on a 800x600 screen.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          giesbert
          wrote on last edited by
          #4

          you can only do it "by hand" in the constructor of the class.
          The window frame depends on system settings, which change from OS to OS and from OS version to OS version and also depend on user settings.

          On Windows, you can read them by calling "GetSystemMetics":http://msdn.microsoft.com/en-us/library/ms724385(v=vs.85).aspx

          Nokia Certified Qt Specialist.
          Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

          1 Reply Last reply
          0
          • T Offline
            T Offline
            Thibaut
            wrote on last edited by
            #5

            I found stg like that on the web. Is it valid ?

            @widthofframe = frameGeometry().width() - geometry().width();
            //divide this by 2 for one side's width

            heightofframeandtitlebar = frameGeometry().height() -
            geometry().height()
            heightoftitlebar = heightofframeandtitlebar - (frameGeometry().width() -
            geometry().width());@

            1 Reply Last reply
            1
            • AlicemirrorA Offline
              AlicemirrorA Offline
              Alicemirror
              wrote on last edited by
              #6

              Hi,

              just a suggestion: why don't elide totally the standard window frame, creating a frameless window with the controls you need on a button toolbar that can be set to disappear when not needed ?

              Enrico Miglino (aka Alicemirror)
              Balearic Dynamics
              Islas Baleares, Ibiza (Spain)
              www.balearicdynamics.com

              1 Reply Last reply
              0
              • G Offline
                G Offline
                giesbert
                wrote on last edited by
                #7

                [quote author="Alicemirror" date="1316012242"]Hi,

                just a suggestion: why don't elide totally the standard window frame, creating a frameless window with the controls you need on a button toolbar that can be set to disappear when not needed ?[/quote]

                This only works, if you are not on windows or don't need taskbar support and default menus. a maximized, frameless app on windows is fulllscreen, no taskbar visible etc... ;-(

                [quote author="Thibaut" date="1316011992"]I found stg like that on the web. Is it valid ?

                @widthofframe = frameGeometry().width() - geometry().width();
                //divide this by 2 for one side's width

                heightofframeandtitlebar = frameGeometry().height() -
                geometry().height()
                heightoftitlebar = heightofframeandtitlebar - (frameGeometry().width() -
                geometry().width());
                @
                [/quote]

                This works, if the app is already visoble, but typically, you want to set such things in the constructor, there it will not work.

                Nokia Certified Qt Specialist.
                Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                1 Reply Last reply
                0
                • AlicemirrorA Offline
                  AlicemirrorA Offline
                  Alicemirror
                  wrote on last edited by
                  #8

                  @Gerolf: sure, I know it because I had to use this approach. But is you see the most recent Qt versions (for sure 4.7.3 and further) support the Qt quick components in the desktop environment too. I suggested to manage a really full screen window (that save space for the app if I have understood that it is needed as much more scren as possible) and manage the options using a common toolbar, at the bottom.

                  Instead of this method there is also what I have set to save space on some applicaitons for small screens, where a custom toolbar appears when the mouse is near the top of the screen.

                  Don't you think it is possibe ?

                  Enrico Miglino (aka Alicemirror)
                  Balearic Dynamics
                  Islas Baleares, Ibiza (Spain)
                  www.balearicdynamics.com

                  1 Reply Last reply
                  0
                  • G Offline
                    G Offline
                    giesbert
                    wrote on last edited by
                    #9

                    It could be possible, but if it changes app behavior for some OSs, it should be stated. I know many people, who are scared on desktops, if they try to maximize apps and they got fullscreen.
                    Afterwards they want to access e.g. outlook, browser or whatever and the taskbar is not visible...

                    Nokia Certified Qt Specialist.
                    Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                    1 Reply Last reply
                    0
                    • AlicemirrorA Offline
                      AlicemirrorA Offline
                      Alicemirror
                      wrote on last edited by
                      #10

                      Yes, I see.

                      e.g. the F11 Key with Firefox. What is your advice ?

                      Enrico Miglino (aka Alicemirror)
                      Balearic Dynamics
                      Islas Baleares, Ibiza (Spain)
                      www.balearicdynamics.com

                      1 Reply Last reply
                      0
                      • G Offline
                        G Offline
                        giesbert
                        wrote on last edited by
                        #11

                        use the OS api and calculate by hand :-)

                        Nokia Certified Qt Specialist.
                        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                        1 Reply Last reply
                        0
                        • AlicemirrorA Offline
                          AlicemirrorA Offline
                          Alicemirror
                          wrote on last edited by
                          #12

                          If I remember there are information that can be get from the Api about window decoration sizes, borders etc.

                          Enrico Miglino (aka Alicemirror)
                          Balearic Dynamics
                          Islas Baleares, Ibiza (Spain)
                          www.balearicdynamics.com

                          1 Reply Last reply
                          0
                          • G Offline
                            G Offline
                            giesbert
                            wrote on last edited by
                            #13

                            [quote author="Alicemirror" date="1316016905"]If I remember there are information that can be get from the Api about window decoration sizes, borders etc.[/quote]

                            Really? AFAIK, if the widgets are displayed, you can use geometry and frameGeometry, but to get the OS defaults?

                            Nokia Certified Qt Specialist.
                            Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                            1 Reply Last reply
                            0
                            • AlicemirrorA Offline
                              AlicemirrorA Offline
                              Alicemirror
                              wrote on last edited by
                              #14

                              I don't remember this detail, but I had a big problem managing a windowless application for Windows 7 and investigating on the functions to obtain the result that I was expecting I remeber that I have found some information about the window geometry. As I have a minute I will check what it was. I save always the useful documents for a project in a pdf folder :)

                              Enrico Miglino (aka Alicemirror)
                              Balearic Dynamics
                              Islas Baleares, Ibiza (Spain)
                              www.balearicdynamics.com

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                mhcrnl
                                wrote on last edited by
                                #15

                                in mainwidow.ui > MainWindow > Property > Qwidget >geometry

                                Salutare !!!

                                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