Skip to content

Instantly share code, notes, and snippets.

@suy
Created March 17, 2017 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suy/61bdcbb56015c67ea0c4b0b9fa71569a to your computer and use it in GitHub Desktop.
Save suy/61bdcbb56015c67ea0c4b0b9fa71569a to your computer and use it in GitHub Desktop.
#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