KDNSSD

servicemodel.h
1 /*
2  This file is part of the KDE project
3 
4  SPDX-FileCopyrightText: 2008 Jakub Stachowski <[email protected]>
5 
6  SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8 
9 #ifndef KDNSSDSERVICEMODEL_H
10 #define KDNSSDSERVICEMODEL_H
11 
12 #include <QAbstractItemModel>
13 #include <dnssd/kdnssd_export.h>
14 #include <dnssd/remoteservice.h>
15 
16 namespace KDNSSD
17 {
18 
19 struct ServiceModelPrivate;
20 class ServiceBrowser;
21 
53 class KDNSSD_EXPORT ServiceModel : public QAbstractItemModel
54 {
55  Q_OBJECT
56 
57 public:
58 
61  ServicePtrRole = 0xA06519DE
62  };
63 
70  enum ModelColumns {
71  ServiceName = 0,
72  Host = 1,
73  Port = 2
74  };
75 
86  explicit ServiceModel(ServiceBrowser *browser, QObject *parent = nullptr);
87 
88  ~ServiceModel() override;
89 
91  int columnCount(const QModelIndex &parent = QModelIndex()) const override;
93  int rowCount(const QModelIndex &parent = QModelIndex()) const override;
95  QModelIndex parent(const QModelIndex &index) const override;
97  QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
99  QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
101  QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
103  virtual bool hasIndex(int row, int column, const QModelIndex &parent) const;
104 
105 private:
106  ServiceModelPrivate *const d;
107  friend struct ServiceModelPrivate;
108 
109 };
110 
111 }
112 
113 #endif
Model for list of Zeroconf services.
Definition: servicemodel.h:53
DisplayRole
AdditionalRoles
The additional data roles provided by this model.
Definition: servicemodel.h:60
Browses for network services advertised over DNS-SD.
Orientation
ModelColumns
The default columns for this model.
Definition: servicemodel.h:70
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Aug 13 2020 22:40:26 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.