本文整理汇总了C++中ActionCollection::actions方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionCollection::actions方法的具体用法?C++ ActionCollection::actions怎么用?C++ ActionCollection::actions使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionCollection
的用法示例。
在下文中一共展示了ActionCollection::actions方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QAbstractItemModel
ShortcutsModel::ShortcutsModel(const QHash<QString, ActionCollection *> &actionCollections, QObject *parent)
: QAbstractItemModel(parent),
_changedCount(0)
{
_showIcons=!QCoreApplication::testAttribute(Qt::AA_DontShowIconsInMenus);
for(int r = 0; r < actionCollections.values().count(); r++) {
ActionCollection *coll = actionCollections.values().at(r);
Item *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));
if(!action)
continue;
Item *actionItem = new Item();
actionItem->parentItem = item;
actionItem->row = i;
actionItem->collection = coll;
actionItem->action = action;
actionItem->shortcut = action->shortcut();
item->actionItems.append(actionItem);
}
_categoryItems.append(item);
}
}
示例2: QAbstractItemModel
ShortcutsModel::ShortcutsModel(const QHash<QString, ActionCollection*>& actionCollections, QObject* parent)
: QAbstractItemModel(parent)
, _changedCount(0)
{
for (int r = 0; r < actionCollections.values().count(); r++) {
ActionCollection* coll = actionCollections.values().at(r);
auto* item = new Item();
item->row = r;
item->collection = coll;
for (int i = 0; i < coll->actions().count(); i++) {
auto* action = qobject_cast<Action*>(coll->actions().at(i));
if (!action)
continue;
auto* actionItem = new Item();
actionItem->parentItem = item;
actionItem->row = i;
actionItem->collection = coll;
actionItem->action = action;
actionItem->shortcut = action->shortcut();
item->actionItems.append(actionItem);
}
_categoryItems.append(item);
}
}