Commit b3a338c4 authored by Dan Pascu's avatar Dan Pascu

Renamed arrow button to collapse_button and updated logic

parent b448c967
...@@ -39,7 +39,7 @@ class ContactGroup(object): ...@@ -39,7 +39,7 @@ class ContactGroup(object):
@property @property
def collapsed(self): def collapsed(self):
return self.widget.collapsed return self.widget.collapse_button.isChecked()
def _get_name(self): def _get_name(self):
return self.__dict__['name'] return self.__dict__['name']
...@@ -126,10 +126,6 @@ class ContactGroupWidget(base_class, ui_class): ...@@ -126,10 +126,6 @@ class ContactGroupWidget(base_class, ui_class):
self.name_view.setCurrentWidget(self.label_widget) self.name_view.setCurrentWidget(self.label_widget)
self.name_editor.editingFinished.connect(self._end_editing) self.name_editor.editingFinished.connect(self._end_editing)
@property
def collapsed(self):
return self.arrow.isChecked()
@property @property
def editing(self): def editing(self):
return self.name_view.currentWidget() is self.editor_widget return self.name_view.currentWidget() is self.editor_widget
...@@ -193,7 +189,7 @@ class ContactGroupWidget(base_class, ui_class): ...@@ -193,7 +189,7 @@ class ContactGroupWidget(base_class, ui_class):
painter.drawLine(rect.bottomLeft(), rect.bottomRight()) painter.drawLine(rect.bottomLeft(), rect.bottomRight())
#painter.drawLine(option.rect.topRight(), option.rect.bottomRight()) #painter.drawLine(option.rect.topRight(), option.rect.bottomRight())
if self.collapsed: if self.collapse_button.isChecked():
arrow = QPolygonF([QPointF(0, 0), QPointF(0, 9), QPointF(8, 4.5)]) arrow = QPolygonF([QPointF(0, 0), QPointF(0, 9), QPointF(8, 4.5)])
arrow.translate(QPointF(5, 4)) arrow.translate(QPointF(5, 4))
else: else:
...@@ -251,7 +247,7 @@ class ContactDelegate(QStyledItemDelegate): ...@@ -251,7 +247,7 @@ class ContactDelegate(QStyledItemDelegate):
if type(item) is ContactGroup: if type(item) is ContactGroup:
if item.widget is Null: if item.widget is Null:
item.widget = ContactGroupWidget(item.name, parent) item.widget = ContactGroupWidget(item.name, parent)
item.widget.arrow.toggled.connect(partial(self._update_list_view, item)) item.widget.collapse_button.toggled.connect(partial(self._update_list_view, item))
return item.widget return item.widget
else: else:
return None return None
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QToolButton" name="arrow"> <widget class="QToolButton" name="collapse_button">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>18</width> <width>18</width>
...@@ -172,8 +172,6 @@ border-width: 0; ...@@ -172,8 +172,6 @@ border-width: 0;
</widget> </widget>
</item> </item>
</layout> </layout>
<zorder>name_label</zorder>
<zorder>name_editor</zorder>
</widget> </widget>
<widget class="QWidget" name="editor_widget"> <widget class="QWidget" name="editor_widget">
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment