mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 16:26:40 -04:00
make setting colour work if there's no selection
This commit is contained in:
parent
99f9f9cc40
commit
4d4fb8adba
1 changed files with 4 additions and 2 deletions
|
@ -551,12 +551,14 @@ class FactEditor(object):
|
|||
# we lose the selection when we open the colour dialog on win32,
|
||||
# so we need to save it
|
||||
cursor = w.textCursor()
|
||||
haveSel = cursor.hasSelection()
|
||||
new = QColorDialog.getColor(w.textColor(), self.parent)
|
||||
if new.isValid():
|
||||
w.setTextCursor(cursor)
|
||||
self.foregroundFrame.setPalette(QPalette(new))
|
||||
w.setTextColor(new)
|
||||
# now we clear the selection
|
||||
if haveSel:
|
||||
cursor.clearSelection()
|
||||
w.setTextCursor(cursor)
|
||||
self.fontChanged = True
|
||||
|
|
Loading…
Reference in a new issue