diff options
author | Bruno Abinader <bruno.abinader@openbossa.org> | 2009-05-31 17:06:57 -0400 |
---|---|---|
committer | Bruno Abinader <bruno.abinader@openbossa.org> | 2009-05-31 17:27:38 -0400 |
commit | df02f711318d67a84cf5ddf80c7a48a3ee57297c (patch) | |
tree | eedb9d72b811d837ffa181c3c24524fb9818162d | |
parent | 37820782ffd8709e92d95bd9732bd0c51eac1f19 (diff) |
QListFromTreeAdaptor: Simplified signal interception.
Removed unnecessary checks and variables.
Signed-off-by: Bruno Abinader <bruno.abinader@openbossa.org>
-rw-r--r-- | src/qlistfromtreeadaptor.cpp | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/src/qlistfromtreeadaptor.cpp b/src/qlistfromtreeadaptor.cpp index b04dfe0..e08ba8b 100644 --- a/src/qlistfromtreeadaptor.cpp +++ b/src/qlistfromtreeadaptor.cpp @@ -57,16 +57,11 @@ void QtListFromTreeAdaptorPrivate::_q_itemsInserted(const QtTreeModelBase::itera Q_Q(QtListFromTreeAdaptor); QtTreeModelBase::iterator_base _it = it; - QtTreeModelBase::iterator_base root = this->it; int index = 0; - _it.parent(); - - if ((root.isValid() && root == _it) || !_it.hasParent()) { - _it = it; - - for (; _it.hasPreviousSibling(); index++) { - _it.previousSibling(); + if (this->it == _it.parent()) { + for (_it = it; _it.hasPreviousSibling(); _it.previousSibling()) { + index++; } emit q->itemsInserted(index, count); @@ -82,16 +77,11 @@ void QtListFromTreeAdaptorPrivate::_q_itemsRemoved(const QtTreeModelBase::iterat Q_Q(QtListFromTreeAdaptor); QtTreeModelBase::iterator_base _it = it; - QtTreeModelBase::iterator_base root = this->it; int index = 0; - _it.parent(); - - if ((root.isValid() && root == _it) || !_it.hasParent()) { - _it = it; - - for (; _it.hasPreviousSibling(); index++) { - _it.previousSibling(); + if (this->it == _it.parent()) { + for (_it = it; _it.hasPreviousSibling(); _it.previousSibling()) { + index++; } emit q->itemsRemoved(index, count); @@ -108,16 +98,11 @@ void QtListFromTreeAdaptorPrivate::_q_itemsChanged(const QtTreeModelBase::iterat Q_Q(QtListFromTreeAdaptor); QtTreeModelBase::iterator_base _it = it; - QtTreeModelBase::iterator_base root = this->it; int index = 0; - _it.parent(); - - if ((root.isValid() && root == _it) || !_it.hasParent()) { - _it = it; - - for (; _it.hasPreviousSibling(); index++) { - _it.previousSibling(); + if (this->it == _it.parent()) { + for (_it = it; _it.hasPreviousSibling(); _it.previousSibling()) { + index++; } emit q->itemsChanged(index, count, roles); |