本文整理汇总了C++中setShortcut函数的典型用法代码示例。如果您正苦于以下问题:C++ setShortcut函数的具体用法?C++ setShortcut怎么用?C++ setShortcut使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setShortcut函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OpsManager_
OperationsTab::OperationsTab (const TabClassInfo& tc, QObject *plugin)
: OpsManager_ (Core::Instance ().GetOpsManager ())
, TC_ (tc)
, ParentPlugin_ (plugin)
, Toolbar_ (new QToolBar (tr ("Poleemery")))
{
Ui_.setupUi (this);
Ui_.OpsView_->setItemDelegate (new EntriesDelegate);
Ui_.OpsView_->setModel (OpsManager_->GetModel ());
const auto& fm = fontMetrics ();
auto setColWidth = [&fm, this] (EntriesModel::Columns col, const QString& str)
{ Ui_.OpsView_->setColumnWidth (col, fm.width (str) * 1.1); };
setColWidth (EntriesModel::Columns::Date,
QDateTime::currentDateTime ().toString ());
setColWidth (EntriesModel::Columns::Account, "some account name");
setColWidth (EntriesModel::Columns::Name, "some typical very long product name");
setColWidth (EntriesModel::Columns::Price, " 9999.00 USD ");
setColWidth (EntriesModel::Columns::Count, " 0.999 ");
setColWidth (EntriesModel::Columns::Shop, "some typical shop name");
setColWidth (EntriesModel::Columns::AccBalance, " 99999.00 USD ");
setColWidth (EntriesModel::Columns::SumBalance, " 99999.00 USD ");
auto addAction = Toolbar_->addAction (tr ("Add..."),
this, SLOT (add ()));
addAction->setShortcut (Qt::Key_Insert);
addAction->setProperty ("ActionIcon", "list-add");
auto removeAction = Toolbar_->addAction (tr ("Remove"),
this, SLOT (remove ()));
removeAction->setShortcut (Qt::Key_Delete);
removeAction->setProperty ("ActionIcon", "list-remove");
}
示例2: pageAction
void SimplePartWidget::buildContextMenu(const QPoint &point, QMenu &menu) const
{
menu.addAction(m_findAction);
auto a = pageAction(QWebPage::Copy);
a->setIcon(UiUtils::loadIcon(QStringLiteral("edit-copy")));
menu.addAction(a);
a = pageAction(QWebPage::SelectAll);
a->setIcon(UiUtils::loadIcon(QStringLiteral("edit-select-all")));
menu.addAction(a);
if (!page()->mainFrame()->hitTestContent(point).linkUrl().isEmpty()) {
menu.addSeparator();
a = pageAction(QWebPage::CopyLinkToClipboard);
a->setIcon(UiUtils::loadIcon(QStringLiteral("edit-copy")));
menu.addAction(a);
}
menu.addSeparator();
menu.addAction(m_savePart);
menu.addAction(m_saveMessage);
if (!page()->mainFrame()->hitTestContent(point).imageUrl().isEmpty()) {
a = pageAction(QWebPage::DownloadImageToDisk);
a->setIcon(UiUtils::loadIcon(QStringLiteral("download")));
menu.addAction(a);
}
menu.addSeparator();
QMenu *colorSchemeMenu = menu.addMenu(UiUtils::loadIcon(QStringLiteral("colorneg")), tr("Color scheme"));
QActionGroup *ag = new QActionGroup(colorSchemeMenu);
for (auto item: supportedColorSchemes()) {
QAction *a = colorSchemeMenu->addAction(item.second);
connect(a, &QAction::triggered, this, [this, item](){
const_cast<SimplePartWidget*>(this)->setColorScheme(item.first);
});
a->setCheckable(true);
if (item.first == m_colorScheme) {
a->setChecked(true);
}
a->setActionGroup(ag);
}
auto zoomMenu = menu.addMenu(UiUtils::loadIcon(QStringLiteral("zoom")), tr("Zoom"));
if (m_messageView) {
zoomMenu->addAction(m_messageView->m_zoomIn);
zoomMenu->addAction(m_messageView->m_zoomOut);
zoomMenu->addAction(m_messageView->m_zoomOriginal);
} else {
auto zoomIn = zoomMenu->addAction(UiUtils::loadIcon(QStringLiteral("zoom-in")), tr("Zoom In"));
zoomIn->setShortcut(QKeySequence::ZoomIn);
connect(zoomIn, &QAction::triggered, this, &SimplePartWidget::zoomIn);
auto zoomOut = zoomMenu->addAction(UiUtils::loadIcon(QStringLiteral("zoom-out")), tr("Zoom Out"));
zoomOut->setShortcut(QKeySequence::ZoomOut);
connect(zoomOut, &QAction::triggered, this, &SimplePartWidget::zoomOut);
auto zoomOriginal = zoomMenu->addAction(UiUtils::loadIcon(QStringLiteral("zoom-original")), tr("Original Size"));
connect(zoomOriginal, &QAction::triggered, this, &SimplePartWidget::zoomOriginal);
}
}
示例3: setShortcut
//-----------------------------------------------------------------------------
void UndoRedoGuiCommand::init ()
{
setShortcut (UNDO_, QKeySequence::Undo);
setShortcut (REDO_, QKeySequence::Redo);
setIcon (UNDO_, QIcon (":/images/ic_undo_black_24dp.png"));
setIcon (REDO_, QIcon (":/images/ic_redo_black_24dp.png"));
resetActionTriggerSlot (UNDO_, SLOT(undo()));
resetActionTriggerSlot (REDO_, SLOT(redo()));
}
示例4: setShortcut
void ShortcutManager::loadSettings()
{
_shortcutSettings->beginGroup(QStringLiteral("LocalShortcuts"));
setShortcut(_shortcutSettings->value(KEY_SHORTCUT_NEW, DEF_SHORTCUT_NEW).toString(),
Config::shortcutNew, Config::localShortcut);
setShortcut(_shortcutSettings->value(KEY_SHORTCUT_SAVE, DEF_SHORTCUT_SAVE).toString(),
Config::shortcutSave, Config::localShortcut);
setShortcut(_shortcutSettings->value(KEY_SHORTCUT_COPY, DEF_SHORTCUT_COPY).toString(),
Config::shortcutCopy, Config::localShortcut);
setShortcut(_shortcutSettings->value(KEY_SHORTCUT_OPT, DEF_SHORTCUT_OPT).toString(),
Config::shortcutOptions, Config::localShortcut);
setShortcut(_shortcutSettings->value(KEY_SHORTCUT_HELP, DEF_SHORTCUT_HELP).toString(),
Config::shortcutHelp, Config::localShortcut);
setShortcut(_shortcutSettings->value(KEY_SHORTCUT_CLOSE, DEF_SHORTCUT_CLOSE).toString(),
Config::shortcutClose, Config::localShortcut);
_shortcutSettings->endGroup();
_shortcutSettings->beginGroup(QStringLiteral("GlobalShortcuts"));
setShortcut(_shortcutSettings->value(KEY_SHORTCUT_FULL, DEF_SHORTCUT_FULL).toString(),
Config::shortcutFullScreen, Config::globalShortcut);
setShortcut(_shortcutSettings->value(KEY_SHORTCUT_ACTW, DEF_SHORTCUT_ACTW).toString(),
Config::shortcutActiveWnd, Config::globalShortcut);
setShortcut(_shortcutSettings->value(KEY_SHORTCUT_AREA, DEF_SHORTCUT_AREA).toString(),
Config::shortcutAreaSelect, Config::globalShortcut);
_shortcutSettings->endGroup();
}
示例5: UIActionSimpleNetworkAccessManager
UIActionSimpleNetworkAccessManager(QObject *pParent)
: UIActionSimple(pParent, ":/nw_16px.png", ":/nw_disabled_16px.png")
{
switch (gActionPool->type())
{
case UIActionPoolType_Selector:
setShortcut(gSS->keySequence(UISelectorShortcuts::NetworkAccessManager));
break;
case UIActionPoolType_Runtime:
setShortcut(gMS->keySequence(UIMachineShortcuts::NetworkAccessManager));
break;
}
retranslateUi();
}
示例6: UIActionSimpleContents
UIActionSimpleContents(QObject *pParent)
: UIActionSimple(pParent, UIIconPool::defaultIcon(UIIconPool::DialogHelpIcon))
{
switch (gActionPool->type())
{
case UIActionPoolType_Selector:
setShortcut(gSS->keySequence(UISelectorShortcuts::HelpShortcut));
break;
case UIActionPoolType_Runtime:
setShortcut(gMS->keySequence(UIMachineShortcuts::HelpShortcut));
break;
}
retranslateUi();
}
示例7: ShowWebAction
ShowWebAction(QObject *pParent)
: UISimpleAction(pParent, ":/site_16px.png")
{
switch (gActionPool->type())
{
case UIActionPoolType_Offline:
setShortcut(gSS->keySequence(UISelectorShortcuts::WebShortcut));
break;
case UIActionPoolType_Runtime:
setShortcut(gMS->keySequence(UIMachineShortcuts::WebShortcut));
break;
}
retranslateUi();
}
示例8: UIActionSimpleResetWarnings
UIActionSimpleResetWarnings(QObject *pParent)
: UIActionSimple(pParent, ":/reset_16px.png")
{
switch (gActionPool->type())
{
case UIActionPoolType_Selector:
setShortcut(gSS->keySequence(UISelectorShortcuts::ResetWarningsShortcut));
break;
case UIActionPoolType_Runtime:
setShortcut(gMS->keySequence(UIMachineShortcuts::ResetWarningsShortcut));
break;
}
retranslateUi();
}
示例9: UIActionSimpleCheckForUpdates
UIActionSimpleCheckForUpdates(QObject *pParent)
: UIActionSimple(pParent, ":/refresh_16px.png", ":/refresh_disabled_16px.png")
{
setMenuRole(QAction::ApplicationSpecificRole);
switch (gActionPool->type())
{
case UIActionPoolType_Selector:
setShortcut(gSS->keySequence(UISelectorShortcuts::UpdateShortcut));
break;
case UIActionPoolType_Runtime:
setShortcut(gMS->keySequence(UIMachineShortcuts::UpdateShortcut));
break;
}
retranslateUi();
}
示例10: UIActionSimpleAbout
UIActionSimpleAbout(QObject *pParent)
: UIActionSimple(pParent, ":/about_16px.png")
{
setMenuRole(QAction::AboutRole);
switch (gActionPool->type())
{
case UIActionPoolType_Selector:
setShortcut(gSS->keySequence(UISelectorShortcuts::AboutShortcut));
break;
case UIActionPoolType_Runtime:
setShortcut(gMS->keySequence(UIMachineShortcuts::AboutShortcut));
break;
}
retranslateUi();
}
示例11: QAbstractButton
QVistaBackButton::QVistaBackButton(QWidget *widget)
: QAbstractButton(widget)
{
setFocusPolicy(Qt::NoFocus);
// Native dialogs use ALT-Left even in RTL mode, so do the same, even if it might be counter-intuitive.
setShortcut(QKeySequence(Qt::ALT | Qt::Key_Left));
}
示例12: qWarning
void Plugin::handleUnclose ()
{
auto action = qobject_cast<QAction*> (sender ());
if (!action)
{
qWarning () << Q_FUNC_INFO
<< "sender is not an action:"
<< sender ();
return;
}
if (!UncloseAct2Data_.contains (action))
return;
action->deleteLater ();
auto data = UncloseAct2Data_.take (action);
if (UncloseMenu_->defaultAction () == action)
{
auto nextAct = UncloseMenu_->actions ().value (1);
if (nextAct)
{
UncloseMenu_->setDefaultAction (nextAct);
nextAct->setShortcut (QString ("Ctrl+Shift+T"));
}
}
UncloseMenu_->removeAction (action);
data.Plugin_->RecoverTabs (QList<TabRecoverInfo> () << data.RecInfo_);
}
示例13: QAction
ContextMenuAction::ContextMenuAction(const QString &label, const QString &id, const QKeySequence &shortcut,
QObject *parent)
: QAction(label, parent),
m_id(id)
{
setShortcut(shortcut);
}
示例14: VcsDiffWidget
void VcsEventWidgetPrivate::diffRevisions()
{
QModelIndexList l = m_ui->eventView->selectionModel()->selectedRows();
KDevelop::VcsEvent ev1 = m_logModel->eventForIndex( l.first() );
KDevelop::VcsEvent ev2 = m_logModel->eventForIndex( l.last() );
KDevelop::VcsJob* job = m_iface->diff( m_url, ev1.revision(), ev2.revision() );
VcsDiffWidget* widget = new VcsDiffWidget( job );
widget->setRevisions( ev1.revision(), ev2.revision() );
auto dlg = new QDialog( q );
dlg->setWindowTitle( i18n("Difference between Revisions") );
widget->connect(widget, &VcsDiffWidget::destroyed, dlg, &QDialog::deleteLater);
auto mainLayout = new QVBoxLayout(dlg);
auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok);
auto okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
dlg->connect(buttonBox, &QDialogButtonBox::accepted, dlg, &QDialog::accept);
dlg->connect(buttonBox, &QDialogButtonBox::rejected, dlg, &QDialog::reject);
mainLayout->addWidget(buttonBox);
mainLayout->addWidget(widget);
dlg->show();
}
示例15: QAction
QAction* MainWindow::createAction(QMenu* menu, const QKeySequence &shortcut)
{
auto action = new QAction(this);
menu->addAction(action);
action->setShortcut(shortcut);
return action;
}