KDNSSD 5.109.0
Public Member Functions | List of all members
KDNSSD::DomainModel

Model for list of Zeroconf domains. More...

#include <KDNSSD/DomainModel>

Public Member Functions

 DomainModel (DomainBrowser *browser, QObject *parent=nullptr)
 Creates a model for given domain browser and starts browsing for domains.
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
virtual bool hasIndex (int row, int column, const QModelIndex &parent) const
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const override
 
QModelIndex parent (const QModelIndex &index) const override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 

Detailed Description

Model for list of Zeroconf domains.

This class provides a Qt Model for DomainBrowser to allow easy integration of domain discovery into a GUI. For example, to provide a combo box listing available domains, you can do:

KDNSSD::DomainModel *domainModel = new DomainModel(
);
QComboBox *domainCombo = new QComboBox();
domainCombo->setModel(domainModel);
Browses recommended domains for browsing or publishing to.
Definition domainbrowser.h:44
@ Browsing
Domains recommended for browsing for services on (using ServiceBrowser)
Definition domainbrowser.h:52
Model for list of Zeroconf domains.
Definition domainmodel.h:41
Since
4.1
Author
Jakub Stachowski

Constructor & Destructor Documentation

◆ DomainModel()

KDNSSD::DomainModel::DomainModel ( DomainBrowser browser,
QObject *  parent = nullptr 
)
explicit

Creates a model for given domain browser and starts browsing for domains.

The model takes ownership of the browser, so there is no need to delete it afterwards.

You should not call DomainBrowser::startBrowse() on browser before passing it to DomainModel.

Parameters
browserthe domain browser that will provide the domains to be listed by the model
parentthe parent object (see QObject documentation)

Member Function Documentation

◆ columnCount()

int KDNSSD::DomainModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const
override
Reimplemented from superclass.

◆ data()

QVariant KDNSSD::DomainModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
override
Reimplemented from superclass.

◆ hasIndex()

virtual bool KDNSSD::DomainModel::hasIndex ( int  row,
int  column,
const QModelIndex &  parent 
) const
virtual
Reimplemented from superclass.

◆ index()

QModelIndex KDNSSD::DomainModel::index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const
override
Reimplemented from superclass.

◆ parent()

QModelIndex KDNSSD::DomainModel::parent ( const QModelIndex &  index) const
override
Reimplemented from superclass.

◆ rowCount()

int KDNSSD::DomainModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
override
Reimplemented from superclass.