I’m new of Qt and I try to connect a signal event of a button with a method defined in my derived classes of QThread. So I have my Qthread class with the definition of run method and a slots
class Sensor : public QThread
{
Q_OBJECT
private:
void run() {//...cycle infinite// };
private slots:
void ExecSlot() {...};
};
and in the main I have
QApplication a(argc, argv);
Sensor *s1= new Sensor;
QWidget *window = new QWidget;
QPushButton *button = new QPushButton("b11 ");
QPushButton *button1 = new QPushButton("b2 ");
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(button);
layout->addWidget(button1);
window->setLayout(layout);
window->show();
s1->run();
QObject::connect(button, SIGNAL(clicked()), eas1, SLOT(ExecSlot()));
return a.exec();
}
After compiling I have this error: QObject::connect: No such slot QThread::execslot().
How can I Implement this functionality?
Thanks
Edit: please use the @ code tags around code sections; Andre
↧