[SOLVED]How to promote QMdiArea in designer?
-
[quote]I think your problem is here : I see that you tried to use QMdiArea, but as you can see in my example I use your MdiArea class instead.
.
.
.
Base Class name : QFrame
Promoted class name : MdiArea
header file : mdiarea.h
click button “Add” and then click button “Promote”
[/quote]
No no, I did the same steps but the last one doesn't exist (while it works for other classes) -
[quote]is the Add button grayed out or the Promote button?[/quote]
Promote button grayed out.See this screenshot please:
http://img705.imageshack.us/img705/3389/screenshot1oy.jpgPS
Do you think it's betten to send you screencast? -
bq. Promote button grayed out.
See this screenshot please:that's normal
You have to fill in the dialogbox first than the Add button gets available and after that the promote button can be used.
I explained this already, did you do it like that?bq. For completeness : here are the choices I made in the “promoted Widgets” dialogbox. You won’t see that in the project if I send it to you.
Base Class name : QFrame
Promoted class name : MdiArea
header file : mdiarea.h
click button “Add” and then click button “Promote”EDIT : missed it that you already created it. just select what you alread made and then the button should be available
-
cold you please see the following screencast
http://eng-svu.al-yarmook.com/MdiArea/ -
You used a QMdiArea as the place holder. It should be a QFrame in Qt Designer because you subclass QFrame.
!http://dl.dropbox.com/u/33544011/MdiArea.PNG(Have a look at this screenshot)! -
[quote]You used a QMdiArea as the place holder. It should be a QFrame in Qt Designer because you subclass QFrame.[/quote]
Does it mean I've to morph QMdiArea to QFrame?! If yes this is huge disaster to me because I created many widgets in subwindows by Designer so I've to use really QMdiArea instead of QFrame.Do you've any solution?
-
bq. Does it mean I’ve to morph QMdiArea to QFrame?! If yes this is huge disaster to me because I created many widgets in subwindows by Designer so I’ve to use really QMdiArea instead of QFrame.
Yes you have to use a QFrame and add the subwindows in code. That's not so much work. If you have made a class with ui, you can use Designer to make the visual appearance of the widgets you want to use in the MdiArea..
I tested it with your own MdiArea, but it can be anything...
@// ui->frame = new MdiArea(QImage(":/img/gnome-graphics.png"), Qt::red);
ui->frame->addSubWindow(new MdiArea(QImage(":/img/gnome-graphics.png"), Qt::red));
ui->frame->addSubWindow(new MdiArea(QImage(":/img/gnome-graphics.png"), Qt::green));@ -
Thanks a lot guys I fixed this issue by:
@QList<QMdiSubWindow *> windows = ui->mdiArea->subWindowList();
qDebug("%d", windows.count());
for (int var = 0; var < windows.count(); ++var) {
QMdiSubWindow *wind = windows[var];
ui->frame->addSubWindow(wind->widget());
}
ui->mdiArea->setVisible(0);@