From 58ea40c14d6933fe9fd591b746c7ba64d2c9f8d8 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 17 Nov 2020 12:41:50 +0100 Subject: [PATCH] [plasmalnf] Add a description - add a role for description - change view to a table view --- src/modules/plasmalnf/PlasmaLnfPage.cpp | 12 ++++++------ src/modules/plasmalnf/ThemeInfo.cpp | 2 ++ src/modules/plasmalnf/ThemeInfo.h | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/modules/plasmalnf/PlasmaLnfPage.cpp b/src/modules/plasmalnf/PlasmaLnfPage.cpp index 20c2a5569..3dc367fe5 100644 --- a/src/modules/plasmalnf/PlasmaLnfPage.cpp +++ b/src/modules/plasmalnf/PlasmaLnfPage.cpp @@ -17,10 +17,9 @@ #include "utils/Logger.h" #include "utils/Retranslator.h" -#include - -#include -#include +#include +#include +#include PlasmaLnfPage::PlasmaLnfPage( Config* config, QWidget* parent ) : QWidget( parent ) @@ -43,8 +42,9 @@ PlasmaLnfPage::PlasmaLnfPage( Config* config, QWidget* parent ) } ) connect( this, &PlasmaLnfPage::plasmaThemeSelected, config, &Config::setTheme ); - QListView* view = new QListView( this ); - view->setUniformItemSizes( true ); + QTableView* view = new QTableView( this ); + view->verticalHeader()->hide(); + view->horizontalHeader()->hide(); view->setModel( m_config->themeModel() ); ui->verticalLayout->addWidget( view ); diff --git a/src/modules/plasmalnf/ThemeInfo.cpp b/src/modules/plasmalnf/ThemeInfo.cpp index 86f7ad344..da5ca7f44 100644 --- a/src/modules/plasmalnf/ThemeInfo.cpp +++ b/src/modules/plasmalnf/ThemeInfo.cpp @@ -126,6 +126,8 @@ ThemesModel::data( const QModelIndex& index, int role ) const return item.id; case ShownRole: return item.show; + case DescriptionRole: + return item.description; default: return QVariant(); } diff --git a/src/modules/plasmalnf/ThemeInfo.h b/src/modules/plasmalnf/ThemeInfo.h index 474bb3ff8..0c4f2fd34 100644 --- a/src/modules/plasmalnf/ThemeInfo.h +++ b/src/modules/plasmalnf/ThemeInfo.h @@ -26,6 +26,7 @@ public: LabelRole = Qt::DisplayRole, KeyRole = Qt::UserRole, ShownRole, + DescriptionRole, ImageRole };