[SOLVED]How to promote QMdiArea in designer?
-
Those lines I mentioned are the only ones that I changed.
bq. Designer didn’t accept to Promote QMdiArea for QFrame base class!!!
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.
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.hclick button "Add" and then click button "Promote"
That's it.
EDIT : if you still need the altered project. just let me know.
-
[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) -
bq. I did the same steps but the last one doesn’t exist
What do you mean exactly? is the Add button grayed out or the Promote button? Do you get an error message?
-
[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
-
[quote]just select what you alread made and then the button should be available[/quote]
I selected it. It still unavailable!!!!I'll upload a sceencast to see what's going on
-
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);@ -
Glad you made it!
Please could you edit your title and add [Solved] in front of it?
Also use @ instead of /[code/] to mark code in your topic. I changed it for you. (see the <> button on top of the editor.