Improves readabily of outline delegate

This commit is contained in:
Olivier Keshavjee 2017-11-14 10:00:35 +01:00
parent cc84f53f04
commit 0c3f96014a
3 changed files with 22 additions and 5 deletions

View file

@ -189,7 +189,7 @@ def outlineItemColors(item):
if item.compile() in [0, "0"]:
colors["Compile"] = mixColors(QColor(S.text), QColor(S.window))
else:
colors["Compile"] = QColor(S.text)
colors["Compile"] = QColor(Qt.transparent) # will use default
return colors

View file

@ -8,7 +8,7 @@ from PyQt5.QtWidgets import qApp
from manuskript import settings
from manuskript.enums import Character, Outline
from manuskript.functions import outlineItemColors, mixColors, colorifyPixmap, toInt, toFloat, drawProgress
from manuskript.ui import style as S
class outlineTitleDelegate(QStyledItemDelegate):
def __init__(self, parent=None):
@ -39,7 +39,7 @@ class outlineTitleDelegate(QStyledItemDelegate):
col = colors[settings.viewSettings["Outline"]["Background"]]
if col != QColor(Qt.transparent):
col2 = QColor(Qt.white)
col2 = QColor(S.base)
if opt.state & QStyle.State_Selected:
col2 = opt.palette.brush(QPalette.Normal, QPalette.Highlight).color()
col = mixColors(col, col2, .2)
@ -76,10 +76,20 @@ class outlineTitleDelegate(QStyledItemDelegate):
# Text
if opt.text:
painter.save()
textColor = QColor(S.text)
if option.state & QStyle.State_Selected:
col = QColor(S.highlightedText)
textColor = col
painter.setPen(col)
if settings.viewSettings["Outline"]["Text"] != "Nothing":
col = colors[settings.viewSettings["Outline"]["Text"]]
if col == Qt.transparent:
col = Qt.black
col = textColor
# If text color is Compile and item is selected, we have
# to change the color
if settings.viewSettings["Outline"]["Text"] == "Compile" and \
item.compile() in [0, "0"]:
col = mixColors(textColor, QColor(S.window))
painter.setPen(col)
f = QFont(opt.font)
painter.setFont(f)

View file

@ -82,13 +82,20 @@ class treeTitleDelegate(QStyledItemDelegate):
# Text
if opt.text:
painter.save()
textColor = QColor(S.text)
if option.state & QStyle.State_Selected:
col = QColor(S.highlightedText)
textColor = col
painter.setPen(col)
if settings.viewSettings["Tree"]["Text"] != "Nothing":
col = colors[settings.viewSettings["Tree"]["Text"]]
if col == Qt.transparent:
col = QColor(S.text)
col = textColor
# If text color is Compile and item is selected, we have
# to change the color
if settings.viewSettings["Outline"]["Text"] == "Compile" and \
item.compile() in [0, "0"]:
col = mixColors(textColor, QColor(S.window))
painter.setPen(col)
f = QFont(opt.font)
painter.setFont(f)