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

@ -31,9 +31,11 @@ QueryTab::QueryTab(MainWindow *win, QWidget *parent) :
{
ui->setupUi(this);
connect(&m_dbConnection, &ASyncDBConnection::onStateChanged, this, &QueryTab::connectionStateChanged);
connect(&m_dbConnection, &ASyncDBConnection::onNotice, this, &QueryTab::receiveNotice);
m_dbConnection.setStateChangeReceiver(
[this, win](auto s) { win->QueueTask([this, s]() { connectionStateChanged(s); }); });
m_dbConnection.setNoticeReceiver(
[this, win](auto n) { win->QueueTask([this, n]() { receiveNotice(n); }); });
QFont font;
font.setFamily("Source Code Pro");
font.setFixedPitch(true);