<div dir="ltr">Hi,<div><br></div><div>Jan is right, you have to use Q_OBJECT to use signals/slots in Qt.</div><div><br></div><div>An asynchronous pseudo code based on the example provided in MMQt source code would look like:</div><div><br></div><div>SomeQWidget::someMethod()</div><div>{</div><div>ModemManager::ModemMessaging::Ptr messaging = modemdevice->messagingInterface();<br></div><div><br></div><div><div>ModemManager::ModemMessaging::Message msg;</div><div>msg.number = "number";</div><div>msg.text = "message text";</div><div><br></div><div>QDBusReply<QString> sms = messaging->createMessage(msg);</div></div><div>ModemManager::Sms::Ptr tmp = messaging->findMessage(sms.value());<br></div><div>QDBusPendingReply<> reply = tmp->send();<br></div><div><br></div><div>// This is the important part:</div><div>QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(reply, this);<br></div><div><br></div><div>// This only works with Qt5:</div><div>connect(watcher, &QDBusPendingCallWatcher::finished, [reply, this]() {</div><div>    // This code run after the message has been sent.</div><div>    if (reply.isError()) {</div><div>        qDebug() << reply.error().message();</div><div>    }</div><div>});<br></div><div>}</div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">
<p style="margin:0px">Lamarque V. Souza</p>
<p style="margin:0px"><a href="http://planetkde.org/pt-br" target="_blank">http://planetkde.org/pt-br</a></p></div></div></div></div></div>
<br><div class="gmail_quote">On Thu, Jun 2, 2016 at 4:35 AM, Jan Grulich <span dir="ltr"><<a href="mailto:jgrulich@redhat.com" target="_blank">jgrulich@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<span class=""><br>
On pondělí 11. dubna 2016 11:11:52 CEST Charles A wrote:<br>
> Hi!<br>
> I have been using the MMQT api in order to send SMS messages.<br>
> I have been using MMQT version 5.2.2 and it works great! I recently found<br>
> an issue where the signalQuality (in ModemManager::Modem Interface) would<br>
> return 0 even though the signal quality returned by dbus was not 0.<br>
> Since then I decided to upgrade MMQT to a more recent version, I tried MMQT<br>
> 5.18.0 and my old code seem to not work at all with the MMQT 5.18.0<br>
> version.<br>
<br>
</span>The API changed a bit after modemmanager-qt became a KDE framework.<br>
<span class=""><br>
> After reading a bit, I stumbled upon the following bug report (<br>
> <a href="https://bugs.kde.org/show_bug.cgi?id=358261" rel="noreferrer" target="_blank">https://bugs.kde.org/show_bug.cgi?id=358261</a>) and I realized I need to use<br>
> to Async mode to make it work since I was using the sync method.<br>
><br>
> I wanted to know if there are any examples on how to use Async mode in<br>
> order to send an SMS message?<br>
<br>
</span>Unfortunately there is no example for that particular case, but if you go<br>
through plasma-nm, there's a lot of stuff using networkmanager-qt/<br>
modemmanager-qt code (check src/libs/models/networkmodel.cpp).<br>
<span class=""><br>
> I have been trying to use SIGNAL/SLOT method but I am not sure I am doing<br>
> it right. I am trying to connect to the signal without being a Q_OBJECT.<br>
<br>
</span>I think you need to derive your class from QObject to be able to use Qt's<br>
signal/slot mechanism.<br>
<br>
You can also send us your code so we can take a look and help you more with<br>
that.<br>
<br>
> Thank you!<br>
> Charles<br>
<br>
<br>
Regards,<br>
Jan<br>
<span class="HOEnZb"><font color="#888888">--<br>
Jan Grulich <<a href="mailto:jgrulich@redhat.com">jgrulich@redhat.com</a>><br>
Software Engineer, Desktop team<br>
Red Hat Czech<br>
_______________________________________________<br>
Kde-hardware-devel mailing list<br>
<a href="mailto:Kde-hardware-devel@kde.org">Kde-hardware-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/kde-hardware-devel" rel="noreferrer" target="_blank">https://mail.kde.org/mailman/listinfo/kde-hardware-devel</a><br>
</font></span></blockquote></div><br></div>