aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <ken@ixsystems.com>2018-04-16 10:22:55 -0400
committerGitHub <noreply@github.com>2018-04-16 10:22:55 -0400
commita5518c3dcbe12a1a5b2b0307ff7155c4d4467659 (patch)
treeb43b994f84d6bb5fb56575dfce7972ea6d64f2ef
parentMerge pull request #574 from rodlie/lumina-desktop_add_clipboard_support (diff)
parentlthemeengine: fix qss order (diff)
downloadlumina-a5518c3dcbe12a1a5b2b0307ff7155c4d4467659.tar.gz
lumina-a5518c3dcbe12a1a5b2b0307ff7155c4d4467659.tar.bz2
lumina-a5518c3dcbe12a1a5b2b0307ff7155c4d4467659.zip
Merge pull request #571 from rodlie/lthemeengine_qss_order
lthemeengine: fix qss order
-rw-r--r--src-qt5/core/lumina-theme-engine/src/lthemeengine/qsspage.cpp26
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);
}
bgstack15