From f22b64f2670ac45ac4c9b7c0c760bf5752086ede Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Mon, 1 Feb 2021 00:50:48 -0500 Subject: final commit for qt --- library.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'library.cpp') diff --git a/library.cpp b/library.cpp index ffba966..f1baf83 100644 --- a/library.cpp +++ b/library.cpp @@ -22,6 +22,24 @@ Library::Library(QObject *parent) { } +QVariant Library::headerData(int section, Qt::Orientation orientation, int role) const +{ + if (role == Qt::DisplayRole) { + switch (section) { + case 0: + return "Name"; + case 1: + return "Artist"; + case 2: + return "Album"; + } + } else if (role == Qt::SizeHintRole) { + return QSize(500, 29); + } + return QAbstractItemModel::headerData(section, orientation, role); +} + + int Library::rowCount(const QModelIndex &parent) const { // For list models only the root node (an invalid parent) should return the list's size. For all -- cgit v1.2.3