[plasmalnf] Add a description

- add a role for description
- change view to a table view
main
Adriaan de Groot 4 years ago
parent 258a14bea2
commit 58ea40c14d

@ -17,10 +17,9 @@
#include "utils/Logger.h" #include "utils/Logger.h"
#include "utils/Retranslator.h" #include "utils/Retranslator.h"
#include <QListView> #include <QHeaderView>
#include <QStyledItemDelegate>
#include <KPackage/Package> #include <QTableView>
#include <KPackage/PackageLoader>
PlasmaLnfPage::PlasmaLnfPage( Config* config, QWidget* parent ) PlasmaLnfPage::PlasmaLnfPage( Config* config, QWidget* parent )
: QWidget( parent ) : QWidget( parent )
@ -43,8 +42,9 @@ PlasmaLnfPage::PlasmaLnfPage( Config* config, QWidget* parent )
} ) } )
connect( this, &PlasmaLnfPage::plasmaThemeSelected, config, &Config::setTheme ); connect( this, &PlasmaLnfPage::plasmaThemeSelected, config, &Config::setTheme );
QListView* view = new QListView( this ); QTableView* view = new QTableView( this );
view->setUniformItemSizes( true ); view->verticalHeader()->hide();
view->horizontalHeader()->hide();
view->setModel( m_config->themeModel() ); view->setModel( m_config->themeModel() );
ui->verticalLayout->addWidget( view ); ui->verticalLayout->addWidget( view );

@ -126,6 +126,8 @@ ThemesModel::data( const QModelIndex& index, int role ) const
return item.id; return item.id;
case ShownRole: case ShownRole:
return item.show; return item.show;
case DescriptionRole:
return item.description;
default: default:
return QVariant(); return QVariant();
} }

@ -26,6 +26,7 @@ public:
LabelRole = Qt::DisplayRole, LabelRole = Qt::DisplayRole,
KeyRole = Qt::UserRole, KeyRole = Qt::UserRole,
ShownRole, ShownRole,
DescriptionRole,
ImageRole ImageRole
}; };

Loading…
Cancel
Save