本文整理汇总了C++中RemoveActionFromCommand::init方法的典型用法代码示例。如果您正苦于以下问题:C++ RemoveActionFromCommand::init方法的具体用法?C++ RemoveActionFromCommand::init怎么用?C++ RemoveActionFromCommand::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RemoveActionFromCommand
的用法示例。
在下文中一共展示了RemoveActionFromCommand::init方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: startDrag
void QDesignerMenuBar::startDrag(const QPoint &pos)
{
const int index = findAction(pos);
if (m_currentIndex == -1 || index >= realActionCount())
return;
QAction *action = safeActionAt(index);
QDesignerFormWindowInterface *fw = formWindow();
RemoveActionFromCommand *cmd = new RemoveActionFromCommand(fw);
cmd->init(this, action, actions().at(index + 1));
fw->commandHistory()->push(cmd);
adjustSize();
hideMenu(index);
QDrag *drag = new QDrag(this);
drag->setPixmap(ActionRepositoryMimeData::actionDragPixmap(action));
drag->setMimeData(new ActionRepositoryMimeData(action, Qt::MoveAction));
const int old_index = m_currentIndex;
m_currentIndex = -1;
if (drag->start(Qt::MoveAction) == Qt::IgnoreAction) {
InsertActionIntoCommand *cmd = new InsertActionIntoCommand(fw);
cmd->init(this, action, safeActionAt(index));
fw->commandHistory()->push(cmd);
m_currentIndex = old_index;
adjustSize();
}
}
示例2: slotRemoveSelectedAction
void ToolBarEventFilter::slotRemoveSelectedAction()
{
QAction *action = qobject_cast<QAction*>(sender());
if (!action)
return;
QAction *a = qvariant_cast<QAction*>(action->data());
Q_ASSERT(a != 0);
QDesignerFormWindowInterface *fw = formWindow();
Q_ASSERT(fw);
const ActionList actions = m_toolBar->actions();
const int pos = actions.indexOf(a);
QAction *action_before = 0;
if (pos != -1 && actions.count() > pos + 1)
action_before = actions.at(pos + 1);
RemoveActionFromCommand *cmd = new RemoveActionFromCommand(fw);
cmd->init(m_toolBar, a, action_before);
fw->commandHistory()->push(cmd);
}
示例3: startDrag
void ToolBarEventFilter::startDrag(const QPoint &pos, Qt::KeyboardModifiers modifiers)
{
const int index = actionIndexAt(m_toolBar, pos, m_toolBar->orientation());
if (index == - 1)
return;
const ActionList actions = m_toolBar->actions();
QAction *action = actions.at(index);
QDesignerFormWindowInterface *fw = formWindow();
const Qt::DropAction dropAction = (modifiers & Qt::ControlModifier) ? Qt::CopyAction : Qt::MoveAction;
if (dropAction == Qt::MoveAction) {
RemoveActionFromCommand *cmd = new RemoveActionFromCommand(fw);
const int nextIndex = index + 1;
QAction *nextAction = nextIndex < actions.size() ? actions.at(nextIndex) : 0;
cmd->init(m_toolBar, action, nextAction);
fw->commandHistory()->push(cmd);
}
QDrag *drag = new QDrag(m_toolBar);
drag->setPixmap(ActionRepositoryMimeData::actionDragPixmap( action));
drag->setMimeData(new ActionRepositoryMimeData(action, dropAction));
if (drag->start(dropAction) == Qt::IgnoreAction) {
hideDragIndicator();
if (dropAction == Qt::MoveAction) {
const ActionList currentActions = m_toolBar->actions();
QAction *previous = 0;
if (index >= 0 && index < currentActions.size())
previous = currentActions.at(index);
InsertActionIntoCommand *cmd = new InsertActionIntoCommand(fw);
cmd->init(m_toolBar, action, previous);
fw->commandHistory()->push(cmd);
}
}
}