View Full Version : Open a QMainWindow in full screen mode?
probine
29th November 2006, 11:56
I have a simple QmainWindow and I want it to get open in full screen mode, just like any other program in my computer (Firefox, IE, etc...)
How?
jpn
29th November 2006, 12:10
QWidget::showFullScreen()
QWidget::showMaximized()
probine
29th November 2006, 12:26
Actually I solve that... the problem I have now is that a QTextBRowser is inside the QMainWindow, but I cannot show the QTextBRowser in the full window.
How to I make, so the QTextBroser will occupy the whole Main Window?
jpn
29th November 2006, 12:35
As it says in the QWidget::showFullScreen() docs:
Calling this function only affects windows.
You would have to reparent the text browser as a top level widget for the time you want it to be shown full screen.
probine
29th November 2006, 12:43
I don't want the text browser to be full screen, I just want it to occupy as much as the main window as possible.
jpn
29th November 2006, 13:34
So what's the problem? The text browser will get automatically resized if it's set directly as the central widget or if it's in a layout. You can optionally hide toolbars, status bar and such when in full screen mode if you want to. If the text browser is in a layout, you can also reduce the amount of margins to zero.
probine
29th November 2006, 14:38
Server::Server()
{
setFont(QFont("Verdana", 11));
showMaximized();
textBrowser = new QTextBrowser(this);
textBrowser->show();
show();
}
That code shows the QTextBrowser, but it is only a small square (5"x5") in the screen. While the main window is full screen.
The text browser should be as big as possible.
What is wrong ?
jpn
29th November 2006, 14:44
Set the text browser as main window's central widget: QMainWindow::setCentralWidget().
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.