Slot
-
wrote on 22 Feb 2011, 11:21 last edited by
Yes.
-
wrote on 22 Feb 2011, 12:06 last edited by
Of course!
Each form should be a class, and a class should have header and cpp (if its not pure inline or template).
The designer is only some helper tool to not do all the coding for ui representation by hand (what I personally prefer). -
wrote on 23 Feb 2011, 05:31 last edited by
am not able to get it done...how could I attach my code with the message to get help ?
-
wrote on 23 Feb 2011, 09:31 last edited by
Am getting error after compiling.The code is as follows:
@#include <QtGui>#include "mainwindow.h"
#include "subWindow.h"int main(int argc , char *argv[])
{
QApplication app(argc,argv);mainwindow mWindow; mWindow.show(); subWindow window; window.show(); QObject::connect( &mWindow, SIGNAL(Clicked()), &window, SLOT(on_next_clicked())); return app.exec();
}
@the error is:
main.cpp: In function ‘int main(int, char**)’:
main.cpp:10: error: ‘mainwindow’ was not declared in this scope
main.cpp:10: error: expected ‘;’ before ‘mWindow’
main.cpp:11: error: ‘mWindow’ was not declared in this scope
make: *** [main.o] Error 1please help
-
wrote on 23 Feb 2011, 10:15 last edited by
Are you sure this is the whole output? It seems like something is wrong in your mainwindow.h. Please post both the complete compilation output, and the contents of mainwindow.h.
-
wrote on 23 Feb 2011, 12:08 last edited by
[quote author="Revu" date="1298453513"]
main.cpp: In function ‘int main(int, char**)’:
main.cpp:10: error: ‘mainwindow’ was not declared in this scope
main.cpp:10: error: expected ‘;’ before ‘mWindow’
main.cpp:11: error: ‘mWindow’ was not declared in this scope
make: *** [main.o] Error 1please help[/quote]
Seems that you should read some C++ tutorial first. This are some basic error messages from the compiler. You must be familiar with header and implementation files before you can use Qt successfully.
And as Andre already mentioned, it's hard to analyze the error without the contents of mainwindow.h.
-
wrote on 23 Feb 2011, 12:10 last edited by
the code is as below:
@#ifdef MAINWINDOW_H
#define MAINWINDOW_H#include<QDialog>
#include"subWindow.h"
#include "ui_main.h"namespace Ui
{
class mainwindow;
}class mainwindow:public QDialog,public Ui::main
{
Q_OBJECTpublic:
explicit mainwindow(QWidget *parent=0);
~mainwindow();private slots:
void on_next_click();};
#endif@ -
wrote on 23 Feb 2011, 12:19 last edited by
Am very new to coding so please me for my mistakes.
-
wrote on 23 Feb 2011, 12:37 last edited by
Change this:
@
#ifdef MAINWINDOW_H
#define MAINWINDOW_H
@to this:
@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
@ -
wrote on 23 Feb 2011, 12:38 last edited by
Good catch, Volker!
26/28