R
R
Rphoenix2018-12-29 05:17:19
Qt
Rphoenix, 2018-12-29 05:17:19

How to include a feature in a slot?

5c26d9062f9c4977821404.png
How to fix the error?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Ananiev, 2018-12-29
@SaNNy32

It is necessary to make the class declaration in the *.h file, and the implementation in *.cpp.

I
Ivan Pinezhaninov, 2018-12-29
@Ivan_Pinezhaninov

#include <QCoreApplication>
#include <QDebug>
#include <QTimer>

void foo()
{
  qDebug() << "Bingo";
}

int main(int argc, char *argv[])
{
  QCoreApplication a(argc, argv);

  QTimer timer;
  QObject::connect(&timer, &QTimer::timeout, std::bind(foo));
  timer.start(1000);

  return a.exec();
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question