void VisBezierCurve::contextMenuEvent(QGraphicsSceneContextMenuEvent *event) { QMenu menu; menu.addAction("Red"); menu.addAction("Green"); menu.addAction("Blue"); menu.addAction("Yellow"); menu.addAction("None"); QAction* a = menu.exec(event->screenPos()); if(a == NULL) return; QString action = a->text(); if(action == "Red"){ set_highlight(196,2,51,100); }else if(action == "Green"){ set_highlight(0,159,107,100); }else if(action == "Blue"){ set_highlight(0,135,189,100); }else if(action == "Yellow"){ set_highlight(255,211,0,100); }else if(action == "None"){ set_unhighlighted(); }else{ } update(); }
MenuBarCommandItem(QTreeWidgetItem *parent, QAction *action) : QTreeWidgetItem(parent, UserType), m_action(action) { setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled | Qt::ItemNeverHasChildren); setText(0, m_action->text().remove("&")); setToolTip(0, QObject::tr("[Drag] to move position")); }
void QDesignerMenuBar::showLineEdit() { QAction *action = 0; if (m_currentIndex >= 0 && m_currentIndex < realActionCount()) action = safeActionAt(m_currentIndex); else action = m_addMenu; if (action->isSeparator()) return; // hideMenu(); m_lastFocusWidget = qApp->focusWidget(); // open edit field for item name const QString text = action != m_addMenu ? action->text() : QString(); m_editor->setText(text); m_editor->selectAll(); m_editor->setGeometry(actionGeometry(action)); m_editor->show(); qApp->setActiveWindow(m_editor); m_editor->setFocus(); m_editor->grabKeyboard(); }
void QgsConfigureShortcutsDialog::setCurrentActionShortcut( QKeySequence s ) { QAction* action = currentAction(); if ( !action ) return; // first check whether this action is not taken already QAction* otherAction = QgsShortcutsManager::instance()->actionForShortcut( s ); if ( otherAction != NULL ) { QString otherActionText = otherAction->text(); otherActionText.remove( '&' ); // remove the accelerator int res = QMessageBox::question( this, tr( "Shortcut conflict" ), tr( "This shortcut is already assigned to action %1. Reassign?" ).arg( otherActionText ), QMessageBox::Yes | QMessageBox::No ); if ( res != QMessageBox::Yes ) return; // reset action of the conflicting other action! QgsShortcutsManager::instance()->setActionShortcut( otherAction, QString() ); QList<QTreeWidgetItem*> items = treeActions->findItems( otherActionText, Qt::MatchExactly ); if ( items.count() > 0 ) // there should be exactly one items[0]->setText( 1, QString() ); } // update manager QgsShortcutsManager::instance()->setActionShortcut( action, s.toString() ); // update gui treeActions->currentItem()->setText( 1, s.toString() ); actionChanged( treeActions->currentItem(), NULL ); }
void PlaybackSlider::contextMenuEvent(QContextMenuEvent *pContextMenuEvent) { QAction *tAction; // return if participant widget is not valid, in this case we cannot change the A/V drift anyway if (mParticipantWidget == NULL) return; QMenu tMenu(this); tAction = tMenu.addAction(Homer::Gui::PlaybackSlider::tr("Adjust A/V drift")); QIcon tIcon2; tIcon2.addPixmap(QPixmap(":/images/22_22/Configuration_Video.png"), QIcon::Normal, QIcon::Off); tAction->setIcon(tIcon2); tAction->setCheckable(true); if (mParticipantWidget-> mAVDriftFrame != NULL) tAction->setChecked(mParticipantWidget->mAVDriftFrame->isVisible()); QAction* tPopupRes = tMenu.exec(pContextMenuEvent->globalPos()); if (tPopupRes != NULL) { if (tPopupRes->text().compare(Homer::Gui::PlaybackSlider::tr("Adjust A/V drift")) == 0) { mParticipantWidget->ActionToggleUserAVDriftWidget(); return; } } }
QString QActionProto::text() const { QAction *item = qscriptvalue_cast<QAction*>(thisObject()); if (item) return item->text(); return QString(); }
void ActionsManager::setupLocalAction(QAction *localAction, const QLatin1String &globalAction, bool connectTrigger) { if (!localAction) { return; } QAction *action = getAction(globalAction); if (action) { localAction->setCheckable(action->isCheckable()); localAction->setChecked(action->isChecked()); localAction->setEnabled(action->isEnabled()); localAction->setIcon(action->icon()); localAction->setText(action->text()); localAction->setShortcut(action->shortcut()); localAction->setObjectName(action->objectName()); if (connectTrigger) { connect(localAction, SIGNAL(triggered()), action, SLOT(trigger())); } } }
void ShortcutsImpl::slotDefault() { QMainWindow *dial = new QMainWindow; Ui::Main ui; ui.setupUi(dial); QList<QObject*> childrens = dial->children(); QListIterator<QObject*> iterator(childrens); while( iterator.hasNext() ) { QObject *object = iterator.next(); QAction *action = qobject_cast<QAction*>(object); if (action) { QString text = action->text().remove("&"); QString shortcut = action->shortcut(); QList<QTableWidgetItem *> listFind = table->findItems(text , Qt::MatchExactly); if( listFind.count() ) table->item(table->row(listFind.first()), 1)->setText(shortcut); } } delete dial; }
void SessionMgr::initMenu(QMenu *menu) { m_menus.insert(menu); if(m_sessions.empty()) { QAction *empty = menu->addAction(tr("No saved sessions")); empty->setEnabled(false); } else { for(int i = 0; i < m_sessions.size(); ++i) { QAction *act = menu->addAction(m_sessions[i].remove(".cldta")); m_sig_map->setMapping(act, act->text()); connect(act, SIGNAL(triggered()), m_sig_map, SLOT(map())); } } menu->addSeparator(); QAction *saveAct = menu->addAction(tr("Save this session...")); QAction *managerAct = menu->addAction(tr("Session manager...")); connect(saveAct, SIGNAL(triggered()), SLOT(saveSessionAct())); connect(managerAct, SIGNAL(triggered()), SLOT(openManager())); connect(menu, SIGNAL(destroyed(QObject*)), SLOT(removeMenu(QObject*))); }
void PMWindow::slotSmileContextMenu(){ #ifndef WIN32 QString emot = CLIENT_DATA_DIR "/emoticons/"; #else QString emot = qApp->applicationDirPath()+QDir::separator()+CLIENT_DATA_DIR "/emoticons/"; #endif//WIN32 QMenu *m = new QMenu(this); QAction * a = NULL; foreach (const QString &f, QDir(emot).entryList(QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot)){ if (!f.isEmpty()){ QAction * act = m->addAction(f); act->setCheckable(true); if (f == WSGET(WS_APP_EMOTICON_THEME)) act->setChecked(true); } } a = m->exec(QCursor::pos()); if (a && a->isChecked()) WSSET(WS_APP_EMOTICON_THEME, a->text()); }
void ShortcutsImpl::initTable(MainImpl *main) { QList<QObject*> childrens = main->children(); QListIterator<QObject*> iterator(childrens); int row = 0; while( iterator.hasNext() ) { QObject *object = iterator.next(); QAction *action = qobject_cast<QAction*>(object); if (action) { QString text = action->text().remove("&"); if ( !text.isEmpty() && !(action->data().toString().contains("Recent|")) ) { QString shortcut = action->shortcut(); QTableWidgetItem *newItem = new QTableWidgetItem(text); newItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled ); newItem->setData(Qt::UserRole, addressToVariant(object)); newItem->setIcon(action->icon()); table->setRowCount(row+1); table->setItem(row, 0, newItem); table->setItem(row++, 1, new QTableWidgetItem(shortcut)); } } table->sortItems( 0 ); } QHeaderView *header = table->horizontalHeader(); header->resizeSection( 0, 230 ); table->verticalHeader()->hide(); }
void CaptureWgt::slotResolution() { QObject * o = sender(); QAction * a = dynamic_cast<QAction *>( o ); if ( !a ) return; for ( int i=0; i<pd->resList.size(); i++ ) { QAction * n = dynamic_cast<QAction *>( pd->resList[i] ); if ( ( n ) && ( a == n ) ) n->setChecked( true ); else n->setChecked( false ); } QString stri = a->text(); QRegExp reg( "\\d{1,}\\s{0,}x" ); QString sw( "640 x" ); if ( reg.indexIn( stri ) != -1 ) sw = reg.cap( 0 ); QString sh( "x 480" ); reg.setPattern( "x\\s{0,}\\d{1,}" ); if ( reg.indexIn( stri ) != -1 ) sh = reg.cap( 0 ); int w = sw.left( sw.length() - 1 ).toInt(); int h = sh.right( sh.length() - 1 ).toInt(); pd->cap->setResolution( QSize( w, h ) ); }
void ScServer::updateToggleRunningAction() { QAction *targetAction = isRunning() ? mActions[Quit] : mActions[Boot]; mActions[ToggleRunning]->setText( targetAction->text() ); mActions[ToggleRunning]->setIcon( targetAction->icon() ); mActions[ToggleRunning]->setShortcut( targetAction->shortcut() ); }
void MenuBar::dropEvent(QDropEvent *event) { const MimeDataObject *mimeData = qobject_cast<const MimeDataObject *>(event->mimeData()); QAction *aAction = qobject_cast<QAction *>(mimeData->object()); if (aAction && isEdited()) { if (activeAction()) if (activeAction()->menu()) activeAction()->menu()->close(); if (aAction->menu()) if (aAction->objectName() == "actionNewMenu") { Menu *menu = new Menu(aAction->text()); menu->setEdited(true); aAction = menu->menuAction(); } QAction *eAction = this->actionAt(event->pos()); QRect rect = actionGeometry(eAction); eAction = this->actionAt(QPoint(event->pos().x()+rect.width()/2, event->pos().y())); if (eAction) { if (aAction->isSeparator()) insertSeparator(eAction); else insertAction(eAction,aAction); } else { if (aAction->isSeparator()) addSeparator(); else addAction(aAction); } event->acceptProposedAction(); } }
void MainWin::OnTreeViewContextMenu(const QPoint &point) { if (point.isNull()) return; QStandardItem *item = connections->itemFromIndex( ui.serversTreeView->indexAt(point) ); QPoint currentPoint = QCursor::pos(); if (!item || currentPoint.isNull() || treeViewUILocked) return; int type = item->type(); if (type == RedisServerItem::TYPE) { if (((RedisServerItem*)item)->isLocked()) { QMessageBox::warning(ui.serversTreeView, "Warning", "Performing operations. Please Keep patience."); return; } QAction * action = serverMenu->exec(currentPoint); if (action == nullptr) return; if (action->text() == "Reload") treeViewUILocked = true; } else if (type == RedisKeyItem::TYPE) { keyMenu->exec(currentPoint); } }
void Menu::populateCharacterEncodingMenu() { if (!m_actionGroup) { QList<int> textCodecs; textCodecs << 106 << 1015 << 1017 << 4 << 5 << 6 << 7 << 8 << 82 << 10 << 85 << 12 << 13 << 109 << 110 << 112 << 2250 << 2251 << 2252 << 2253 << 2254 << 2255 << 2256 << 2257 << 2258 << 18 << 39 << 17 << 38 << 2026; m_actionGroup = new QActionGroup(this); m_actionGroup->setExclusive(true); QAction *defaultAction = QMenu::addAction(tr("Auto Detect")); defaultAction->setData(-1); defaultAction->setCheckable(true); m_actionGroup->addAction(defaultAction); addSeparator(); for (int i = 0; i < textCodecs.count(); ++i) { QTextCodec *codec = QTextCodec::codecForMib(textCodecs.at(i)); if (!codec) { continue; } QAction *textCodecAction = QMenu::addAction(Utils::elideText(codec->name(), this)); textCodecAction->setData(textCodecs.at(i)); textCodecAction->setCheckable(true); m_actionGroup->addAction(textCodecAction); } } MainWindow *mainWindow = MainWindow::findMainWindow(parent()); const QString encoding = (mainWindow ? mainWindow->getWindowsManager()->getOption(QLatin1String("Content/DefaultCharacterEncoding")).toString().toLower() : QString()); for (int i = 2; i < actions().count(); ++i) { QAction *action = actions().at(i); if (!action) { continue; } action->setChecked(encoding == action->text().toLower()); if (action->isChecked()) { break; } } if (!m_actionGroup->checkedAction() && !actions().isEmpty()) { actions().first()->setChecked(true); } }
void tst_QToolBar::accel() { #ifdef Q_WS_MAC extern void qt_set_sequence_auto_mnemonic(bool b); qt_set_sequence_auto_mnemonic(true); #endif QMainWindow mw; QToolBar *toolBar = mw.addToolBar("test"); QAction *action = toolBar->addAction("&test"); action->setIconText(action->text()); // we really want that mnemonic in the button! QSignalSpy spy(action, SIGNAL(triggered(bool))); mw.show(); QApplication::setActiveWindow(&mw); QTest::qWait(100); QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&mw)); QTest::keyClick(&mw, Qt::Key_T, Qt::AltModifier); QTest::qWait(300); QTRY_COMPARE(spy.count(), 1); #ifdef Q_WS_MAC qt_set_sequence_auto_mnemonic(false); #endif }
/*! \reimp */ QString QAccessibleWidget::actionText(int action, Text t, int child) const { if (action == DefaultAction) action = SetFocus; if (action > 0 && !child) { QAction *act = widget()->actions().value(action - 1); if (act) { switch (t) { case Name: return act->text(); case Description: return act->toolTip(); #ifndef QT_NO_SHORTCUT case Accelerator: return act->shortcut().toString(); #endif default: break; } } } return QAccessibleObject::actionText(action, t, child); }
void MuseScore::showProfileMenu() { if (profiles == 0) { profiles = new QActionGroup(this); profiles->setExclusive(true); connect(profiles, SIGNAL(triggered(QAction*)), SLOT(changeProfile(QAction*))); } else { foreach(QAction* a, profiles->actions()) profiles->removeAction(a); } menuProfiles->clear(); const QList<Profile*> pl = Profile::profiles(); // QAction* active = 0; foreach (Profile* p, pl) { QAction* a = profiles->addAction(p->name()); a->setCheckable(true); a->setData(p->path()); if (a->text() == preferences.profile) { // active = a; a->setChecked(true); } menuProfiles->addAction(a); }
void BookmarksToolBar::dropEvent(QDropEvent *event) { const QMimeData *mimeData = event->mimeData(); if (mimeData->hasUrls() && mimeData->hasText()) { QList<QUrl> urls = mimeData->urls(); QAction *action = actionAt(event->pos()); QString dropText; if (action) dropText = action->text(); int row = -1; QModelIndex parentIndex = m_root; for (int i = 0; i < m_bookmarksModel->rowCount(m_root); ++i) { QModelIndex idx = m_bookmarksModel->index(i, 0, m_root); QString title = idx.data().toString(); if (title == dropText) { row = i; if (m_bookmarksModel->hasChildren(idx)) { parentIndex = idx; row = -1; } break; } } BookmarkNode *bookmark = new BookmarkNode(BookmarkNode::Bookmark); bookmark->url = urls.at(0).toString(); bookmark->title = mimeData->text(); BookmarkNode *parent = m_bookmarksModel->node(parentIndex); BookmarksManager *bookmarksManager = m_bookmarksModel->bookmarksManager(); bookmarksManager->addBookmark(parent, bookmark, row); event->acceptProposedAction(); } QToolBar::dropEvent(event); }
void CWizActions::toggleActionText(const QString& strActionName) { int i = 0; WIZACTION* action; WIZACTION* arrayData = actionsData(); while (1) { action = &arrayData[i]; if (action->strName.isEmpty()) return; if (action->strName == strActionName) { break; } i++; } if (action->strText2.isEmpty()) { return; } QAction* pAction = m_actions[strActionName]; if (!pAction) return; if (pAction->text() == action->strText) { pAction->setText(action->strText2); } else { pAction->setText(action->strText); } }
void PDIP::contextMenuEvent(QGraphicsSceneContextMenuEvent * event) { QMenu menu; QAction *rotateAction = menu.addAction("Rotate"); QMenu *pdipSize = menu.addMenu("Change PDIP Size"); QAction *size4 = pdipSize->addAction("4"); QAction *size6 = pdipSize->addAction("6"); QAction *size8 = pdipSize->addAction("8"); QAction *size10 = pdipSize->addAction("10"); QAction *size12 = pdipSize->addAction("12"); QAction *size14 = pdipSize->addAction("14"); QAction *size16 = pdipSize->addAction("16"); QAction *size18 = pdipSize->addAction("18"); QAction *size20 = pdipSize->addAction("20"); QAction *size22 = pdipSize->addAction("22"); QAction *size24 = pdipSize->addAction("24"); QAction *size26 = pdipSize->addAction("26"); QAction *size28 = pdipSize->addAction("28"); QAction *size30 = pdipSize->addAction("30"); QAction *size32 = pdipSize->addAction("32"); QAction *size34 = pdipSize->addAction("34"); QAction *size36 = pdipSize->addAction("36"); QAction *size38 = pdipSize->addAction("38"); QAction *size40 = pdipSize->addAction("40"); QAction *selectedAction = menu.exec(event->screenPos()); if (selectedAction==rotateAction) { this->rotate(90); } else if (selectedAction!=NULL) { bool ok; int pdipSize = selectedAction->text().toInt(&ok,10); if (ok) { this->SetPDIPSize(pdipSize); } } }
void DatasetsTableView::customMenuRequested(const QPoint &pos) { const QModelIndex index = indexAt(pos); if (index.isValid()) { QMenu *menu = new QMenu(this); menu->addAction(new QAction(tr("Copy name"), this)); menu->addAction(new QAction(tr("Open"), this)); menu->addAction(new QAction(tr("Edit"), this)); menu->addAction(new QAction(tr("Delete"), this)); QAction *action = menu->exec(viewport()->mapToGlobal(pos)); if (action != nullptr) { const QString action_text = action->text(); if (action_text == tr("Copy name")) { const QModelIndex new_index = m_sortDatasetsProxyModel->index(index.row(), DatasetItemModel::Name); const QString dataset_name = m_sortDatasetsProxyModel->data(new_index, Qt::DisplayRole).toString(); QClipboard *clipboard = QApplication::clipboard(); clipboard->setText(dataset_name); } else if (action_text == tr("Open")) { emit signalDatasetOpen(index); } else if (action_text == tr("Edit")) { emit signalDatasetEdit(index); } else if (action_text == tr("Delete")) { emit signalDatasetDelete(index); } } } }
void Window::syncedFileClicked() { using namespace qst::utilities; using namespace qst::sysutils; QObject *obj = sender(); QAction * senderObject = static_cast<QAction*>(obj); std::string findFile = senderObject->text().toStdString(); LastSyncedFileList::iterator fileIterator = std::find_if(mLastSyncedFiles.begin(), mLastSyncedFiles.end(), [&findFile](DateFolderFile const& elem) { return getCleanFileName(std::get<2>(elem)) == findFile; }); // get full path to folder std::list<FolderNameFullPath>::iterator folder = std::find_if(mCurrentFoldersLocations.begin(), mCurrentFoldersLocations.end(), [&fileIterator](FolderNameFullPath const& elem) { return getFullCleanFileName(elem.first) == std::get<1>(*fileIterator); }); std::string fullPath = folder->second + getPathToFileName(std::get<2>(*fileIterator)) + SystemUtility().getPlatformDelimiter(); std::cout << "FineFile " << findFile << "Opening " << fullPath << std::endl; QDesktopServices::openUrl(QUrl::fromLocalFile(tr(fullPath.c_str()))); }
void MenuScriptingInterface::menuItemTriggered() { QAction* menuItemAction = dynamic_cast<QAction*>(sender()); if (menuItemAction) { // emit the event emit menuItemEvent(menuItemAction->text()); } }
KexiFindDialog::KexiFindDialog(QWidget* parent) : QDialog(parent, Qt::Dialog | Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::Tool) , d(new Private()) { setObjectName("KexiFindDialog"); setupUi(this); m_search->setCurrentIndex( (int)KexiSearchAndReplaceViewInterface::Options::SearchDown); layout()->setMargin(KDialog::marginHint()); layout()->setSpacing(KDialog::spacingHint()); QAction *a = KStandardAction::findNext(0, 0, 0); m_btnFind->setText(a->text()); m_btnFind->setIcon(a->icon()); delete a; m_btnClose->setText(KStandardGuiItem::close().text()); m_btnClose->setIcon(KStandardGuiItem::close().icon()); connect(m_btnFind, SIGNAL(clicked()), this, SIGNAL(findNext())); connect(m_btnClose, SIGNAL(clicked()), this, SLOT(slotCloseClicked())); connect(m_btnReplace, SIGNAL(clicked()), this, SIGNAL(replaceNext())); connect(m_btnReplaceAll, SIGNAL(clicked()), this, SIGNAL(replaceAll())); // clear message after the text is changed connect(m_textToFind, SIGNAL(editTextChanged(QString)), this, SLOT(updateMessage(QString))); connect(m_textToReplace, SIGNAL(editTextChanged(QString)), this, SLOT(updateMessage(QString))); d->replaceMode = true; //to force updating by setReplaceMode() setReplaceMode(false); setLookInColumnList(QStringList(), QStringList()); }
void ToolBarActionProvider::networkUpdated(const Network *net) { if(!net) net = qobject_cast<const Network *>(sender()); if(!net) return; Action *act = _networkActions.value(net->networkId()); if(!act) return; _networksConnectMenu->removeAction(act); _networksDisconnectMenu->removeAction(act); QMenu *newMenu = net->connectionState() != Network::Disconnected ? _networksDisconnectMenu : _networksConnectMenu; act->setText(net->networkName()); const int lastidx = newMenu->actions().count() - 2; QAction *beforeAction = newMenu->actions().at(lastidx); for(int i = 0; i < newMenu->actions().count() - 2; i++) { QAction *action = newMenu->actions().at(i); if(net->networkName().localeAwareCompare(action->text()) < 0) { beforeAction = action; break; } } newMenu->insertAction(beforeAction, act); action(NetworkConnectAll)->setEnabled(_networksConnectMenu->actions().count() > 2); action(NetworkDisconnectAll)->setEnabled(_networksDisconnectMenu->actions().count() > 2); action(JoinChannel)->setEnabled(_networksDisconnectMenu->actions().count() > 2); }
int drv_action(int drvid, void *a0, void* a1, void* a2, void* a3, void* a4, void* a5, void* a6, void* a7, void* a8, void* a9) { handle_head* head = (handle_head*)a0; QAction *self = (QAction*)head->native; switch (drvid) { case ACTION_INIT: { drvNewObj(a0, new QAction(qApp)); break; } case ACTION_SETTEXT: { self->setText(drvGetString(a1)); break; } case ACTION_TEXT: { drvSetString(a1,self->text()); break; } case ACTION_ONTRIGGERED: { QObject::connect(self,SIGNAL(triggered(bool)),drvNewSignal(self,a1,a2),SLOT(call(bool))); break; } default: return 0; } return 1; }
bool QtKeySequenceEdit::eventFilter(QObject *o, QEvent *e) { if (o == m_lineEdit && e->type() == QEvent::ContextMenu) { QContextMenuEvent *c = static_cast<QContextMenuEvent *>(e); QMenu *menu = m_lineEdit->createStandardContextMenu(); const QList<QAction *> actions = menu->actions(); QListIterator<QAction *> itAction(actions); while (itAction.hasNext()) { QAction *action = itAction.next(); action->setShortcut(QKeySequence()); QString actionString = action->text(); const int pos = actionString.lastIndexOf(QLatin1Char('\t')); if (pos > 0) actionString.remove(pos, actionString.length() - pos); action->setText(actionString); } QAction *actionBefore = 0; if (actions.count() > 0) actionBefore = actions[0]; QAction *clearAction = new QAction(tr("Clear Shortcut"), menu); menu->insertAction(actionBefore, clearAction); menu->insertSeparator(actionBefore); clearAction->setEnabled(!m_keySequence.isEmpty()); connect(clearAction, SIGNAL(triggered()), this, SLOT(slotClearShortcut())); menu->exec(c->globalPos()); delete menu; e->accept(); return true; } return QWidget::eventFilter(o, e); }
void tst_QMenu::indexBasedInsertion() { // test the compat'ed index based insertion QFETCH(int, indexForInsertion); QFETCH(int, expectedIndex); { QMenu menu; menu.addAction("Regular Item"); menu.insertItem("New Item", -1 /*id*/, indexForInsertion); QAction *act = menu.actions().value(expectedIndex); QVERIFY(act); QCOMPARE(act->text(), QString("New Item")); } { QMenu menu; menu.addAction("Regular Item"); menu.insertSeparator(indexForInsertion); QAction *act = menu.actions().value(expectedIndex); QVERIFY(act); QVERIFY(act->isSeparator()); } }