The ASyncDBConnection class uses C++ std::function callbacks now for reporting notices and state changes.

While I like some aspects of Qt's signals and slots system I prefer to
rely on more standard C++.
This commit is contained in:
eelke 2017-12-28 07:28:21 +01:00
parent 2705a3417b
commit 23e307f93a
4 changed files with 67 additions and 36 deletions

View file

@ -11,8 +11,10 @@ DatabaseWindow::DatabaseWindow(QWidget *parent) :
{
ui->setupUi(this);
connect(&m_dbConnection, &ASyncDBConnection::onStateChanged, this, &DatabaseWindow::connectionStateChanged);
connect(&m_dbConnection, &ASyncDBConnection::onNotice, this, &DatabaseWindow::receiveNotice);
m_dbConnection.setStateChangeReceiver(
[this](auto s) { QueueTask([this, s]() { connectionStateChanged(s); }); });
m_dbConnection.setNoticeReceiver(
[this](auto n) { QueueTask([this, n]() { receiveNotice(n); }); });
}
DatabaseWindow::~DatabaseWindow()