r24664 by jghali - #16588: Color inconsistent with dark theme in marks manager
scribus-commit
scribus-commit at lists.scribus.net
Sun Jun 6 13:54:02 UTC 2021
Author: jghali
Date: Sun Jun 6 13:54:02 2021
New Revision: 24664
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24664
Log:
#16588: Color inconsistent with dark theme in marks manager
Modified:
trunk/Scribus/scribus/ui/marksmanager.cpp
trunk/Scribus/scribus/ui/marksmanager.h
Modified: trunk/Scribus/scribus/ui/marksmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24664&path=/trunk/Scribus/scribus/ui/marksmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/marksmanager.cpp (original)
+++ trunk/Scribus/scribus/ui/marksmanager.cpp Sun Jun 6 13:54:02 2021
@@ -40,14 +40,14 @@
QTreeWidgetItem *listItem = new QTreeWidgetItem(listView);
listItem->setText(0,typeStr);
listItem->setFlags(listItem->flags() & (~Qt::ItemIsSelectable));
- listItem->setBackground(0,QColor("lightGray"));
+ listItem->setBackground(0, this->palette().color(QPalette::AlternateBase));
for (int i = 0; i < marks.size(); ++i)
{
if (marks[i]->isType(typeMrk))
{
QTreeWidgetItem *listItem2 = new QTreeWidgetItem(listItem);
listItem2->setText(0, marks[i]->label);
- listItem2->setData(1, Qt::UserRole,QVariant::fromValue<void*>(marks[i]));
+ listItem2->setData(1, Qt::UserRole, QVariant::fromValue<void*>(marks[i]));
index++;
noSuchMarks = false;
}
@@ -75,14 +75,14 @@
void MarksManager::restoreColaption()
{
listView->collapseAll();
- if (!m_expandedItems.isEmpty())
- {
- for (int i=0; i < listView->topLevelItemCount(); ++i)
- {
- QTreeWidgetItem *item = listView->topLevelItem(i);
- if (m_expandedItems.contains(item->text(0)))
- listView->topLevelItem(i)->setExpanded(true);
- }
+ if (m_expandedItems.isEmpty())
+ return;
+
+ for (int i=0; i < listView->topLevelItemCount(); ++i)
+ {
+ QTreeWidgetItem *item = listView->topLevelItem(i);
+ if (m_expandedItems.contains(item->text(0)))
+ item->setExpanded(true);
}
}
@@ -139,6 +139,8 @@
languageChange();
return;
}
+ if (e->type() == QEvent::PaletteChange)
+ paletteChange();
ScrPaletteBase::changeEvent(e);
}
@@ -151,6 +153,16 @@
EditButton->setToolTip(tr("Edit selected mark"));
if (m_Doc != nullptr)
updateListView();
+}
+
+void MarksManager::paletteChange()
+{
+ QColor listItemColor = this->palette().color(QPalette::AlternateBase);
+ for (int i = 0; i < listView->topLevelItemCount(); ++i)
+ {
+ QTreeWidgetItem *listItem = listView->topLevelItem(i);
+ listItem->setBackground(0, listItemColor);
+ }
}
void MarksManager::handleUpdateRequest(int updateFlags)
Modified: trunk/Scribus/scribus/ui/marksmanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24664&path=/trunk/Scribus/scribus/ui/marksmanager.h
==============================================================================
--- trunk/Scribus/scribus/ui/marksmanager.h (original)
+++ trunk/Scribus/scribus/ui/marksmanager.h Sun Jun 6 13:54:02 2021
@@ -34,6 +34,7 @@
public slots:
void setDoc(ScribusDoc *doc);
void languageChange();
+ void paletteChange();
void handleUpdateRequest(int updateFlags);
private slots:
More information about the scribus-commit
mailing list