examples: port dbus examples to new connection style

Task-number: QTBUG-106893
Change-Id: Ic857f694b836fba30e41ef0a40107917bd05b64c
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Samuel Gaist 2022-09-22 22:37:03 +02:00
parent 93f15f81c6
commit 6457f1ee71

View File

@ -14,12 +14,16 @@ ChatMainWindow::ChatMainWindow()
setupUi(this); setupUi(this);
sendButton->setEnabled(false); sendButton->setEnabled(false);
connect(messageLineEdit, SIGNAL(textChanged(QString)), connect(messageLineEdit, &QLineEdit::textChanged,
this, SLOT(textChangedSlot(QString))); this, &ChatMainWindow::textChangedSlot);
connect(sendButton, SIGNAL(clicked(bool)), this, SLOT(sendClickedSlot())); connect(sendButton, &QPushButton::clicked,
connect(actionChangeNickname, SIGNAL(triggered(bool)), this, SLOT(changeNickname())); this, &ChatMainWindow::sendClickedSlot);
connect(actionAboutQt, SIGNAL(triggered(bool)), this, SLOT(aboutQt())); connect(actionChangeNickname, &QAction::triggered,
connect(qApp, SIGNAL(lastWindowClosed()), this, SLOT(exiting())); this, &ChatMainWindow::changeNickname);
connect(actionAboutQt, &QAction::triggered,
this, &ChatMainWindow::aboutQt);
connect(qApp, &QApplication::lastWindowClosed,
this, &ChatMainWindow::exiting);
// add our D-Bus interface and connect to D-Bus // add our D-Bus interface and connect to D-Bus
new ChatAdaptor(this); new ChatAdaptor(this);
@ -29,7 +33,8 @@ ChatMainWindow::ChatMainWindow()
iface = new org::example::chat(QString(), QString(), QDBusConnection::sessionBus(), this); iface = new org::example::chat(QString(), QString(), QDBusConnection::sessionBus(), this);
//connect(iface, SIGNAL(message(QString,QString)), this, SLOT(messageSlot(QString,QString))); //connect(iface, SIGNAL(message(QString,QString)), this, SLOT(messageSlot(QString,QString)));
QDBusConnection::sessionBus().connect(QString(), QString(), "org.example.chat", "message", this, SLOT(messageSlot(QString,QString))); QDBusConnection::sessionBus().connect(QString(), QString(), "org.example.chat", "message", this, SLOT(messageSlot(QString,QString)));
connect(iface, SIGNAL(action(QString,QString)), this, SLOT(actionSlot(QString,QString))); connect(iface, &org::example::chat::action,
this, &ChatMainWindow::actionSlot);
NicknameDialog dialog; NicknameDialog dialog;
dialog.cancelButton->setVisible(false); dialog.cancelButton->setVisible(false);