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


C++ QWidget::addAction方法代码示例

本文整理汇总了C++中QWidget::addAction方法的典型用法代码示例。如果您正苦于以下问题:C++ QWidget::addAction方法的具体用法?C++ QWidget::addAction怎么用?C++ QWidget::addAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QWidget的用法示例。


在下文中一共展示了QWidget::addAction方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: createWidgetsContainer

void SkinStyle::createWidgetsContainer(QWidget * widget, const QString & objectName) {
    QWidget * container = new QWidget(widget->parentWidget());
    container->setObjectName(objectName);

    QHBoxLayout * layout = new QHBoxLayout();
    container->setLayout(layout);

    QObjectList objects = widget->children();
    for (int i = 0; i < objects.size(); i++) {
        QObject * object = objects.at(i);

        if (object->isWidgetType()) {
            if (!object->inherits("QToolBarHandle") && !object->inherits("QToolBarExtension")) {
                QWidget * w = qobject_cast < QWidget * > (object);
                addWidgetToLayout(w, layout);
                w->show();
            }
        }

        else if (object->inherits("QAction")) {
            QAction * a = qobject_cast < QAction * > (object);
            QWidget * w = new QWidget(container);
            w->addAction(a);
            addWidgetToLayout(w, layout);
        }

        else if (object->inherits("QLayout")) {
            QLayout * l = qobject_cast < QLayout * > (object);
            layout->addLayout(l);
        }
    }

    container->show();
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例2: addAction

void SoftkeysActionBoxModule::addAction(QAction *action)
{
	QWidget *p = this;
	while (p->parentWidget() && !p->isWindow()) {
		p = p->parentWidget();
	}
	p->addAction(action);
}
开发者ID:AlexeyProkhin,项目名称:qutim,代码行数:8,代码来源:softkeysactionbox.cpp

示例3: addActionToParent

void MyAction::addActionToParent() {
	if (parent()) {
		if (parent()->inherits("QWidget")) {
			QWidget *w = static_cast<QWidget*> (parent());
			w->addAction(this);
		}
	}
}
开发者ID:dradetsky,项目名称:smplayer-mirror,代码行数:8,代码来源:myaction.cpp

示例4: textChanged

void HelpQuery::textChanged(const QString& ss)
      {
      QString s = ss.toLower();
      QWidget* menu = static_cast<QWidget*>(parent());
      if (s.isEmpty()) {
            if (!emptyState) {   // restore old menu entries
                  QList<QAction*> al = menu->actions();
                  for (QAction* a : al) {
                        if (a != this)
                              menu->removeAction(a);
                        }
                  for (QAction* a : actions) {
                        if (a != this)
                              menu->addAction(a);
                        }
                  }
            emptyState = true;
            return;
            }
      if (emptyState)
            actions = menu->actions();
      for (QAction* a : menu->actions()) {
            if (a != this)
                  menu->removeAction(a);
            }
      emptyState = false;
      if (!mscore->helpEngine())
            return;
      QMap<QString,QUrl>list = mscore->helpEngine()->linksForIdentifier(s);
//      QMap<QString,QUrl>list = mscore->helpEngine()->indexModel()->linksForKeyword(s);
      int k = 0;
      for (auto i = list.begin(); i != list.end(); ++i) {
            QAction* action = new QAction(i.key(), this);
            action->setData(i.value());
// printf("add action <%s> <%s>\n", qPrintable(i.key()), qPrintable(i.value().toString()));
            menu->addAction(action);
            connect(action, SIGNAL(triggered()), mapper, SLOT(map()));
            mapper->setMapping(action, action);
            if (++k > 10)
                  break;
            }
      }
开发者ID:jpirie,项目名称:MuseScore,代码行数:42,代码来源:help.cpp

示例5: themer

void
KdmLabel::doPlugActions( bool plug )
{
	if (action) {
		QWidget *w = themer()->widget();
		if (plug)
			w->addAction( action );
		else
			w->removeAction( action );
	}
}
开发者ID:jschwartzenberg,项目名称:kicker,代码行数:11,代码来源:kdmlabel.cpp

示例6: parseArgs

void Application::parseArgs( const QStringList &args )
{
	QStringList params = args;
	params.removeAll("-capi");
	params.removeAll("-cng");
	params.removeAll("-pkcs11");
	params.removeAll("-noNativeFileDialog");

	QWidget *w = new MainWindow();
#ifdef Q_OS_MAC
	w->installEventFilter( d->bar );
#endif
	w->addAction( d->closeAction );
	w->activateWindow();
	w->show();
	w->raise();
	if( !params.isEmpty() )
		QMetaObject::invokeMethod( w, "open", Q_ARG(QStringList,params) );
}
开发者ID:Krabi,项目名称:idkaart_public,代码行数:19,代码来源:Application.cpp

示例7: QAction

StelAction::StelAction(const QString& actionId,
		       const QString& groupId,
		       const QString& text,
		       const QString& primaryKey,
		       const QString& altKey,
		       bool global):
	QObject(StelApp::getInstance().getStelActionManager()),
	group(groupId),
	text(text),
	global(global),
	keySequence(primaryKey),
	altKeySequence(altKey),
	defaultKeySequence(primaryKey),
	defaultAltKeySequence(altKey),
	target(NULL),
	boolProperty(NULL)
      #ifndef USE_QUICKVIEW
      ,qAction(NULL)
      #endif
{
	setObjectName(actionId);
	// Check the global conf for custom shortcuts.
	QSettings* conf = StelApp::getInstance().getSettings();
	QString confShortcut = conf->value("shortcuts/" + actionId).toString();
	if (!confShortcut.isEmpty())
	{
		QStringList shortcuts = confShortcut.split(" ");
		if (shortcuts.size() > 2)
			qWarning() << actionId << ": does not support more than two shortcuts per action";
		setShortcut(shortcuts[0]);
		if (shortcuts.size() > 1)
			setAltShortcut(shortcuts[1]);
	}
#ifndef USE_QUICKVIEW
	QWidget* mainView = &StelMainView::getInstance();
	qAction = new QAction(this);
	onChanged();
	mainView->addAction(qAction);
	connect(qAction, SIGNAL(triggered()), this, SLOT(trigger()));
	connect(this, SIGNAL(changed()), this, SLOT(onChanged()));
#endif
}
开发者ID:,项目名称:,代码行数:42,代码来源:

示例8: addAction

void QWidgetProto::addAction(QAction *action)
{
  QWidget *item = qscriptvalue_cast<QWidget*>(thisObject());
  if (item)
    item->addAction(action);
}
开发者ID:AlFoX,项目名称:qt-client,代码行数:6,代码来源:qwidgetproto.cpp


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