mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-08 18:54:09 -04:00
...
This commit is contained in:
parent
8ead6c26f0
commit
db3bd2d25c
@ -552,13 +552,12 @@ class CcMarkdownDelegate(QStyledItemDelegate): # {{{
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
QStyledItemDelegate.__init__(self, parent)
|
super().__init__(parent)
|
||||||
self.document = QTextDocument()
|
self.document = QTextDocument()
|
||||||
|
|
||||||
def paint(self, painter, option, index):
|
def paint(self, painter, option, index):
|
||||||
self.initStyleOption(option, index)
|
self.initStyleOption(option, index)
|
||||||
style = QApplication.style() if option.widget is None \
|
style = QApplication.style() if option.widget is None else option.widget.style()
|
||||||
else option.widget.style()
|
|
||||||
option.text = markdown(option.text)
|
option.text = markdown(option.text)
|
||||||
self.document.setHtml(option.text)
|
self.document.setHtml(option.text)
|
||||||
style.drawPrimitive(QStyle.PrimitiveElement.PE_PanelItemViewItem, option, painter, widget=option.widget)
|
style.drawPrimitive(QStyle.PrimitiveElement.PE_PanelItemViewItem, option, painter, widget=option.widget)
|
||||||
@ -585,7 +584,7 @@ class CcMarkdownDelegate(QStyledItemDelegate): # {{{
|
|||||||
text = ''
|
text = ''
|
||||||
else:
|
else:
|
||||||
text = m.db.data[index.row()][m.custom_columns[col]['rec_index']]
|
text = m.db.data[index.row()][m.custom_columns[col]['rec_index']]
|
||||||
|
|
||||||
path = m.db.abspath(index.row(), index_is_id=False)
|
path = m.db.abspath(index.row(), index_is_id=False)
|
||||||
base_url = QUrl.fromLocalFile(os.path.join(path, 'metadata.html')) if path else None
|
base_url = QUrl.fromLocalFile(os.path.join(path, 'metadata.html')) if path else None
|
||||||
d = MarkdownEditDialog(parent, text, column_name=m.custom_columns[col]['name'],
|
d = MarkdownEditDialog(parent, text, column_name=m.custom_columns[col]['name'],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user