From 64fec66d358ead43784e085b424375f65b145307 Mon Sep 17 00:00:00 2001 From: Hennadii Chernyshchyk Date: Thu, 28 Oct 2021 22:33:17 +0300 Subject: [PATCH] Fix memory leak in README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8256f1f..95ab938 100644 --- a/README.md +++ b/README.md @@ -74,17 +74,17 @@ The following example shows a simple application that will run without a window int main(int argc, char *argv[]) { - QApplication a(argc, argv); + QApplication app(argc, argv); - auto hotkey = new QHotkey(QKeySequence("ctrl+alt+Q"), true, &a);//The hotkey will be automatically registered - qDebug() << "Is Registered: " << hotkey->isRegistered(); + QHotkey hotkey(QKeySequence("Ctrl+Alt+Q"), true, &app); //The hotkey will be automatically registered + qDebug() << "Is segistered:" << hotkey.isRegistered(); - QObject::connect(hotkey, &QHotkey::activated, qApp, [&](){ + QObject::connect(&hotkey, &QHotkey::activated, qApp, [&](){ qDebug() << "Hotkey Activated - the application will quit now"; qApp->quit(); }); - return a.exec(); + return app.exec(); } ```