small changes

This commit is contained in:
iLLiCiTiT 2021-05-13 18:29:47 +02:00
parent 2ce685d3e3
commit cc0cbbfade
3 changed files with 21 additions and 3 deletions

View file

@ -78,6 +78,8 @@ class NumberDelegate(QtWidgets.QStyledItemDelegate):
editor = QtWidgets.QDoubleSpinBox(parent)
else:
editor = QtWidgets.QSpinBox(parent)
editor.setObjectName("NumberEditor")
editor.setMinimum(self.minimum)
editor.setMaximum(self.maximum)
@ -97,6 +99,7 @@ class NumberDelegate(QtWidgets.QStyledItemDelegate):
class NameDelegate(QtWidgets.QStyledItemDelegate):
def createEditor(self, parent, option, index):
editor = NameTextEdit(parent)
editor.setObjectName("NameEditor")
value = index.data(QtCore.Qt.EditRole)
if value is not None:
editor.setText(str(value))
@ -110,6 +113,7 @@ class TypeDelegate(QtWidgets.QStyledItemDelegate):
def createEditor(self, parent, option, index):
editor = FilterComboBox(parent)
editor.setObjectName("TypeEditor")
if not self._project_doc_cache.project_doc:
return editor
@ -132,6 +136,7 @@ class ToolsDelegate(QtWidgets.QStyledItemDelegate):
def createEditor(self, parent, option, index):
editor = MultiSelectionComboBox(parent)
editor.setObjectName("ToolEditor")
if not self._tools_cache.tools_data:
return editor

View file

@ -1487,9 +1487,6 @@ class ProjectItem(BaseItem):
return QtCore.Qt.ItemIsEnabled | QtCore.Qt.ItemIsSelectable
class AssetItem(BaseItem):
item_type = "asset"

View file

@ -389,9 +389,16 @@ class HierarchyView(QtWidgets.QTreeView):
self.edit(index)
def _remove_delete_flag(self, item_ids):
"""Remove deletion flag on items marked for deletion."""
self._source_model.remove_delete_flag(item_ids)
def _expand_items(self, indexes):
"""Expand multiple items with all it's children.
Args:
indexes (list): List of QModelIndex that should be expanded.
"""
item_ids = set()
process_queue = Queue()
for index in indexes:
@ -415,6 +422,11 @@ class HierarchyView(QtWidgets.QTreeView):
))
def _collapse_items(self, indexes):
"""Collapse multiple items with all it's children.
Args:
indexes (list): List of QModelIndex that should be collapsed.
"""
item_ids = set()
process_queue = Queue()
for index in indexes:
@ -442,6 +454,10 @@ class HierarchyView(QtWidgets.QTreeView):
self._parent.show_message(message)
def _on_context_menu(self, point):
"""Context menu on right click.
Currently is menu shown only on "name" column.
"""
index = self.indexAt(point)
column = index.column()
if column != 0: