Hi..
Myself trying to write a program in Qt connecting a function to a button in Qt5.
#include <QApplication>
#include <QtGui>
#include <QPushButton>
static void insert()
{
qDebug() << "pressed";
}
int main(int argc,char *argv[])
{
QApplication app(argc,argv);
QPushButton *button=new QPushButton("button");
button->setGeometry(50,100,150,80);
QObject::connect(button,&QPushButton::clicked,insert());
button->show();
}
But I am getting errors like
main.cc:23:39: error: within this context
main.cc:23:55: error: invalid use of void expression
make: *** [main.o] Error 1
Please help…
[code tags and solved, added, koahnig]
↧