I'm new in Qt and I'm trying to create a custom QSlider
class (it inherits from QSlider
). This works perfectly but when I try to create new signals and slots, it doesn'ts work. Actually, I think it's the Q_OBJECT
macro which doesn't work... Indeed, I get this message from the compiler :
erreur : 1 duplicate symbol for architecture x86_64 erreur : linker command failed with exit code 1 (use -v to see invocation)
If I remove Q_OBJECT
it doesn't work either as the compilers tells me :
erreur : Error: Class declaration lacks Q_OBJECT macro.
Finally, if I make my class inherit from QWidget
, all is working even the Q_OBJECT
macro...
Here is my .h
code :
#include <QWidget>
#include <QSlider>
class mySlider : public QSlider
{
Q_OBJECT
public:
explicit mySlider();
signals:
void test();
public slots:
void nTest();
};
Here is my .cpp
code (there isn't much things, I'm only trying to make this simple code work for now) :
#include "myslider.h"
mySlider::mySlider()
{
}
void mySlider::test(){
}
void mySlider::nTest() {
}
Aucun commentaire:
Enregistrer un commentaire