29 #ifndef IRCUSERMODEL_H 30 #define IRCUSERMODEL_H 34 #include <QtCore/qmetatype.h> 35 #include <QtCore/qstringlist.h> 36 #include <QtCore/qabstractitemmodel.h> 43 class IrcUserModelPrivate;
48 Q_PROPERTY(
int count READ count NOTIFY countChanged)
49 Q_PROPERTY(
bool empty READ isEmpty NOTIFY emptyChanged)
50 Q_PROPERTY(QStringList names READ names NOTIFY namesChanged)
51 Q_PROPERTY(QStringList titles READ titles NOTIFY titlesChanged)
52 Q_PROPERTY(QList<
IrcUser*> users READ users NOTIFY usersChanged)
53 Q_PROPERTY(
Irc::DataRole displayRole READ displayRole WRITE setDisplayRole)
54 Q_PROPERTY(
IrcChannel* channel READ channel WRITE setChannel NOTIFY channelChanged)
55 Q_PROPERTY(
Irc::SortMethod sortMethod READ sortMethod WRITE setSortMethod)
56 Q_PROPERTY(Qt::SortOrder sortOrder READ sortOrder WRITE setSortOrder)
67 QStringList names() const;
68 QStringList titles() const;
70 Q_INVOKABLE
IrcUser* get(
int index) const;
71 Q_INVOKABLE
IrcUser* find(const QString& name) const;
72 Q_INVOKABLE
bool contains(const QString& name) const;
73 Q_INVOKABLE
int indexOf(
IrcUser* user) const;
75 Irc::DataRole displayRole() const;
76 void setDisplayRole(
Irc::DataRole role);
78 Irc::SortMethod sortMethod() const;
79 void setSortMethod(
Irc::SortMethod method);
81 Qt::SortOrder sortOrder() const;
82 void setSortOrder(Qt::SortOrder order);
84 QModelIndex index(
IrcUser* user) const;
85 IrcUser* user(const QModelIndex& index) const;
87 QHash<
int, QByteArray> roleNames() const;
88 int rowCount(const QModelIndex& parent = QModelIndex()) const;
89 QVariant data(const QModelIndex& index,
int role = Qt::DisplayRole) const;
90 QModelIndex index(
int row,
int column = 0, const QModelIndex& parent = QModelIndex()) const;
94 void sort(
int column = 0, Qt::SortOrder order = Qt::AscendingOrder);
95 void sort(
Irc::SortMethod method, Qt::SortOrder order = Qt::AscendingOrder);
100 void aboutToBeAdded(
IrcUser* user);
101 void aboutToBeRemoved(
IrcUser* user);
102 void countChanged(
int count);
103 void emptyChanged(
bool empty);
104 void namesChanged(const QStringList& names);
105 void titlesChanged(const QStringList& titles);
106 void usersChanged(const QList<
IrcUser*>& users);
110 virtual
bool lessThan(
IrcUser* one,
IrcUser* another,
Irc::SortMethod method) const;
113 friend class IrcUserLessThan;
114 friend class IrcChannelPrivate;
115 friend class IrcUserGreaterThan;
116 QScopedPointer<IrcUserModelPrivate> d_ptr;
123 Q_DECLARE_METATYPE(IRC_PREPEND_NAMESPACE(
IrcUserModel*))
125 #endif // IRCUSERMODEL_H Keeps track of user status on a channel.
Definition: ircuser.h:42
Keeps track of channel users.
Definition: ircusermodel.h:45
Keeps track of channel status.
Definition: ircchannel.h:40
The base class of all messages.
Definition: ircmessage.h:47
Miscellaneous identifiers used throughout the library.
Definition: irc.h:39