From d3439845817beb78b6036762ee42b428069e0482 Mon Sep 17 00:00:00 2001 From: Arno Date: Sat, 17 Feb 2018 05:54:31 +0100 Subject: Introduce new class CollectionWidget It's intended to be the base class/widget for different views of the collection, eg. Artists or Songs. Each collection view should have its own widget to make it easier to keep the state when switching between collection views. Let's see how it turns out :) --- collectionwidget.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 collectionwidget.cpp (limited to 'collectionwidget.cpp') diff --git a/collectionwidget.cpp b/collectionwidget.cpp new file mode 100644 index 0000000..a27041a --- /dev/null +++ b/collectionwidget.cpp @@ -0,0 +1,18 @@ +#include +#include +#include +#include + +#include "collectionwidget.h" + +CollectionWidget::CollectionWidget(QWidget *parent) : QWidget(parent){ + mView = new QTreeView; + mModel = new QStandardItemModel(this); + mProxy = new QSortFilterProxyModel(this); + mProxy->setSourceModel(mModel); + mView->setModel(mProxy); + mView->setSortingEnabled(true); + QHBoxLayout *mainLayout = new QHBoxLayout; + mainLayout->addWidget(mView); + setLayout(mainLayout); +} -- cgit v1.2.3-70-g09d2