本文整理汇总了C++中ActionList::back方法的典型用法代码示例。如果您正苦于以下问题:C++ ActionList::back方法的具体用法?C++ ActionList::back怎么用?C++ ActionList::back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActionList
的用法示例。
在下文中一共展示了ActionList::back方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleContextMenuEvent
bool ToolBarEventFilter::handleContextMenuEvent(QContextMenuEvent * event )
{
event->accept();
const QPoint globalPos = event->globalPos();
const int index = actionIndexAt(m_toolBar, m_toolBar->mapFromGlobal(globalPos), m_toolBar->orientation());
const ActionList actions = m_toolBar->actions();
QAction *action = index != -1 ?actions.at(index) : 0;
QVariant itemData;
QMenu menu(0);
// Insert before
if (action && index != 0 && !action->isSeparator()) {
QAction *newSeperatorAct = menu.addAction(tr("Insert Separator before '%1'").arg(action->objectName()));
qVariantSetValue(itemData, action);
newSeperatorAct->setData(itemData);
connect(newSeperatorAct, SIGNAL(triggered()), this, SLOT(slotInsertSeparator()));
}
// Append separator
if (actions.empty() || !actions.back()->isSeparator()) {
QAction *newSeperatorAct = menu.addAction(tr("Append Separator"));
qVariantSetValue(itemData, static_cast<QAction*>(0));
newSeperatorAct->setData(itemData);
connect(newSeperatorAct, SIGNAL(triggered()), this, SLOT(slotInsertSeparator()));
}
// Remove
if (!menu.actions().empty())
menu.addSeparator();
// Remove
if (action) {
QAction *a = menu.addAction(tr("Remove action '%1'").arg(action->objectName()));
qVariantSetValue(itemData, action);
a->setData(itemData);
connect(a, SIGNAL(triggered()), this, SLOT(slotRemoveSelectedAction()));
}
QAction *remove_toolbar = menu.addAction(tr("Remove Toolbar '%1'").arg(m_toolBar->objectName()));
connect(remove_toolbar, SIGNAL(triggered()), this, SLOT(slotRemoveToolBar()));
menu.exec(globalPos);
return true;
}
示例2: contextMenuActions
ActionList ToolBarEventFilter::contextMenuActions(const QPoint &globalPos)
{
ActionList rc;
const int index = actionIndexAt(m_toolBar, m_toolBar->mapFromGlobal(globalPos), m_toolBar->orientation());
const ActionList actions = m_toolBar->actions();
QAction *action = index != -1 ?actions.at(index) : 0;
QVariant itemData;
// Insert before
if (action && index != 0 && !action->isSeparator()) {
QAction *newSeperatorAct = new QAction(tr("Insert Separator before '%1'").arg(action->objectName()), 0);
itemData.setValue(action);
newSeperatorAct->setData(itemData);
connect(newSeperatorAct, SIGNAL(triggered()), this, SLOT(slotInsertSeparator()));
rc.push_back(newSeperatorAct);
}
// Append separator
if (actions.empty() || !actions.back()->isSeparator()) {
QAction *newSeperatorAct = new QAction(tr("Append Separator"), 0);
itemData.setValue(static_cast<QAction*>(0));
newSeperatorAct->setData(itemData);
connect(newSeperatorAct, SIGNAL(triggered()), this, SLOT(slotInsertSeparator()));
rc.push_back(newSeperatorAct);
}
// Promotion
if (!m_promotionTaskMenu)
m_promotionTaskMenu = new PromotionTaskMenu(m_toolBar, PromotionTaskMenu::ModeSingleWidget, this);
m_promotionTaskMenu->addActions(formWindow(), PromotionTaskMenu::LeadingSeparator|PromotionTaskMenu::TrailingSeparator, rc);
// Remove
if (action) {
QAction *a = new QAction(tr("Remove action '%1'").arg(action->objectName()), 0);
itemData.setValue(action);
a->setData(itemData);
connect(a, SIGNAL(triggered()), this, SLOT(slotRemoveSelectedAction()));
rc.push_back(a);
}
QAction *remove_toolbar = new QAction(tr("Remove Toolbar '%1'").arg(m_toolBar->objectName()), 0);
connect(remove_toolbar, SIGNAL(triggered()), this, SLOT(slotRemoveToolBar()));
rc.push_back(remove_toolbar);
return rc;
}
示例3: readAction
void Resource::readAction(Common::File *file, ActionList &list) {
list.clear();
while (file->readByte() == 1) {
list.push_back(Action());
Action &action = list.back();
action._actionType = (ActionType)file->readSint16LE();
action._param1 = file->readSint16LE();
action._param2 = file->readSint16LE();
action._param3 = file->readSint16LE();
if (action._actionType == kActionShowMessages) {
action._messages.reserve(action._param1);
for (int i = 0; i < action._param1; i++)
action._messages.push_back(readString(file));
} else {
action._messages.push_back(readString(file));
}
}
}
示例4: freeArea
// Determine the free area behind the last action.
QRect ToolBarEventFilter::freeArea(const QToolBar *tb)
{
QRect rc = QRect(QPoint(0, 0), tb->size());
const ActionList actionList = tb->actions();
QRect exclusionRectangle = actionList.empty() ? handleArea(tb) : tb->actionGeometry(actionList.back());
switch (tb->orientation()) {
case Qt::Horizontal:
switch (tb->layoutDirection()) {
case Qt::LayoutDirectionAuto: // Should never happen
case Qt::LeftToRight:
rc.setX(exclusionRectangle.right() + 1);
break;
case Qt::RightToLeft:
rc.setRight(exclusionRectangle.x());
break;
}
break;
case Qt::Vertical:
rc.setY(exclusionRectangle.bottom() + 1);
break;
}
return rc;
}