View Full Version : Frames connection
cuios
23rd March 2009, 09:29
I have created a form MainWindow - QMainWindow class and a Frame - QFrame class , after that in the mainwindow.ui.
I have added a button and created a new singnal clicked > openframe , after, in the mainwindow.h i have added public slots : void openframe() , after that in the mainwindow.cpp i have added:
#include "frame.h"
and
void MainWindow :: openframe()
{
Frame frame();
frame.exec();
}
but it is not working
please help me to connect these two frame with button click
Ginsengelf
23rd March 2009, 11:01
void MainWindow :: openframe()
{
Frame frame();
frame.exec();
}
frame goes immediately out of scope after exec() returns, so if exec() does not block you'll probably see only a short flicker.
Try to create it on the heap with "new".
Ginsengelf
vasanth
23rd March 2009, 11:06
Try creating your frame in heap like this
MainWindow:MainWindow()
{
frame = new QFrame(this);
--------
}
spirit
23rd March 2009, 11:12
btw, QFrame hasn't method exec() ;)
cuios
23rd March 2009, 14:11
I have tried this
MainWindow *other = new MainWindow;
other->show();
but I do not want to duplicate the frame , all I want is to use one that was designed in Qt Creator GUI designer
thanks a lot
Lykurg
23rd March 2009, 14:24
Hi,
don't understand what you exactly want, but if you want to open an other "window" beside your main application you should use QDialog instead of QFrame. Even a look at Using a Designer .ui File in Your Application (http://doc.trolltech.com/4.5/designer-using-a-ui-file.html) could be helpful.
Lykurg
cuios
23rd March 2009, 18:08
Solved.
Thanks a lot to all , everything was very helpfull !!!!!!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.