本文整理汇总了C++中QAction::text方法的典型用法代码示例。如果您正苦于以下问题:C++ QAction::text方法的具体用法?C++ QAction::text怎么用?C++ QAction::text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAction
的用法示例。
在下文中一共展示了QAction::text方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: contextMenuEvent
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();
}
示例2: QTreeWidgetItem
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"));
}
示例3: showLineEdit
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();
}
示例4: setCurrentActionShortcut
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 );
}
示例5: contextMenuEvent
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;
}
}
}
示例6: text
QString QActionProto::text() const
{
QAction *item = qscriptvalue_cast<QAction*>(thisObject());
if (item)
return item->text();
return QString();
}
示例7: setupLocalAction
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()));
}
}
}
示例8: slotDefault
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;
}
示例9: initMenu
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*)));
}
示例10: slotSmileContextMenu
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());
}
示例11: initTable
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();
}
示例12: slotResolution
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 ) );
}
示例13: updateToggleRunningAction
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() );
}
示例14: dropEvent
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();
}
}
示例15: OnTreeViewContextMenu
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);
}
}