From e36c2304ca18b7a4354c8b5372b9cfe669dbd616 Mon Sep 17 00:00:00 2001 From: Justin Haywood Date: Thu, 10 Feb 2011 12:48:49 -0600 Subject: [PATCH] Implemented rowcount and colcount for PlaylistModel The rowCount and the colCount members of PlaylistModel are implemented the rowCount returns the number of items in the list and the colCount returns a constant 1 since there should only ever be one column. The parents are ignored because a flat list shouldn't have parents as you said. Let me know If I'm messing any of this up --- playlist_model.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/playlist_model.cpp b/playlist_model.cpp index 0726fe1..6d0fb17 100644 --- a/playlist_model.cpp +++ b/playlist_model.cpp @@ -42,3 +42,15 @@ QModelIndex PlaylistModel::parent( const QModelIndex &index ) const // No parents for any index - flat list return QModelIndex(); } +//========================================================= +int PlaylistModel::rowCount( const QModelIndex & parent) const +{ + // Number of Rows is equal to the number of items in the list + return items.size(); +} +//========================================================= +int PlaylistModel::colCount( const QModelIndex & parent) const +{ + // PlayList always has one column + return 1; +} -- 2.11.4.GIT