本文整理汇总了C++中QAction::shortcut方法的典型用法代码示例。如果您正苦于以下问题:C++ QAction::shortcut方法的具体用法?C++ QAction::shortcut怎么用?C++ QAction::shortcut使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAction
的用法示例。
在下文中一共展示了QAction::shortcut方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initAboutText
void OcularDialog::initAboutText()
{
//BM: Most of the text for now is the original contents of the About widget.
QString html = "<html><head><title></title></head><body>";
html += "<h2>" + q_("Oculars Plug-in") + "</h2><table width=\"90%\">";
html += "<tr width=\"30%\"><td><strong>" + q_("Version") + ":</strong></td><td>" + OCULARS_PLUGIN_VERSION + "</td></tr>";
html += "<tr><td><strong>" + q_("Authors") + ":</strong></td><td>Timothy Reaves <[email protected]><br />Bogdan Marinov</td></tr>";
html += "</table>";
//Overview
html += "<h2>" + q_("Overview") + "</h2>";
html += "<p>" + q_("This plugin is intended to simulate what you would see through an eyepiece. This configuration dialog can be used to add, modify, or delete eyepieces and telescopes, as well as CCD Sensors. Your first time running the app will populate some samples to get your started.") + "</p>";
html += "<p>" + q_("You can choose to scale the image you see on the screen. This is intended to show you a better comparison of what one eyepiece/telescope combination will be like as compared to another. The same eyepiece in two different telescopes of differing focal length will produce two different exit circles, changing the view someone. The trade-off of this is that, with the image scaled, a good deal of the screen can be wasted. Therefore I recommend that you leave it off, unless you feel you have a need of it.") + "</p>";
html += "<p>" + q_("You can toggle a crosshair in the view. Ideally, I wanted this to be aligned to North. I've been unable to do so. So currently it aligns to the top of the screen.") + "</p>";
html += "<p>" + QString(q_("You can toggle a Telrad finder; this can only be done when you have not turned on the Ocular view. This feature draws three concentric circles of 0.5%1, 2.0%1, and 4.0%1, helping you see what you would expect to see with the naked eye through the Telrad (or similar) finder.")).arg(QChar(0x00B0)) + "</p>";
html += "<p>" + q_("If you find any issues, please let me know. Enjoy!") + "</p>";
//Keys
html += "<h2>" + q_("Hot Keys") + "</h2>";
html += "<p>" + q_("The plug-in's key bindings can be edited in the General Tab.") + "</p>";
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
Q_ASSERT(gui);
QAction* actionOcular = gui->getGuiAction("actionShow_Ocular");
Q_ASSERT(actionOcular);
QAction* actionMenu = gui->getGuiAction("actionShow_Ocular_Menu");
Q_ASSERT(actionMenu);
QKeySequence ocularShortcut = actionOcular->shortcut();
QString ocularString = ocularShortcut.toString(QKeySequence::NativeText);
ocularString = Qt::escape(ocularString);
if (ocularString.isEmpty())
ocularString = q_("[no key defined]");
QKeySequence menuShortcut = actionMenu->shortcut();
QString menuString = menuShortcut.toString(QKeySequence::NativeText);
menuString = Qt::escape(menuString);
if (menuString.isEmpty())
menuString = q_("[no key defined]");
html += "<ul>";
html += "<li>";
html += QString("<strong>%1:</strong> %2").arg(ocularString).arg(q_("Switches on/off the ocular overlay."));
html += "</li>";
html += "<li>";
html += QString("<strong>%1:</strong> %2").arg(menuString).arg(q_("Opens the pop-up navigation menu."));
html += "</li>";
html += "</ul>";
html += "</body></html>";
QString htmlStyleSheet(gui->getStelStyle().htmlStyleSheet);
ui->textBrowser->document()->setDefaultStyleSheet(htmlStyleSheet);
ui->textBrowser->setHtml(html);
}
示例2: applyPreferences
//-------------------------------------
void HotkeysController::applyPreferences() {
QAction *actions[] = {
m_mainWindow->ui()->actionPlayPause, m_mainWindow->ui()->actionNext,
m_mainWindow->ui()->actionPrevious,
m_mainWindow->ui()->actionAdd_to_favorites,
};
qDebug() << "Hotkeys : updating Qxt global shortcuts";
for (int i = 0; i < 4; ++i) {
QAction *action = actions[i];
QxtGlobalShortcut *shortcut = m_shortcuts[i];
if (shortcut->setShortcut(action->shortcut()))
qDebug() << "Global shortcut updated: " << action->shortcut() << ":"
<< action->objectName();
}
}
示例3: createContextMenuQStudyTreeWidget
void QInputOutputDicomdirWidget::createContextMenuQStudyTreeWidget()
{
QAction *action;
action = m_contextMenuQStudyTreeWidget.addAction(QIcon(":/images/view.png"), tr("&View"), this, SLOT(view()));
action->setShortcuts(ShortcutManager::getShortcuts(Shortcuts::ViewSelectedStudies));
(void) new QShortcut(action->shortcut(), this, SLOT(view()));
action = m_contextMenuQStudyTreeWidget.addAction(QIcon(":/images/retrieve.png"), tr("&Import"), this, SLOT(retrieveSelectedStudies()));
action->setShortcuts(ShortcutManager::getShortcuts(Shortcuts::ImportToLocalDatabaseSelectedDICOMDIRStudies));
(void) new QShortcut(action->shortcut(), this, SLOT(retrieveSelectedStudies()));
// Especifiquem que es el menu del dicomdir
m_studyTreeWidget->setContextMenu(& m_contextMenuQStudyTreeWidget);
}
示例4: setupShortcuts
void PropertiesDialog::setupShortcuts()
{
QList< QString > shortcutKeys = Properties::Instance()->actions.keys();
int shortcutCount = shortcutKeys.count();
shortcutsWidget->setRowCount( shortcutCount );
for( int x=0; x < shortcutCount; x++ )
{
QString keyValue = shortcutKeys.at(x);
QAction *keyAction = Properties::Instance()->actions[keyValue];
QTableWidgetItem *itemName = new QTableWidgetItem( tr(keyValue.toStdString().c_str()) );
QTableWidgetItem *itemShortcut = new QTableWidgetItem( keyAction->shortcut().toString() );
itemName->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
shortcutsWidget->setItem(x, 0, itemName);
shortcutsWidget->setItem(x, 1, itemShortcut);
}
shortcutsWidget->resizeColumnsToContents();
/*
connect(shortcutsWidget, SIGNAL(currentChanged(int, int)),
this, SLOT(recordAction(int, int)));
connect(shortcutsWidget, SIGNAL(valueChanged(int, int)),
this, SLOT(validateAction(int, int)));
*/
}
示例5: actionText
/*! \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);
}
示例6: 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;
}
示例7: loadFromConfig
void ActionsEditor::loadFromConfig(QObject *o, QSettings *set) {
qDebug("ActionsEditor::loadFromConfig");
set->beginGroup("actions");
QAction *action;
QString accelText;
QList<QAction *> actions = o->findChildren<QAction *>();
for (int n=0; n < actions.count(); n++) {
action = static_cast<QAction*> (actions[n]);
if (!action->objectName().isEmpty() && !action->inherits("QWidgetAction")) {
#if USE_MULTIPLE_SHORTCUTS
QString current = shortcutsToString(action->shortcuts());
accelText = set->value(action->objectName(), current).toString();
action->setShortcuts( stringToShortcuts( accelText ) );
#else
accelText = set->value(action->objectName(), action->shortcut().toString()).toString();
action->setShortcut(QKeySequence(accelText));
#endif
}
}
set->endGroup();
}
示例8: 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() );
}
示例9: 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();
}
示例10: 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()));
}
}
}
示例11: createContextMenuQStudyTreeWidget
void QInputOutputPacsWidget::createContextMenuQStudyTreeWidget()
{
QAction *action;
action = m_contextMenuQStudyTreeWidget.addAction(QIcon(":/images/retrieveAndView.png"), tr("Retrieve && &View"), this,
SLOT(retrieveAndViewSelectedItemsFromQStudyTreeWidget()));
action->setShortcuts(ShortcutManager::getShortcuts(Shortcuts::RetrieveAndViewSelectedStudies));
(void) new QShortcut(action->shortcut(), this, SLOT(retrieveAndViewSelectedItemsFromQStudyTreeWidget()));
action = m_contextMenuQStudyTreeWidget.addAction(QIcon(":/images/retrieve.png"), tr("&Retrieve"), this, SLOT(retrieveSelectedItemsFromQStudyTreeWidget()));
action->setShortcuts(ShortcutManager::getShortcuts(Shortcuts::RetrieveSelectedStudies));
(void) new QShortcut(action->shortcut(), this, SLOT(retrieveSelectedItemsFromQStudyTreeWidget()));
// Especifiquem que es el menu del dicomdir
m_studyTreeWidget->setContextMenu(& m_contextMenuQStudyTreeWidget);
}
示例12: shortcut
QKeySequence QActionProto::shortcut() const
{
QAction *item = qscriptvalue_cast<QAction*>(thisObject());
if (item)
return item->shortcut();
return QKeySequence();
}
示例13: eventFilter
bool SearchBar::eventFilter(QObject* object, QEvent* e)
{
QFocusEvent* focusEvent = 0;
// HACK This event comes from the ViewContainer when
// updateViewActions is called. ViewContainer can't
// check the status of the search box, and so tramples
// on the QAction we're managing - that is until the
// ambiguous shortcut dialog box pops up, at which point
// a focus event is sent to the searchbar and the other
// stanza in this method is triggered.
// 414 was the time of day when I named the event.
bool hack = (object == parent() && e->type() == QEvent::User+414);
if (hack && hasFocus())
focusEvent = new QFocusEvent(QEvent::FocusIn);
else
focusEvent = dynamic_cast<QFocusEvent*>(e);
if (focusEvent)
{
Application* konvApp = Application::instance();
QAction * action = static_cast<QAction*>(konvApp->getMainWindow()->actionCollection()->action("focus_input_box"));
if (action->shortcut().matches(QKeySequence(Qt::Key_Escape)))
{
action->setEnabled(focusEvent->lostFocus());
m_closeShortcut->setEnabled(focusEvent->gotFocus());
}
}
if (hack)
delete focusEvent;
return hack;
}
示例14: updateToggleRunningAction
void ScProcess::updateToggleRunningAction()
{
QAction *targetAction = state() == QProcess::NotRunning ? mActions[Start] : mActions[Stop];
mActions[ToggleRunning]->setText( targetAction->text() );
mActions[ToggleRunning]->setIcon( targetAction->icon() );
mActions[ToggleRunning]->setShortcut( targetAction->shortcut() );
}
示例15: updateText
void updateText()
{
QString text = m_action->text();
text.remove("&");
QString shortcut = m_action->shortcut().toString();
if (shortcut != "")
text += " (" + shortcut + ")";
setText(0, text);
}