当前位置: 首页>>代码示例>>C++>>正文


C++ QAction::actionGroup方法代码示例

本文整理汇总了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 );
}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:28,代码来源:menu.cpp

示例2:

QActionGroup *QActionProto::actionGroup() const
{
  QAction *item = qscriptvalue_cast<QAction*>(thisObject());
  if (item)
    return item->actionGroup();
  return 0;
}
开发者ID:Wushaowei001,项目名称:xtuple-1,代码行数:7,代码来源:qactionproto.cpp

示例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));
    }
开发者ID:adaptee,项目名称:qterm-hack,代码行数:28,代码来源:toolbardialog.cpp

示例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;
}
开发者ID:stemuedendron,项目名称:rack-radio-automation-construction-kit,代码行数:19,代码来源:rackwindow.cpp

示例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();
		}
	}
}
开发者ID:truongphamdevhp,项目名称:TheGodFather,代码行数:61,代码来源:buttonbar.cpp

示例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;
}
开发者ID:Wushaowei001,项目名称:NAF,代码行数:6,代码来源:QtlAction.cpp


注:本文中的QAction::actionGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。