Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <QtCore>
#include <memory>
int main(int argc, char** argv)
{
QCoreApplication app(argc, argv);
auto p = std::make_shared<int>(42);
auto t = new QTimer;
t->setSingleShot(true);
t->start(500);
QObject::connect(t, &QTimer::timeout, [p]() {
qDebug() << *p;
qApp->quit();
});
app.exec();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.