Slot
-
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). -
am not able to get it done...how could I attach my code with the message to get help ?
-
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
-
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.
-
[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.
-
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@ -
@Volker:Thank You for your advice.
Can you suggest me few online tutorials to understand the concepts clearly?
-
Am very new to coding so please me for my mistakes.
-
Change this:
@
#ifdef MAINWINDOW_H
#define MAINWINDOW_H
@to this:
@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
@ -
Good catch, Volker!
-
@Volker: thank you so much I missed to check that.