Floating windows constrained to within the MainWindow?
I would like to create an application where I can have frames/windows inside of a main window that the users would be allowed to resize and move as they wish but would be constrained to the main window. Java Swing has the concept of a JDesktopPane that does that. I looked at QDockWidget but those widgets are allowed to move outside of the main window.
Is there any way currently to do this without making my own? This would have to be able to run under the commercial license.
Thanks,
Nisha
Re: Floating windows constrained to within the MainWindow?
You can use QDockWidget, it seems to be the easiest solution :)
By the way, you can prevent docked widgets from floating outside of the mainwindow :
Just omit the feature
Re: Floating windows constrained to within the MainWindow?
Re: Floating windows constrained to within the MainWindow?
guilugi:
Thanks. I tried it but I cannot move the window around or resize it. I did the following in my main.cpp. (I added the test widget which is just a simple wrapper around a QGLWidget to give the window a body. Even without it, it didn't work):
Code:
dockWidget
->setGeometry
(QRect(40,
30,
120,
80));
GLTestWidget *glWidget = new GLTestWidget();
dockWidget->setWidget(glWidget);
merlvingian:
Thanks for the reference to QWorkspace. I'm looking at it now but I am not sure I understand the relationship between it and QMdiXXX widgets
-- Nisha
Re: Floating windows constrained to within the MainWindow?
Quote:
Originally Posted by
ntp
I am not sure I understand the relationship between it and QMdiXXX widgets
QMdiXXX is a replacement for QWorkspace in Qt 4.3.
Re: Floating windows constrained to within the MainWindow?
QMdiArea looks like it has what I need. I assume that once I get into it, I'll be able to have some control over the subwindow's menus for maximize, minimize, etc.
It was as simple as this:
Code:
QMdiArea* mdiArea = new QMdiArea(ui.frame);
GLTestWidget *glWidget = new GLTestWidget();
mdiArea->addSubWindow(glWidget);
Thanks everyone!
Nisha