[plasmalnf] Very basic combo-box based UI
This commit is contained in:
parent
aaa56b6903
commit
1f57a0ddda
@ -43,6 +43,8 @@ Config::Config( QObject* parent )
|
|||||||
filter->setFilterRole( ThemesModel::ShownRole );
|
filter->setFilterRole( ThemesModel::ShownRole );
|
||||||
filter->setFilterFixedString( QStringLiteral( "true" ) );
|
filter->setFilterFixedString( QStringLiteral( "true" ) );
|
||||||
filter->setSourceModel( m_themeModel );
|
filter->setSourceModel( m_themeModel );
|
||||||
|
filter->setSortRole( ThemesModel::LabelRole );
|
||||||
|
filter->sort( 0 );
|
||||||
|
|
||||||
m_filteredModel = filter;
|
m_filteredModel = filter;
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,8 @@
|
|||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/Retranslator.h"
|
#include "utils/Retranslator.h"
|
||||||
|
|
||||||
#include <QAbstractButton>
|
#include <QComboBox>
|
||||||
|
|
||||||
|
|
||||||
#include <KPackage/Package>
|
#include <KPackage/Package>
|
||||||
#include <KPackage/PackageLoader>
|
#include <KPackage/PackageLoader>
|
||||||
@ -42,4 +43,18 @@ PlasmaLnfPage::PlasmaLnfPage( Config* config, QWidget* parent )
|
|||||||
"selection will give you a live preview of that look-and-feel." ) );
|
"selection will give you a live preview of that look-and-feel." ) );
|
||||||
} )
|
} )
|
||||||
connect( this, &PlasmaLnfPage::plasmaThemeSelected, config, &Config::setTheme );
|
connect( this, &PlasmaLnfPage::plasmaThemeSelected, config, &Config::setTheme );
|
||||||
|
|
||||||
|
QComboBox* box = new QComboBox();
|
||||||
|
box->setModel( m_config->themeModel() );
|
||||||
|
ui->verticalLayout->addWidget( box );
|
||||||
|
|
||||||
|
connect( box, QOverload< int >::of( &QComboBox::currentIndexChanged ), [this]( int index ) {
|
||||||
|
auto* model = m_config->themeModel();
|
||||||
|
auto id = model->data( model->index( index, 0 ), ThemesModel::KeyRole ).toString();
|
||||||
|
cDebug() << "ComboBox selected" << index << id;
|
||||||
|
if ( !id.isEmpty() )
|
||||||
|
{
|
||||||
|
emit plasmaThemeSelected( id );
|
||||||
|
}
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user