fix parameter inversion,
[kdelibs.git] / dnssd / domainmodel.h
bloba27ce94036dc02a72c2c7f32de8b941bf436bf44
1 /* This file is part of the KDE project
3 * Copyright (C) 2008 Jakub Stachowski <qbast@go2.pl>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
21 #ifndef DNSSDDOMAINMODEL_H
22 #define DNSSDDOMAINMODEL_H
24 #include <QtCore/QAbstractItemModel>
25 #include <dnssd/dnssd_export.h>
27 namespace DNSSD
30 class DomainModelPrivate;
31 class DomainBrowser;
34 /**
35 \class DomainModel domainmodel.h DNSSD/DomainModel
37 DomainModel implements Qt Model interface around DomainBrowser to allow easy integration
38 of domain discovery into GUI.
39 Example of combo box showing list of browsing domains:
40 \code
41 DNSSD::DomainModel* m=new DomainModel(new DNSSD::DomainBrowser(DNSSD::DomainBrowser::Browsing));
42 QComboBox *c=new QComboBox();
43 c->setModel(m);
44 \endcode
46 \since 4.1
47 @short Model for list of Zeroconf domains
48 @author Jakub Stachowski
51 class KDNSSD_EXPORT DomainModel : public QAbstractItemModel
53 Q_OBJECT
55 public:
56 /**
57 Creates model for given domain browses and starts browsing for domain. The model becomes parent of the
58 browser so there is no need to delete it afterwards.
59 */
60 explicit DomainModel(DomainBrowser* browser, QObject* parent=0);
61 virtual ~DomainModel();
63 virtual int columnCount(const QModelIndex& parent = QModelIndex() ) const;
64 virtual int rowCount(const QModelIndex& parent = QModelIndex() ) const;
65 virtual QModelIndex parent(const QModelIndex& index ) const;
66 virtual QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex() ) const;
67 virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole ) const;
68 virtual bool hasIndex(int row, int column, const QModelIndex &parent) const;
71 private:
72 DomainModelPrivate* const d;
73 friend struct DomainModelPrivate;
79 #endif