KDNSSD::DomainModel Class

class KDNSSD::DomainModel

Model for list of Zeroconf domains. More...

Header: #include <KDNSSD/DomainModel>
CMake: find_package(KF6 REQUIRED COMPONENTS DNSSD)
target_link_libraries(mytarget PRIVATE KF6::DNSSD)
Inherits: QAbstractItemModel

Public Functions

DomainModel(KDNSSD::DomainBrowser *browser, QObject *parent = nullptr)
virtual bool hasIndex(int row, int column, const QModelIndex &parent) const

Detailed Description

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(
     new KDNSSD::DomainBrowser(KDNSSD::DomainBrowser::Browsing)
     );
 QComboBox *domainCombo = new QComboBox();
 domainCombo->setModel(domainModel);

Member Function Documentation

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

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.

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

browser is the domain browser that will provide the domains to be listed by the model

parent is the parent object (see QObject documentation)

[virtual] bool DomainModel::hasIndex(int row, int column, const QModelIndex &parent) const