本文整理汇总了C++中QAction::associatedWidgets方法的典型用法代码示例。如果您正苦于以下问题:C++ QAction::associatedWidgets方法的具体用法?C++ QAction::associatedWidgets怎么用?C++ QAction::associatedWidgets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAction
的用法示例。
在下文中一共展示了QAction::associatedWidgets方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: closeUp
void PopupMenu::closeUp()
{
if(isVisible())
{
DEBUG_PRST_ROUTES(stderr, "PopupMenu::closeUp() this:%p closing\n", this);
close();
}
QAction* act = menuAction();
if(act)
{
DEBUG_PRST_ROUTES(stderr, "PopupMenu::closeUp() this:%p menuAction:%p\n", this, act);
const int sz = act->associatedWidgets().size();
for(int i = 0; i < sz; ++i)
{
DEBUG_PRST_ROUTES(stderr, " associated widget#:%d\n", i);
if(PopupMenu* pup = qobject_cast<PopupMenu*>(act->associatedWidgets().at(i)))
{
DEBUG_PRST_ROUTES(stderr, " associated popup:%p\n", pup);
DEBUG_PRST_ROUTES(stderr, " closing...\n");
pup->closeUp();
}
}
}
}
示例2: waitForPopup
/*
Checks if an expanded toolbar has to wait for this popup to close before
the toolbar collapses. This is true if
1) the popup has the toolbar in its parent chain,
2) the popup is a menu whose menuAction is somewhere in the toolbar.
*/
static bool waitForPopup(QToolBar *tb, QWidget *popup)
{
if (popup == 0 || popup->isHidden())
return false;
QWidget *w = popup;
while (w != 0) {
if (w == tb)
return true;
w = w->parentWidget();
}
QMenu *menu = qobject_cast<QMenu*>(popup);
if (menu == 0)
return false;
QAction *action = menu->menuAction();
QList<QWidget*> widgets = action->associatedWidgets();
for (int i = 0; i < widgets.count(); ++i) {
if (waitForPopup(tb, widgets.at(i)))
return true;
}
return false;
}
示例3:
QList<QWidget*> QActionProto::associatedWidgets() const
{
QAction *item = qscriptvalue_cast<QAction*>(thisObject());
if (item)
return item->associatedWidgets();
return QList<QWidget*>();
}
示例4: associatedWidgets
int Action::associatedWidgets(lua_State * L) // const : QList<QWidget *>
{
QAction* obj = QtObject<QAction>::check( L, 1);
QList<QWidget *> r = obj->associatedWidgets();
lua_newtable( L );
int t = lua_gettop( L );
for( int i = 0; i < r.size(); ++i )
{
Util::push( L, i + 1 );
QtObject<QWidget>::create( L, r[i] );
lua_rawset( L, t );
}
return 1;
}
示例5: qDebug
GUIPluginBase::~GUIPluginBase()
{
qDebug("--GUIPluginBase::~GUIPluginBase()");
//unload();
if (m_menu) {
QAction *action = m_menu->menuAction();
QList<QWidget *> widgetList = action->associatedWidgets();
foreach(QWidget *widget, widgetList) {
widget->removeAction(action);
}
QList<QGraphicsWidget *> graphicsWidgetList = action->associatedGraphicsWidgets();
foreach(QGraphicsWidget *graphicsWidget, graphicsWidgetList) {
graphicsWidget->removeAction(action);
}