Restore novel heading details tooltip and active row colouring

This commit is contained in:
Veronica Berglyd Olsen
2025-02-22 23:13:57 +01:00
parent 71ad7c3229
commit 43e420ab0b
4 changed files with 83 additions and 69 deletions
+5 -1
View File
@@ -125,7 +125,11 @@ class Index:
if (item := SHARED.project.tree[tHandle]) and item.isRootType() and item.isNovelLike():
model = NovelModel()
for handle in SHARED.project.tree.subTree(tHandle):
if node := self._itemIndex[handle]:
if (
(node := self._itemIndex[handle])
and node.item.isDocumentLayout()
and node.item.isActive
):
model.append(node)
self._novelModels[tHandle] = model
return
+4 -2
View File
@@ -84,8 +84,10 @@ class NovelModel(QAbstractTableModel):
def data(self, index: QModelIndex, role: Qt.ItemDataRole) -> T_NodeData:
"""Return display data for a node."""
if index.isValid() and (row := index.row()) < len(self._rows):
return self._rows[row].get(C_FACTOR*index.column() | role)
try:
return self._rows[index.row()].get(C_FACTOR*index.column() | role)
except Exception:
print("NovelModel Debug: Oops!")
return None
def keys(self, index: QModelIndex) -> tuple[str | None, str | None]: