Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2772e35

Browse files
committed
1 parent 6ae8401 commit 2772e35

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

qt/aqt/browser/table/model.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import time
77
from typing import Any, Dict, List, Optional, Sequence, Union, cast
88

9+
import aqt
910
from anki.cards import Card, CardId
1011
from anki.collection import BrowserColumns as Columns
1112
from anki.collection import Collection
@@ -43,6 +44,7 @@ def __init__(self, col: Collection, state: ItemState) -> None:
4344
self._rows: Dict[int, CellRow] = {}
4445
self._block_updates = False
4546
self._stale_cutoff = 0.0
47+
self._want_tooltips = aqt.mw.pm.show_browser_table_tooltips()
4648

4749
# Row Object Interface
4850
######################################################################
@@ -274,12 +276,14 @@ def data(self, index: QModelIndex = QModelIndex(), role: int = 0) -> Any:
274276
qfont.setFamily(row.font_name)
275277
qfont.setPixelSize(row.font_size)
276278
return qfont
277-
if role == Qt.TextAlignmentRole:
279+
elif role == Qt.TextAlignmentRole:
278280
align: Union[Qt.AlignmentFlag, int] = Qt.AlignVCenter
279281
if self.column_at(index).alignment == Columns.ALIGNMENT_CENTER:
280282
align |= Qt.AlignHCenter
281283
return align
282-
if role in (Qt.DisplayRole, Qt.ToolTipRole):
284+
elif role == Qt.DisplayRole:
285+
return self.get_cell(index).text
286+
elif role == Qt.ToolTipRole and self._want_tooltips:
283287
return self.get_cell(index).text
284288
return QVariant()
285289

qt/aqt/profiles.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,3 +657,9 @@ def recording_driver(self) -> RecordingDriver:
657657

658658
def set_recording_driver(self, driver: RecordingDriver) -> None:
659659
self.profile["recordingDriver"] = driver.value
660+
661+
def show_browser_table_tooltips(self) -> bool:
662+
return self.profile.get("browserTableTooltips", True)
663+
664+
def set_show_browser_table_tooltips(self, val: bool) -> None:
665+
self.profile["browserTableTooltips"] = val

0 commit comments

Comments
 (0)