class ServiceModel


Module dnssd
Namespace DNSSD
Class ServiceModel
Inherits QAbstractItemModel
\class ServiceModel servicemodel.h DNSSD/ServiceModel

ServiceModel implements Qt Model interface around ServiceBrowser to allow easy integration of service discovery into GUI. Example of combo box showing list of HTTP servers on local network:

DNSSD.ServiceModel* m=new ServiceModel(new DNSSD.ServiceBrowser("_http._tcp"));
QComboBox *c=new QComboBox();
c->setModel(m);

After user makes the selection, application typically needs pointer to selected service in order to get host name and port. RemoteService.Ptr can be obtained from QModelIndex using:

void onSelected(const QModelIndex& selection) {
DNSSD.RemoteService.Ptr service=selection.data(DNSSD.ServiceModel.ServicePtrRole).
value();

\since 4.1 Model for list of Zeroconf services Author Jakub Stachowski



enums

enum details

methods