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,14 +551,16 @@ class FactEditor(object):
|
||||||
# we lose the selection when we open the colour dialog on win32,
|
# we lose the selection when we open the colour dialog on win32,
|
||||||
# so we need to save it
|
# so we need to save it
|
||||||
cursor = w.textCursor()
|
cursor = w.textCursor()
|
||||||
|
haveSel = cursor.hasSelection()
|
||||||
new = QColorDialog.getColor(w.textColor(), self.parent)
|
new = QColorDialog.getColor(w.textColor(), self.parent)
|
||||||
if new.isValid():
|
if new.isValid():
|
||||||
w.setTextCursor(cursor)
|
w.setTextCursor(cursor)
|
||||||
self.foregroundFrame.setPalette(QPalette(new))
|
self.foregroundFrame.setPalette(QPalette(new))
|
||||||
w.setTextColor(new)
|
w.setTextColor(new)
|
||||||
# now we clear the selection
|
# now we clear the selection
|
||||||
cursor.clearSelection()
|
if haveSel:
|
||||||
w.setTextCursor(cursor)
|
cursor.clearSelection()
|
||||||
|
w.setTextCursor(cursor)
|
||||||
self.fontChanged = True
|
self.fontChanged = True
|
||||||
|
|
||||||
def insertLatex(self):
|
def insertLatex(self):
|
||||||
|
|
Loading…
Reference in a new issue