Setting window size including window frame
-
wrote on 14 Sept 2011, 13:15 last edited by
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
-
wrote on 14 Sept 2011, 13:33 last edited by
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()@
-
wrote on 14 Sept 2011, 13:41 last edited by
This size is the minimum size required in the specifications. The soft is not designed to work on a 800x600 screen.
-
wrote on 14 Sept 2011, 13:52 last edited by
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
-
wrote on 14 Sept 2011, 14:53 last edited by
I found stg like that on the web. Is it valid ?
@widthofframe = frameGeometry().width() - geometry().width();
//divide this by 2 for one side's widthheightofframeandtitlebar = frameGeometry().height() -
geometry().height()
heightoftitlebar = heightofframeandtitlebar - (frameGeometry().width() -
geometry().width());@ -
wrote on 14 Sept 2011, 14:57 last edited by
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 ?
-
wrote on 14 Sept 2011, 15:13 last edited by
[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 widthheightofframeandtitlebar = 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.
-
wrote on 14 Sept 2011, 15:18 last edited by
@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 ?
-
wrote on 14 Sept 2011, 15:28 last edited by
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... -
wrote on 14 Sept 2011, 15:43 last edited by
Yes, I see.
e.g. the F11 Key with Firefox. What is your advice ?
-
wrote on 14 Sept 2011, 16:00 last edited by
use the OS api and calculate by hand :-)
-
wrote on 14 Sept 2011, 16:15 last edited by
If I remember there are information that can be get from the Api about window decoration sizes, borders etc.
-
wrote on 14 Sept 2011, 20:58 last edited by
[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?
-
wrote on 14 Sept 2011, 21:24 last edited by
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 :)
-
wrote on 2 Feb 2013, 10:04 last edited by
in mainwidow.ui > MainWindow > Property > Qwidget >geometry