Skip to content

Commit

Permalink
Fixes markfinal#154. Fixing linter warings for QStandardItem
Browse files Browse the repository at this point in the history
There is no overload taking a string in the initialiser, so switch to
another mechanism for adding text.

There is the overload in C++.
  • Loading branch information
markfinal committed Jul 7, 2024
1 parent b39fd98 commit 7c53b20
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/cruiz/model/graphaslistmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ class DependenciesListModel(QtGui.QStandardItemModel):
def __init__(self, graph: DependencyGraph) -> None:
super().__init__(len(graph.nodes), 1)
for row, node in enumerate(graph.nodes):
item = QtGui.QStandardItem(node.reference)
item.setData(node, QtCore.Qt.UserRole) # type: ignore
item = QtGui.QStandardItem()
item.setText(node.reference)
item.setData(node, QtCore.Qt.UserRole)
if node == graph.root:
font = QtGui.QFont()
font.setBold(True)
Expand Down Expand Up @@ -50,7 +51,8 @@ def __init__(self, graph: DependencyGraph) -> None:
parent_item = self.invisibleRootItem()
# TODO: revisit this algorithm
for node in graph.nodes:
item = QtGui.QStandardItem(node.reference)
item = QtGui.QStandardItem()
item.setText(node.reference)
if node == graph.root:
item.setData(
QtGui.QColor(QtCore.Qt.red),
Expand Down

0 comments on commit 7c53b20

Please sign in to comment.