hi
in the following code the signal is not connected to slot.
#include <QApplication>
#include <QtGui>
{
public slots:
void hi();
public:
};
{
connect(this, SIGNAL(clicked()), this, SLOT(hi()));
}
void push::hi()
{
qDebug()<<"hioo";
}
int main(int argc, char *argv[])
{
push W;
W.show();
return app.exec();
}
#include <QApplication>
#include <QtGui>
class push : public QPushButton
{
public slots:
void hi();
public:
push(QWidget *parent=0);
};
push::push(QWidget *parent) :
QPushButton(parent)
{
connect(this, SIGNAL(clicked()), this, SLOT(hi()));
}
void push::hi()
{
qDebug()<<"hioo";
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
push W;
W.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
this code compiles and executes but gives the warning
Object::connect: No such slot QPushButton::hi()
where did the code wnt wrong
Bookmarks