Skip to content
Snippets Groups Projects
Commit 3ba8941c authored by inso's avatar inso
Browse files

Resize tree view height

parent b65213ba
No related branches found
No related tags found
No related merge requests found
""" from PyQt5.QtCore import QAbstractItemModel, QModelIndex, Qt, QSize
Created on 5 févr. 2014 from PyQt5.QtGui import QIcon, QTextDocument
@author: inso
"""
from PyQt5.QtCore import QAbstractItemModel, QModelIndex, Qt
from PyQt5.QtGui import QIcon
import logging import logging
...@@ -48,6 +42,9 @@ class NodeItem(QAbstractItemModel): ...@@ -48,6 +42,9 @@ class NodeItem(QAbstractItemModel):
if role == Qt.DecorationRole and 'icon' in self.node: if role == Qt.DecorationRole and 'icon' in self.node:
return QIcon(self.node['icon']) return QIcon(self.node['icon'])
if role == Qt.SizeHintRole:
return QSize(1, 22)
if role == GenericTreeModel.ROLE_RAW_DATA: if role == GenericTreeModel.ROLE_RAW_DATA:
return self.node return self.node
...@@ -105,6 +102,7 @@ class GenericTreeModel(QAbstractItemModel): ...@@ -105,6 +102,7 @@ class GenericTreeModel(QAbstractItemModel):
if role in (Qt.DisplayRole, if role in (Qt.DisplayRole,
Qt.DecorationRole, Qt.DecorationRole,
Qt.ToolTipRole, Qt.ToolTipRole,
Qt.SizeHintRole,
GenericTreeModel.ROLE_RAW_DATA) \ GenericTreeModel.ROLE_RAW_DATA) \
and index.column() == 0: and index.column() == 0:
return item.data(0, role) return item.data(0, role)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment