From 999a964e642b86d1d2094bf0f34b0e9cb0d83df6 Mon Sep 17 00:00:00 2001 From: Ole-André Rodlie Date: Sat, 14 Apr 2018 06:19:16 +0200 Subject: lthemeengine: fix qss order --- .../src/lthemeengine/qsspage.cpp | 26 +++++++++++++++------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'src-qt5') diff --git a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp index 3140c553..72cde6b3 100644 --- a/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp +++ b/src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp @@ -239,26 +239,36 @@ void QSSPage::readSettings(){ void QSSPage::findStyleSheets(QStringList paths, QStringList enabled){ paths.removeDuplicates(); + std::reverse(enabled.begin(), enabled.end()); // reverse for proper order + QMap sortedStylesSheets; for(int i=0; isetToolTip(info.filePath()); + item->setData(QSS_FULL_PATH_ROLE, info.filePath()); + item->setData(QSS_WRITABLE_ROLE, info.isWritable()); + m_ui->list_disabled->addItem(item); + } + } + } + QMapIterator i(sortedStylesSheets); + while (i.hasNext()) { + i.next(); + QFileInfo info(i.value()); + if (info.isFile()) { QListWidgetItem *item = new QListWidgetItem(info.fileName()); item->setToolTip(info.filePath()); item->setData(QSS_FULL_PATH_ROLE, info.filePath()); item->setData(QSS_WRITABLE_ROLE, info.isWritable()); - if( enabled.contains(info.filePath()) ){ m_ui->qssListWidget->addItem(item); } - else{ m_ui->list_disabled->addItem(item); } + m_ui->qssListWidget->addItem(item); } } - //Now ensure the priority of the items in the active list is correct - for(int i = 0; i < m_ui->qssListWidget->count(); ++i){ - QListWidgetItem *item = m_ui->qssListWidget->item(i); - int index = enabled.indexOf( item->data(QSS_FULL_PATH_ROLE).toString() ); - if(index>=0){ m_ui->qssListWidget->insertItem(index, item); }// item->move(m_ui->qssListWidget->count() - 1 - index); } - } m_ui->list_disabled->sortItems(Qt::AscendingOrder); } -- cgit