X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Fmessagemodel.h;fp=src%2Fclient%2Fmessagemodel.h;h=f4a7655575ed5890c35c12880abcc9e1932d6528;hp=623efa667467f81c99c05332cd38516838af4714;hb=42406861fbe570ed1fb45e9da39ff9a0de73c284;hpb=d5071b9120307cf45f2db1870cb2a54f50d08a45 diff --git a/src/client/messagemodel.h b/src/client/messagemodel.h index 623efa66..f4a76555 100644 --- a/src/client/messagemodel.h +++ b/src/client/messagemodel.h @@ -56,7 +56,7 @@ public: MessageModel(QObject *parent); - inline QModelIndex index(int row, int column, const QModelIndex &/*parent*/ = QModelIndex()) const { return createIndex(row, column); } + inline QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; inline QModelIndex parent(const QModelIndex &) const { return QModelIndex(); } inline int rowCount(const QModelIndex &parent = QModelIndex()) const { return parent.isValid() ? 0 : messageCount(); } inline int columnCount(const QModelIndex &/*parent*/ = QModelIndex()) const { return 3; } @@ -111,6 +111,14 @@ private: QHash _messagesWaiting; }; +// inlines +QModelIndex MessageModel::index(int row, int column, const QModelIndex &parent) const { + if(row < 0 || row >= rowCount(parent) || column < 0 || column >= columnCount(parent)) + return QModelIndex(); + + return createIndex(row, column); +} + // ************************************************** // MessageModelItem // **************************************************