PDA

View Full Version : Simple Plot example and using signal gives an error



Matapuce
8th September 2015, 09:02
Hello everybody,

Recently, I started to program with Qt and yesterday with Qwt.
My aim was to start with an example simpleplot and add some code to understand how Qwt works.
Qwt is a nice and powerfull library which I would like to use for my small projects.

First exercice was to draw a plot after pushing a button by using slot and signals.
Unfortunately when I added a new class and compile I received 'slot' does not name a type as an error.

In my previous Qt programming, I used the slot and signals systems without having this problem.

Does anybody have an idea what I am doing wrong?
I kindly appreciate any hints which will bring me to solve this small problem.

Here the .h code:



#ifndef ROOTWINDOW_H
#define ROOTWINDOW_H

#include <QMainWindow>
#include <QObject>
#include <QWidget>

class RootWindow : public QWidget
{
Q_OBJECT

public:
explicit RootWindow(QWidget *parent = 0);

private:
int myvalue;

public slots:
void Slot_PopUp();

};

#endif // ROOTWINDOW_H


and the .cpp


#include "rootwindow.h"

RootWindow::RootWindow(QWidget *parent) : QWidget(parent)
{

}

void RootWindow::Slot_PopUp()
{

}


simpleplot.cpp hasn't changed except the rootmenu include.

Thanks in advance for your Help,
Damien

Uwe
8th September 2015, 14:26
This is because of "CONFIG += no_keywords". See at the end of http://doc.qt.io/qt-4.8/signalsandslots.html.
Usually this flag is not set in the application project file, but I guess you were working in the Qwt build environment.

Uwe

Matapuce
9th September 2015, 10:14
Hello Uwe,

thanks for your help, it was exactly the problem.
For the moment I just want to get used to Qwt by playing around with simpleplot.
After this phase, I will integrate this library to my project.
I already started but it doesn't work so far, I will open another thread for that but there is no rush.

Thanks again and I am back to the race.
Damien