diff options
author | Ole-André Rodlie <ole.andre.rodlie@gmail.com> | 2018-04-14 06:19:16 +0200 |
---|---|---|
committer | Ole-André Rodlie <ole.andre.rodlie@gmail.com> | 2018-04-14 06:19:16 +0200 |
commit | 999a964e642b86d1d2094bf0f34b0e9cb0d83df6 (patch) | |
tree | 65ff09a6ba8b1f6874e2465dfbf4441626da8dd1 /src-qt5/core | |
parent | Add a quick test script I wrote to probe icon themes and see what is found or... (diff) | |
download | lumina-999a964e642b86d1d2094bf0f34b0e9cb0d83df6.tar.gz lumina-999a964e642b86d1d2094bf0f34b0e9cb0d83df6.tar.bz2 lumina-999a964e642b86d1d2094bf0f34b0e9cb0d83df6.zip |
lthemeengine: fix qss order
Diffstat (limited to 'src-qt5/core')
-rw-r--r-- | src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
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<int, QString> sortedStylesSheets; for(int i=0; i<paths.length(); i++){ if(!QFile::exists(paths[i])){ continue; } QDir dir(paths[i]); dir.setFilter(QDir::Files); dir.setNameFilters(QStringList() << "*.qss"); foreach (QFileInfo info, dir.entryInfoList()){ + if(enabled.contains(info.filePath())){ sortedStylesSheets[enabled.indexOf(info.filePath())] = info.filePath(); } + else{ + 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()); + m_ui->list_disabled->addItem(item); + } + } + } + QMapIterator<int, QString> 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); } |