I've got such piece of code:
przystanki.h
#ifndef PRZYSTANKI_H
#define PRZYSTANKI_H
#include "component.h"
class Przystanki : public Component
{
public:
Przystanki(QWidget *parent = 0);
signals:
void deletePosition(QString);
public slots:
void deleteListItem();
void addListItem(QString label);
void createListItem(QString label, DodajPrzystanek* elem);
};
#endif // PRZYSTANKI_H
component.h
#ifndef COMPONENT_H
#define COMPONENT_H
#include <QListWidget>
#include <QGroupBox>
#include "dodajprzystanek.h"
class Component : public QGroupBox
{
Q_OBJECT
public:
explicit Component(QString name, QWidget *parent = 0);
QListWidget* list;
};
#endif // COMPONENT_H
fragment which uses it:
MyWindow::MyWindow(QWidget *parent) :
QMainWindow(parent)
{
webView = new MyWebView(this);
mainlayout = new QGridLayout();
mainlayout->addWidget(webView, 0,0);
Przystanki *stop = new Przystanki(this);
mainlayout->addWidget(stop, 0, 1);
QHBoxLayout* bottom = new QHBoxLayout();
//bottom->addWidget(new QLabel("Linie"));
bottom->addWidget(new Component("Autobusy"));
bottom->addWidget(new Component("Linie"));
QHBoxLayout* hrightCorner = new QHBoxLayout();
QVBoxLayout* rightCorner = new QVBoxLayout();
rightCorner->addStretch(1);
rightCorner->addWidget(new QPushButton("Start", this));
//QLabel* label = new QLabel("Labelka");
//rightCorner->addWidget(label);
rightCorner->addStretch(1);
hrightCorner->addLayout(rightCorner);
mainlayout->addLayout(bottom, 1, 0);
mainlayout->addLayout(hrightCorner, 1, 1);
hrightCorner->setAlignment(Qt::AlignCenter);
this->setCentralWidget(new QWidget);
this->centralWidget()->setLayout(mainlayout);
connect(webView, SIGNAL(getMapPosition(QString)), stop, SLOT(addListItem(QString)));
connect(stop, SIGNAL(deletePosition(QString)), webView, SLOT(deleteMarker(QString)));
}
What I get is:
loaded the Generic plugin
Object::connect: No such slot Component::addListItem(QString)
Object::connect: No such signal Component::deletePosition(QString)
It happend after I moved definitions of slots and signals from Component to it's derived class Przystanki. I've removed whole build directory, run clean, run qmake and build one more time and it didn't help. Can anyone explain to me what I'm doing wrong?