本文整理汇总了C++中QAction::actionGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ QAction::actionGroup方法的具体用法?C++ QAction::actionGroup怎么用?C++ QAction::actionGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAction
的用法示例。
在下文中一共展示了QAction::actionGroup方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InsertMenuItemAction
static void InsertMenuItemAction( const wxMenu *menu, const wxMenuItem *previousItem,
const wxMenuItem *item, const wxMenuItem *successiveItem )
{
QMenu *qtMenu = menu->GetHandle();
QAction *itemAction = item->GetHandle();
if ( item->GetKind() == wxITEM_RADIO )
{
// If the previous menu item is a radio item then add this item to the
// same action group, otherwise start a new group:
if ( previousItem != NULL && previousItem->GetKind() == wxITEM_RADIO )
{
QAction *previousItemAction = previousItem->GetHandle();
QActionGroup *previousItemActionGroup = previousItemAction->actionGroup();
wxASSERT_MSG( previousItemActionGroup != NULL, "An action group should have been setup" );
previousItemActionGroup->addAction( itemAction );
}
else
{
QActionGroup *actionGroup = new QActionGroup( qtMenu );
actionGroup->addAction( itemAction );
wxASSERT_MSG( itemAction->actionGroup() == actionGroup, "Must be the same action group" );
}
}
// Insert the action into the actual menu:
QAction *successiveItemAction = ( successiveItem != NULL ) ? successiveItem->GetHandle() : NULL;
qtMenu->insertAction( successiveItemAction, itemAction );
}
示例2:
QActionGroup *QActionProto::actionGroup() const
{
QAction *item = qscriptvalue_cast<QAction*>(thisObject());
if (item)
return item->actionGroup();
return 0;
}
示例3: QDialog
ToolbarDialog::ToolbarDialog(QWidget* parent)
: QDialog(parent),m_defaultToolBars()
{
setupUi(this);
createDefaultToolBars();
// populate all available actions
QList<QAction*> actions = parent->findChildren<QAction*>(QRegExp("action*"));
QAction* action;
foreach(action, actions) {
if (action->actionGroup()->objectName() != "extraGroup")
continue;
QListWidgetItem* item = new QListWidgetItem(action->toolTip());
item->setIcon(action->icon());
item->setData(Qt::UserRole, QVariant::fromValue((QObject*)action));
listAllActions->addItem(item);
}
// Important to add special Separator
listAllActions->addItem("Separator");
QList<QToolBar*> toolbars = parent->findChildren<QToolBar*>();
QToolBar* toolbar = NULL;
int index = 0;
foreach(toolbar, toolbars) {
index = (int)(toolbar->iconSize().height()/10)-1;
if (toolbar->objectName() != "keyToolBar")
comboToolbars->addItem(toolbar->windowTitle(), QVariant::fromValue((QObject*)toolbar));
}
示例4: deletePluginSwitchAction
void RackWindow::deletePluginSwitchAction(QObject *action)
{
QAction *act = qobject_cast<QAction *>(action);
QActionGroup *ag = act->actionGroup();
//make sure we have a checked action in the actiongroup after we delete this one
if (act == ag->checkedAction() && ag->actions().count() > 1) {
if (act == ag->actions().last())
{
ag->actions().at(ag->actions().count() - 2)->trigger();
}
else
{
ag->actions().at(ag->actions().indexOf(act) + 1)->trigger();
}
}
delete act;
act = 0;
}
示例5: mouseReleaseEvent
void QRibbonButtonBar::mouseReleaseEvent(QMouseEvent* evt)
{
QPoint cursor(evt->pos());
if (m_active_button)
{
QRibbonButtonBarButtonSizeInfo& size = m_active_button->base->sizes[m_active_button->size];
QRect btn_rect;
btn_rect.setTopLeft(m_layout_offset + m_active_button->position);
btn_rect.setSize(size.size);
if (btn_rect.contains(cursor))
{
int id = m_active_button->base->id;
cursor -= btn_rect.topLeft();
QAction* pAction = m_active_button->base->m_pAction;
if (pAction)
{
do
{
if (size.normal_region.contains(cursor))
{
int nKind = m_active_button->base->kind;
if (nKind == QRIBBON_BUTTON_NORMAL)
{
pAction->triggered();
}
else if (nKind == QRIBBON_BUTTON_TOGGLE)
{
pAction->triggered(true);
}
else if (nKind == QRIBBON_BUTTON_HYBRID || nKind == QRIBBON_BUTTON_DROPDOWN)
{
QActionGroup* pGroup = pAction->actionGroup();
if (pGroup)
{
QList<QAction*> lsActions = pGroup->actions();
Q_ASSERT(lsActions.size() == 3);
QAction* pAction1 = lsActions.at(0);
QAction* pAction2 = lsActions.at(1);
if (pAction1 && pAction2)
{
pAction1->triggered();
pAction2->triggered();
}
}
}
}
m_lock_active_state = true;
m_lock_active_state = false;
} while (false);
}
if (m_active_button) // may have been NULLed by event handler
{
m_active_button->base->state &= ~QRIBBON_BUTTONBAR_BUTTON_ACTIVE_MASK;
m_active_button = NULL;
}
update();
}
}
}
示例6: actionGroup
int Action::actionGroup(lua_State * L) // const : QActionGroup
{
QAction* obj = QtObject<QAction>::check( L, 1);
QtObject<QActionGroup>::create( L, obj->actionGroup() );
return 1;
}