Skip to content

Commit

Permalink
[themes] Fix the processing modeler's rendering on dark backgrounds
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn committed Jan 15, 2019
1 parent 2e36fd6 commit 6957009
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
6 changes: 3 additions & 3 deletions python/plugins/processing/modeler/ModelerArrowItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
QgsProcessingModelChildAlgorithm,
QgsProcessingModelParameter)
from qgis.PyQt.QtCore import Qt, QPointF
from qgis.PyQt.QtWidgets import QGraphicsPathItem, QGraphicsItem
from qgis.PyQt.QtGui import QPen, QPainterPath, QPolygonF, QPainter
from qgis.PyQt.QtWidgets import QApplication, QGraphicsPathItem, QGraphicsItem
from qgis.PyQt.QtGui import QPen, QPainterPath, QPolygonF, QPainter, QPalette
from processing.modeler.ModelerGraphicItem import ModelerGraphicItem


Expand All @@ -67,7 +67,7 @@ def __init__(self, startItem, startIndex, endItem, endIndex,
self.endItem = endItem
self.endPoints = []
self.setFlag(QGraphicsItem.ItemIsSelectable, False)
self.myColor = Qt.gray
self.myColor = QApplication.palette().color(QPalette.WindowText)
self.setPen(QPen(self.myColor, 1, Qt.SolidLine,
Qt.RoundCap, Qt.RoundJoin))
self.setZValue(0)
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/modeler/ModelerGraphicItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
import math

from qgis.PyQt.QtCore import Qt, QPointF, QRectF
from qgis.PyQt.QtGui import QFont, QFontMetricsF, QPen, QBrush, QColor, QPolygonF, QPicture, QPainter
from qgis.PyQt.QtWidgets import QGraphicsItem, QMessageBox, QMenu
from qgis.PyQt.QtGui import QFont, QFontMetricsF, QPen, QBrush, QColor, QPolygonF, QPicture, QPainter, QPalette
from qgis.PyQt.QtWidgets import QApplication, QGraphicsItem, QMessageBox, QMenu
from qgis.PyQt.QtSvg import QSvgRenderer
from qgis.core import (QgsProcessingParameterDefinition,
QgsProcessingModelParameter,
Expand Down Expand Up @@ -328,7 +328,7 @@ def paint(self, painter, option, widget=None):
h = fm.ascent()
pt = QPointF(-ModelerGraphicItem.BOX_WIDTH / 2 + 25, ModelerGraphicItem.BOX_HEIGHT / 2.0 - h + 1)
painter.drawText(pt, text)
painter.setPen(QPen(Qt.black))
painter.setPen(QPen(QApplication.palette().color(QPalette.WindowText)))
if isinstance(self.element, QgsProcessingModelChildAlgorithm):
h = -(fm.height() * 1.2)
h = h - ModelerGraphicItem.BOX_HEIGHT / 2.0 + 5
Expand Down
1 change: 1 addition & 0 deletions resources/themes/Blend of Gray/palette.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
0:#0e0e0e
2:#373737
5:#373737
9:#727272
Expand Down
1 change: 1 addition & 0 deletions resources/themes/Night Mapping/palette.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
0:#aaaaaa
2:#535353
5:#222222
9:#535353
Expand Down

0 comments on commit 6957009

Please sign in to comment.