mirror of
https://github.com/olivierkes/manuskript.git
synced 2024-05-17 11:22:28 +12:00
Improves colors of index card delegate editor
This commit is contained in:
parent
0c3f96014a
commit
845aa8b205
|
@ -21,6 +21,8 @@ class corkDelegate(QStyledItemDelegate):
|
|||
self.editing = None
|
||||
self.margin = 5
|
||||
|
||||
self.bgColors = {}
|
||||
|
||||
def newStyle(self):
|
||||
return settings.corkStyle == "new"
|
||||
|
||||
|
@ -43,6 +45,8 @@ class corkDelegate(QStyledItemDelegate):
|
|||
def createEditor(self, parent, option, index):
|
||||
self.updateRects(option, index)
|
||||
|
||||
bgColor = self.bgColors.get(index, "white")
|
||||
|
||||
if self.mainLineRect.contains(self.lastPos):
|
||||
# One line summary
|
||||
self.editing = Outline.summarySentence
|
||||
|
@ -57,6 +61,7 @@ class corkDelegate(QStyledItemDelegate):
|
|||
edt.setAlignment(Qt.AlignCenter)
|
||||
edt.setPlaceholderText(self.tr("One line summary"))
|
||||
edt.setFont(f)
|
||||
edt.setStyleSheet("background: {}; color: black;".format(bgColor))
|
||||
return edt
|
||||
|
||||
elif self.titleRect.contains(self.lastPos):
|
||||
|
@ -72,6 +77,7 @@ class corkDelegate(QStyledItemDelegate):
|
|||
edt.setAlignment(Qt.AlignCenter)
|
||||
f.setBold(True)
|
||||
edt.setFont(f)
|
||||
edt.setStyleSheet("background: {}; color: black;".format(bgColor))
|
||||
# edt.setGeometry(self.titleRect)
|
||||
return edt
|
||||
|
||||
|
@ -86,6 +92,7 @@ class corkDelegate(QStyledItemDelegate):
|
|||
edt.setPlaceholderText(self.tr("Full summary"))
|
||||
except AttributeError:
|
||||
pass
|
||||
edt.setStyleSheet("background: {}; color: black;".format(bgColor))
|
||||
return edt
|
||||
|
||||
def updateEditorGeometry(self, editor, option, index):
|
||||
|
@ -247,6 +254,9 @@ class corkDelegate(QStyledItemDelegate):
|
|||
p.setBrush(Qt.white)
|
||||
backgroundColor = QColor(Qt.white)
|
||||
|
||||
# Cache background color
|
||||
self.bgColors[index] = backgroundColor.name()
|
||||
|
||||
p.setPen(Qt.NoPen)
|
||||
p.drawRect(self.cardRect)
|
||||
if item.isFolder():
|
||||
|
|
Loading…
Reference in a new issue