HOw to display new windows
-
yeah you did. but really cant you just cook up a quick example on how to do this? but i've really tried and i get same compilation error...please :( help me out here
-
Well we can, but you won't really learn from that, i think it is more important that we explain stuff and you correct your code, do you agree with me?
So, as i said in forum.nokia, the compilation problem is not with two forms, it's all about the forma class, which has undefined slots/member functions:
I tried to explain, i will try to repeat the explanation, and please try to read and apply what we say.
So in class froma.h you declare two slots:
@private slots:
void on_formbButton_clicked(); //this one is not defined in the forma.cpp file
void on_unlockButton_clicked(); //this one is OK... it is defined in .cpp file and it close the first window
@And it forma.cpp you have the following code, that is supposed to open the second form, but this name void forma:: on_iceButton_clicked() it is not declared so the C++ compiler can't recognize it
So figure the name of the button that you want to open the second form and then use the same name for declaration and definition too.
-
now that has been corrected. same compilation error
undefined reference to formb::formb(QWidget*)
now maybe we address the mem. leak issue, could that be the cause?
the the parent thing. can you give any hint? -
formb class seems ok
So try from the Build menu: Clean All, Run qmake then Rebuild
Or manually delete the auto-generated files then rebuild.
And you can give the parent too, like this:
@
void forma:: on_ButtonName_clicked()
{
formb *j = new formb(this); //the forma will be the parent of formbj->showMaximized();
}
@ -
you know funny thing is i've tried that parenting suggestion you justst gav, but it gave same error. I'll try the build thing again when i get home.
Or maybe just reinstall qt. I the vode is seemingly ok.
But that will be when i get home. I'm currently in transit from school. -
You don't need to reinstall Qt, that won't solve the problem
Also the parent isn't a solution for this compile errorIf you give a parent you will also need to tell Qt that you want formb to be a new window, this is because your formb inherits from QWidget and not from QMainWindow or QDialog.
So complete code for slot is:
@
void forma:: on_ButtonName_clicked()
{
formb *j = new formb(this);
j->setWindowFlags(Qt::Window); //this way you show your QWidget as a new window and pass a parentj->showMaximized();
}
@
Put something inside formb and see without that line where it will appear -
thank you. I'll be sure to try that too and let you know what happens
-
Are formb.h and formb.cpp added to your project file?
The error message
bq. undeclared reference formB::formB(QWidget*).
leads me to the guess that formb.cpp is not compiled at all.
You can post your .pro file, we can check.
-
tried all the above, same problem. Thanks guys. I'll like to concentrate my efforts on something else for now.
-
Your setup is broken, the classes you have showed us are not complete (and erroneous too - wrong destructor name in forma.h). There's no chance to solve the problem from here.
Good luck with your further debugging efforts.
-
Same problem here. Simulator build/run ok and Device build not.
@
void MainWindow::on_actionAbout_triggered()
{
DialogAbout about(this);
about.exec();
}
@My .pro:
@
#-------------------------------------------------Project created by QtCreator 2011-02-07T21:00:21
#-------------------------------------------------
QT += core gui
TARGET = QTBible
TEMPLATE = appSOURCES += main.cpp dialogabout.cpp mainwindow.cpp
HEADERS += dialogabout.h
mainwindow.hFORMS += dialogabout.ui
mainwindow.uiOTHER_FILES +=
Welcome.html
Notes.txtRESOURCES +=
resources.qrc@
-
ifewalter,
I was searching into log to discover some issue and found this:
@Configuration unchanged, skipping qmake step.@
I don't know why, but my dialog was not included in Makefile, because qmake creates the makefile, and it is not running!!!!
Solution: manual delete the Makefile (in your project dir). Doing a rebuild..... Voi lá.
-
What exactly is the error?
just posting code is not very helpful and will not result in too many answers... -
Gerof,
I've create a application, add a Dialog and write a code to show the dialog. Simple.
Compiling for simulator ok, but for device gives me an error (the same problem of first post):@
/NokiaQtSDK/Symbian/SDK/EPOC32/BUILD/Quati/develop/Nokia/QTBible/QTBIBLE_0XE3918DBB/GCCE/UDEB/mainwindow.o: In function `MainWindow::on_actionAbout_triggered()':/Quati/develop/Nokia/QTBible/mainwindow.cpp:91: undefined reference to `DialogAbout::DialogAbout(QWidget*)'
/Quati/develop/Nokia/QTBible/mainwindow.cpp:95: undefined reference to `DialogAbout::~DialogAbout()'
/Quati/develop/Nokia/QTBible/mainwindow.cpp:95: undefined reference to `DialogAbout::~DialogAbout()'
make[2]: *** [\NokiaQtSDK\Symbian\SDK\epoc32\release\gcce\udeb\QTBible.exe] Error 1
make[1]: *** [TARGETQTBIBLE_0XE3918DBB] Error 2
make[1]: Leaving directory `C:/Quati/develop/Nokia/QTBible'
@I don't know what cause this. But Volker writes a clue:
[quote author="Volker" date="1296165540"]Are formb.h and formb.cpp added to your project file?
The error message
bq. undeclared reference formB::formB(QWidget*).
leads me to the guess that formb.cpp is not compiled at all.
You can post your .pro file, we can check.[/quote]
He was right: my dialogabout class was not compiling.
I've posted my .pro, but I know that information is not sufficient to resolve my problem.
So I decided to invetigate the log to find references of my class. But the first lines of log says:@
Running build steps for project QTBible...
Configuration unchanged, skipping qmake step.
Starting: "C:/NokiaQtSDK/Symbian/SDK/epoc32/tools/make.exe" debug-gcce -w
C:\NokiaQtSDK\Symbian\SDK\epoc32\tools\make.exe: Entering directory `C:/Quati/develop/Nokia/QTBible'
.......
@