From 0acf9b38a4b42e4d59afcb3e9e4564707cd80560 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Wed, 8 Aug 2018 10:39:54 +1000 Subject: [PATCH] support rtl text in sort field in browser --- aqt/browser.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/aqt/browser.py b/aqt/browser.py index d3b1b464e..a5e502b71 100644 --- a/aqt/browser.py +++ b/aqt/browser.py @@ -312,6 +312,17 @@ class DataModel(QAbstractTableModel): return "" return time.strftime("%Y-%m-%d", time.localtime(date)) + def isRTL(self, index): + col = index.column() + type = self.columnType(col) + if type != "noteFld": + return False + + row = index.row() + c = self.getCard(index) + nt = c.note().model() + return nt['flds'][self.col.models.sortIdx(nt)]['rtl'] + # Line painter ###################################################################### @@ -343,6 +354,9 @@ class StatusDelegate(QItemDelegate): finally: self.browser.mw.progress.blockUpdates = True + if self.model.isRTL(index): + option.direction = Qt.RightToLeft + col = None if c.queue == -1: col = COLOUR_SUSPENDED