PDA

View Full Version : Issues updating to QMdiArea



fnmblot
12th December 2007, 17:39
Hey everyone. I just updated one of my programs from using QWorkspace to QMdiArea, and I am having a couple of issues. When I call a form inside the MDIArea, the window comes up, but it is just small bit of the title bar, with the Min/Max/Close buttons. I can then resize the window to what it should be, but that is a pain. I tried doing setFixedSize, but that did not work, it is still just the small title bar.

Here is how I am calling the form:

void nnDBSMainWindow::formView()
{
nnDBSPieceViewForm *pieceViewForm = new nnDBSPieceViewForm;
MDIArea->addSubWindow(pieceViewForm);
pieceViewForm->setAttribute(Qt::WA_DeleteOnClose);
pieceViewForm->show();
}

Also, now that I have changed it to QMdiArea, a Close button I created on the form just wipes the form away, and keeps the window open. I have to click the X close button in the upper right corner.

Can anyone help me with this? I really don't want to go back to QWorkspace, since it is obsolete, and will be deprecated in the next version of Qt, according to the docs.

Thanks in advance!

vcp
13th December 2007, 10:00
Hi,

Try use: pieceViewForm->showMaximized();

[]s

vcp
13th December 2007, 10:04
Hi (again..)

I forgot. Don't use a pushButton to close a subwindow, use the 'X' button. This is the correct way.

fnmblot
13th December 2007, 14:15
Well, the showMaximized() worked just fine, but that removes the whole meaning of an MDI Area. Not having a close pushbutton, that is just crazy in my mind. If this is the truth about these issues, I will have to either go back to QWorkspace, or, bite my tongue, move over to GTK. :crying: I mean heck, I donate all the time to KDE.

Please, I really love Qt, please help me if anyone can.

Thanks in advance!

high_flyer
13th December 2007, 14:24
Not having a close pushbutton, that is just crazy in my mind.
Why?
Name one respectable MDI application that has close buttons in the inner forms.
MSVC, KDevelop and many other, have just the 'X' button for the forms.
'Close' buttons in a form is for dialogs.

fnmblot
13th December 2007, 15:23
Lotus Notes. I am trying to somewhat model the database application idea for my program. My program is to track music scores and compositions. It is supposed to allow you to enter a new score, view a table of the database, view the entry or other entries in a form format. That is why I would like a close pushbutton. Heck when I was designing database apps at IBM, we always used a close pushbutton. Like in Lotus Notes, I want to give the user 3 different ways to perform a function. CTRL+W, a close push button, or the X close button to close a window or form.

high_flyer
13th December 2007, 16:04
a Close button I created on the form just wipes the form away,
Can you show the slot your button is calling?


Lotus Notes.
Well, I don't know lotus notes so I looked it up (http://upload.wikimedia.org/wikipedia/en/7/7d/Dd7.jpg), and from what I can see, it also doesn't have close button in the form it self.
And even if it did, it is more the exception then the rule, so I wouldn't call the usual way of doing this "that is just crazy in my mind." ;)


That is why I would like a close pushbutton.
I still don't see why is a "in form" close button needed for the case you described, meaning, it what way is it better then clicking the 'X' button as usual.

Heck when I was designing database apps at IBM, we always used a close pushbutton.
When was that, the 1870's?? (it's said with a wink!) ;)

But show the slot you are using, maybe its easy to solve.

vcp
13th December 2007, 16:08
In first case also I think that the button close doesn't sense. But I note that the majority of the users use even the button X or an any shortcut defined.
But I don't know. ..I think that a question of conception.

To open you subwindow try use resize();

pieceViewForm->resize(300,400);
pieceViewForm->show();

Maybe help you.

ntp
13th December 2007, 19:31
I have found with my QMdiSubWindows that I need to do a setWidget(myWidget) in my subwindow class constructor. Also, within the myWidget that is in the subwindow class, I have overridden the minimumSizeHint() to return a value.

As for the close, I have not implemented a close inside the subwindow but I think you should be able to do a signal/slot situation outside of the window (if you make the close button accessible) that can hide or delete the window if that is what you want. I do it with a button on the main window.

fnmblot
17th December 2007, 18:37
This was how I had to do it, if anyone cares. Thanks ntp! I just decided to stop arguing about the close button, and use a Close Activate Window button on the MDI Toolbar area.



void nnDBSMainWindow::formView()
{
nnDBSPieceViewForm *pieceViewForm = new nnDBSPieceViewForm;
QMdiSubWindow *subWindow1 = new QMdiSubWindow;
subWindow1->setWidget(pieceViewForm);
MDIArea->addSubWindow(subWindow1);
subWindow1->setAttribute(Qt::WA_DeleteOnClose);
subWindow1->show();
subWindow1->resize(650, 600);
}


Thanks again to everyone! I don't know where I would be without this forum.