Paste #p9coOsCJS

    QSqlDriver *driver = db.driver();
    if (!driver->subscribeToNotification(QStringLiteral("data_changed")) ||
            !driver->subscribeToNotification(QStringLiteral("new_order")) ||
            !driver->subscribeToNotification(QStringLiteral("updated_order"))) {
        qWarning() << "FAILED to subscribe to notification" << driver->lastError().text();
        return false;
    }

    connect(driver, static_cast<void(QSqlDriver::*)(const QString &, QSqlDriver::NotificationSource, const QVariant &)>(&QSqlDriver::notification), this,
            [=] (const QString &name, QSqlDriver::NotificationSource source, const QVariant &payload) {
        qDebug() << "DB notification:" << name << source << payload;
        if (name == QLatin1String("data_changed")) {
            m_apiV1->invalidateCache(payload.toString());
            m_orders->broadcastDeliveryBusy(payload.toString().toInt());
        } else if (name == QLatin1String("new_order")) {
            m_orders->newOrder(payload.toString());
        } else if (name == QLatin1String("updated_order")) {
            m_orders->updatedOrder(payload.toString());
        } else {
            qDebug() << "DB notification UNKNOWN:" << name << source << payload;
        }
    });