Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
QTreeView を使用して行に子がなく、基になるモデルが QAbstractTableModel である複数列のリストを表示する場合、展開/折りたたみコントロールを非表示にするにはどうすればよいですか?
モデルのhasChildren()をオーバーライドして常にfalseを返すか、rowCount()をオーバーライドして常に0を返すか、またはその両方を試してください
PyQt4 ではこれは機能しますが、これが正しい方法であるかどうかはわかりません。
def rowCount(self, parent): if parent.row() < 0: return self.number_of_rows return 0