/***************************************************************************
- * Copyright (C) 2005-2013 by the Quassel Project *
+ * Copyright (C) 2005-2018 by the Quassel Project *
* devel@quassel-irc.org *
* *
* This program is free software; you can redistribute it and/or modify *
{
for (int r = 0; r < actionCollections.values().count(); r++) {
ActionCollection *coll = actionCollections.values().at(r);
- Item *item = new Item();
+ auto *item = new Item();
item->row = r;
item->collection = coll;
for (int i = 0; i < coll->actions().count(); i++) {
- Action *action = qobject_cast<Action *>(coll->actions().at(i));
+ auto *action = qobject_cast<Action *>(coll->actions().at(i));
if (!action)
continue;
- Item *actionItem = new Item();
+ auto *actionItem = new Item();
actionItem->parentItem = item;
actionItem->row = i;
actionItem->collection = coll;
QModelIndex ShortcutsModel::parent(const QModelIndex &child) const
{
if (!child.isValid())
- return QModelIndex();
+ return {};
- Item *item = static_cast<Item *>(child.internalPointer());
+ auto *item = static_cast<Item *>(child.internalPointer());
Q_ASSERT(item);
if (!item->parentItem)
- return QModelIndex();
+ return {};
return createIndex(item->parentItem->row, 0, item->parentItem);
}
if (!parent.isValid())
return 2;
- Item *item = static_cast<Item *>(parent.internalPointer());
+ auto *item = static_cast<Item *>(parent.internalPointer());
Q_ASSERT(item);
if (!item->parentItem)
if (!parent.isValid())
return _categoryItems.count();
- Item *item = static_cast<Item *>(parent.internalPointer());
+ auto *item = static_cast<Item *>(parent.internalPointer());
Q_ASSERT(item);
if (!item->parentItem)
if (!index.isValid())
return QVariant();
- Item *item = static_cast<Item *>(index.internalPointer());
+ auto *item = static_cast<Item *>(index.internalPointer());
Q_ASSERT(item);
if (!item->parentItem) {
}
}
- Action *action = qobject_cast<Action *>(item->action);
+ auto *action = qobject_cast<Action *>(item->action);
Q_ASSERT(action);
switch (role) {
if (!index.parent().isValid())
return false;
- Item *item = static_cast<Item *>(index.internalPointer());
+ auto *item = static_cast<Item *>(index.internalPointer());
Q_ASSERT(item);
QKeySequence newSeq = value.value<QKeySequence>();
if (oldSeq == storedSeq && newSeq != storedSeq) {
if (++_changedCount == 1)
- emit hasChanged(true);
+ emit changed(true);
}
else if (oldSeq != storedSeq && newSeq == storedSeq) {
if (--_changedCount == 0)
- emit hasChanged(false);
+ emit changed(false);
}
return true;
emit dataChanged(index(0, 1), index(rowCount()-1, 1));
if (_changedCount != 0) {
_changedCount = 0;
- emit hasChanged(false);
+ emit changed(false);
}
}
}
if (_changedCount != 0) {
_changedCount = 0;
- emit hasChanged(false);
+ emit changed(false);
}
}