Slot Declaration rare problem to resolve[SOLVED]
-
Hi.
I am finishing to code custom MainWindow class:
mainwindow.h file:
@#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QFileDialog>
#include "qwt_plot_canvas.h"
#include "lib/wfdb.h"
#include "lib/ecgmap.h"
#include "curvedata.h"
#include "qwt_plot_grid.h"
//temporary
#include <QDebug>namespace Ui {
class MainWindow;
}class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
void init_plot();
void process();
public slots:
void LoadData();
private:
Ui::MainWindow *ui;
CurveData *cvData_in;
CurveData *cvData_out;
QwtPlotCurve *qwtpltcrv_in;
QwtPlotCurve *qwtpltcrv_out;
int lp[LP_SIZE];
char *db_name;
};#endif // MAINWINDOW_H@
the slot LoadData is definde in mainwindow.cpp file as:
void MainWindow::LoadData()
{
...
}as well as another functions:
but when compiling as usual using
Qt 4.8.0 for Desktop - MinGW ( Qt SDK ), Mingw as GCC for windows targetsCompile output contains next notification about slot declaration:
In file included from main.cpp:2:
mainwindow.h:26: error: expected ':' before 'slots'
mainwindow.h:27: error: expected primary-expression before 'void'
mainwindow.h:27: error: ISO C++ forbids declaration of 'slots' with no type
mainwindow.h:27: error: expected ';' before 'void'Would somebody help me / point out why such problem?
How to resolve and to get succesfull compilation?Thnaks in advance,
Paul -
What happens when you don't use the public slots notation, but Q_SLOTS?
does qmake run successfully? -
bq. What happens when you don’t use the public slots notation, but Q_SLOTS?
does qmake run successfully?--Thank you.The code after replacing public slots notation to Q_SLOTS compiled and run successfully.That is because of includes of QWT in the project I guess with high likelihood and having a reason.
Solved.