Resize Widget To Desktop Size
Hi,
I've a question for you...Is there a simple way to resize my widget to desktop size?
I try this code but it seem don't work fine:
Code:
mainWindow->resize(width, height);
Infact if I try to get the window height:
Code:
int mwHeight = mainWindow->height();
then mwHeight is less of QApplication:desktop()->height() (about 20 pixel)
Any idea?
And how I can call directly the maximixe button of the title bar to do the same resize by code?
Re: Resize Widget To Desktop Size
Re: Resize Widget To Desktop Size
Ok I've solved the problem using the showMaximized method.
It work fine only if insert before a resize:
Code:
mainWindow->resize(100,100);
mainWindow->showMaximized();
Why?
Re: Resize Widget To Desktop Size
For me it works with Qt 4 without any additional tricks:
Code:
#include <QtGui>
int main(int argc, char* argv[])
{
window.showMaximized();
return app.exec();
}
Re: Resize Widget To Desktop Size
Quote:
Originally Posted by
jpn
For me it works with Qt 4 without any additional tricks:
Code:
#include <QtGui>
int main(int argc, char* argv[])
{
window.showMaximized();
return app.exec();
}
I know...I try some examples like your code and they works fine.
However I'm working with Qt3.3.5 and window is a QMainWindow not a QWidget.
I want remove the resize because I've some problmes with it...so any idea how to resolve the question?
Re: Resize Widget To Desktop Size
Quote:
Originally Posted by
fruzzo
I know...I try some examples like your code and they works fine.
In that case it is highly probable that the bug is on your side. It's just hidden somewhere in a big and complex project. That's why it's always a good idea to put up together a minimal compilable test application reproducing the problem.
Quote:
However I'm working with Qt3.3.5 and window is a QMainWindow not a QWidget.
Actually, QMainWindow IS A QWidget. And QWidget::showFullScreen() functionality is implemented in QWidget code. I doubt you can reproduce the problem with a plain QMainWindow either. If you can reproduce it with a QMainWindow subclass, then the problem might be in that subclass.
Re: Resize Widget To Desktop Size
How can I catch the signal emitted when launch mw->showMaximized()? And a way to know when resize (after showMaximized()) is completed?