mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Flag deleted rows as inactive
This commit is contained in:
parent
fb86320038
commit
b1a06fb807
1 changed files with 7 additions and 1 deletions
|
@ -802,6 +802,8 @@ class Cell:
|
||||||
|
|
||||||
|
|
||||||
class CellRow:
|
class CellRow:
|
||||||
|
is_deleted: bool = False
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
cells: Generator[Tuple[str, bool], None, None],
|
cells: Generator[Tuple[str, bool], None, None],
|
||||||
|
@ -833,7 +835,9 @@ class CellRow:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def deleted(length: int) -> CellRow:
|
def deleted(length: int) -> CellRow:
|
||||||
return CellRow.generic(length, tr.browsing_row_deleted())
|
row = CellRow.generic(length, tr.browsing_row_deleted())
|
||||||
|
row.is_deleted = True
|
||||||
|
return row
|
||||||
|
|
||||||
|
|
||||||
def backend_color_to_aqt_color(color: BrowserRow.Color.V) -> Optional[Tuple[str, str]]:
|
def backend_color_to_aqt_color(color: BrowserRow.Color.V) -> Optional[Tuple[str, str]]:
|
||||||
|
@ -1104,6 +1108,8 @@ class DataModel(QAbstractTableModel):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def flags(self, index: QModelIndex) -> Qt.ItemFlags:
|
def flags(self, index: QModelIndex) -> Qt.ItemFlags:
|
||||||
|
if self.get_row(index).is_deleted:
|
||||||
|
return Qt.ItemFlags(Qt.NoItemFlags)
|
||||||
return cast(Qt.ItemFlags, Qt.ItemIsEnabled | Qt.ItemIsSelectable)
|
return cast(Qt.ItemFlags, Qt.ItemIsEnabled | Qt.ItemIsSelectable)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue