forked from blue/squawk
Refactoring of signal/slots connection to new qt syntax
This commit is contained in:
parent
9d491e9e93
commit
0b57e6a77f
16 changed files with 81 additions and 83 deletions
|
@ -89,7 +89,7 @@ void Models::Accounts::addAccount(Account* account)
|
|||
}
|
||||
|
||||
accs.insert(before, account);
|
||||
connect(account, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(onAccountChanged(Models::Item*, int, int)));
|
||||
connect(account, &Account::childChanged, this, &Accounts::onAccountChanged);
|
||||
endInsertRows();
|
||||
|
||||
emit sizeChanged(accs.size());
|
||||
|
@ -143,7 +143,7 @@ void Models::Accounts::removeAccount(int index)
|
|||
{
|
||||
Account* account = accs[index];
|
||||
beginRemoveRows(QModelIndex(), index, index);
|
||||
disconnect(account, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(onAccountChanged(Models::Item*, int, int)));
|
||||
disconnect(account, &Account::childChanged, this, &Accounts::onAccountChanged);
|
||||
accs.erase(accs.begin() + index);
|
||||
endRemoveRows();
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ void Models::Contact::refresh()
|
|||
void Models::Contact::_removeChild(int index)
|
||||
{
|
||||
Item* child = childItems[index];
|
||||
disconnect(child, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(refresh()));
|
||||
disconnect(child, &Item::childChanged, this, &Contact::refresh);
|
||||
Item::_removeChild(index);
|
||||
refresh();
|
||||
}
|
||||
|
@ -237,7 +237,7 @@ void Models::Contact::_removeChild(int index)
|
|||
void Models::Contact::appendChild(Models::Item* child)
|
||||
{
|
||||
Item::appendChild(child);
|
||||
connect(child, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(refresh()));
|
||||
connect(child, &Item::childChanged, this, &Contact::refresh);
|
||||
refresh();
|
||||
}
|
||||
|
||||
|
@ -324,7 +324,7 @@ void Models::Contact::toOfflineState()
|
|||
emit childIsAboutToBeRemoved(this, 0, childItems.size());
|
||||
for (int i = 0; i < childItems.size(); ++i) {
|
||||
Item* item = childItems[i];
|
||||
disconnect(item, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(refresh()));
|
||||
disconnect(item, &Item::childChanged, this, &Contact::refresh);
|
||||
Item::_removeChild(i);
|
||||
item->deleteLater();
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ Models::Contact::Contact(const Models::Contact& other):
|
|||
Presence* pCopy = new Presence(*pres);
|
||||
presences.insert(pCopy->getName(), pCopy);
|
||||
Item::appendChild(pCopy);
|
||||
connect(pCopy, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(refresh()));
|
||||
connect(pCopy, &Item::childChanged, this, &Contact::refresh);
|
||||
}
|
||||
|
||||
refresh();
|
||||
|
|
|
@ -32,7 +32,7 @@ Models::Group::~Group()
|
|||
void Models::Group::appendChild(Models::Item* child)
|
||||
{
|
||||
Item::appendChild(child);
|
||||
connect(child, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(refresh()));
|
||||
connect(child, &Item::childChanged, this, &Group::refresh);
|
||||
changed(1);
|
||||
refresh();
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ QVariant Models::Group::data(int column) const
|
|||
void Models::Group::_removeChild(int index)
|
||||
{
|
||||
Item* child = childItems[index];
|
||||
disconnect(child, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(refresh()));
|
||||
disconnect(child, &Item::childChanged, this, &Group::refresh);
|
||||
Item::_removeChild(index);
|
||||
changed(1);
|
||||
refresh();
|
||||
|
|
|
@ -88,13 +88,13 @@ void Models::Item::appendChild(Models::Item* child)
|
|||
childItems.insert(before, child);
|
||||
child->parent = this;
|
||||
|
||||
QObject::connect(child, SIGNAL(childChanged(Models::Item*, int, int)), this, SIGNAL(childChanged(Models::Item*, int, int)));
|
||||
QObject::connect(child, SIGNAL(childIsAboutToBeInserted(Item*, int, int)), this, SIGNAL(childIsAboutToBeInserted(Item*, int, int)));
|
||||
QObject::connect(child, SIGNAL(childInserted()), this, SIGNAL(childInserted()));
|
||||
QObject::connect(child, SIGNAL(childIsAboutToBeRemoved(Item*, int, int)), this, SIGNAL(childIsAboutToBeRemoved(Item*, int, int)));
|
||||
QObject::connect(child, SIGNAL(childRemoved()), this, SIGNAL(childRemoved()));
|
||||
QObject::connect(child, SIGNAL(childIsAboutToBeMoved(Item*, int, int, Item*, int)), this, SIGNAL(childIsAboutToBeMoved(Item*, int, int, Item*, int)));
|
||||
QObject::connect(child, SIGNAL(childMoved()), this, SIGNAL(childMoved()));
|
||||
QObject::connect(child, &Item::childChanged, this, &Item::childChanged);
|
||||
QObject::connect(child, &Item::childIsAboutToBeInserted, this, &Item::childIsAboutToBeInserted);
|
||||
QObject::connect(child, &Item::childInserted, this, &Item::childInserted);
|
||||
QObject::connect(child, &Item::childIsAboutToBeRemoved, this, &Item::childIsAboutToBeRemoved);
|
||||
QObject::connect(child, &Item::childRemoved, this, &Item::childRemoved);
|
||||
QObject::connect(child, &Item::childIsAboutToBeMoved, this, &Item::childIsAboutToBeMoved);
|
||||
QObject::connect(child, &Item::childMoved, this, &Item::childMoved);
|
||||
|
||||
if (moving) {
|
||||
emit childMoved();
|
||||
|
@ -168,13 +168,13 @@ void Models::Item::_removeChild(int index)
|
|||
{
|
||||
Item* child = childItems[index];
|
||||
|
||||
QObject::disconnect(child, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(onChildChanged(Models::Item*, int, int)));
|
||||
QObject::disconnect(child, SIGNAL(childIsAboutToBeInserted(Item*, int, int)), this, SIGNAL(childIsAboutToBeInserted(Item*, int, int)));
|
||||
QObject::disconnect(child, SIGNAL(childInserted()), this, SIGNAL(childInserted()));
|
||||
QObject::disconnect(child, SIGNAL(childIsAboutToBeRemoved(Item*, int, int)), this, SIGNAL(childIsAboutToBeRemoved(Item*, int, int)));
|
||||
QObject::disconnect(child, SIGNAL(childRemoved()), this, SIGNAL(childRemoved()));
|
||||
QObject::disconnect(child, SIGNAL(childIsAboutToBeMoved(Item*, int, int, Item*, int)), this, SIGNAL(childIsAboutToBeMoved(Item*, int, int, Item*, int)));
|
||||
QObject::disconnect(child, SIGNAL(childMoved()), this, SIGNAL(childMoved()));
|
||||
QObject::disconnect(child, &Item::childChanged, this, &Item::childChanged);
|
||||
QObject::disconnect(child, &Item::childIsAboutToBeInserted, this, &Item::childIsAboutToBeInserted);
|
||||
QObject::disconnect(child, &Item::childInserted, this, &Item::childInserted);
|
||||
QObject::disconnect(child, &Item::childIsAboutToBeRemoved, this, &Item::childIsAboutToBeRemoved);
|
||||
QObject::disconnect(child, &Item::childRemoved, this, &Item::childRemoved);
|
||||
QObject::disconnect(child, &Item::childIsAboutToBeMoved, this, &Item::childIsAboutToBeMoved);
|
||||
QObject::disconnect(child, &Item::childMoved, this, &Item::childMoved);
|
||||
|
||||
childItems.erase(childItems.begin() + index);
|
||||
child->parent = 0;
|
||||
|
|
|
@ -238,7 +238,6 @@ void Models::Room::toOfflineState()
|
|||
emit childIsAboutToBeRemoved(this, 0, childItems.size());
|
||||
for (int i = 0; i < childItems.size(); ++i) {
|
||||
Item* item = childItems[i];
|
||||
disconnect(item, SIGNAL(childChanged(Models::Item*, int, int)), this, SLOT(refresh()));
|
||||
Item::_removeChild(i);
|
||||
item->deleteLater();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue