本文整理汇总了C++中shortcut函数的典型用法代码示例。如果您正苦于以下问题:C++ shortcut函数的具体用法?C++ shortcut怎么用?C++ shortcut使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shortcut函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setStartPosition
void PathInfo::Build()
{
float x, y, z;
// set start and a default next position
m_sourceObject->GetPosition(x, y, z);
setStartPosition(x, y, z);
setNextPosition(x, y, z);
// get nav mesh
m_navMesh = m_sourceObject->GetMap()->GetNavMesh();
if(!m_navMesh)
{
// if there is no navmesh, just move to destination
shortcut();
return;
}
float extents[3] = {2.0f, 4.0f, 2.0f}; // defines bounds of box for search area
dtQueryFilter filter = dtQueryFilter(); // use general filter so we know if we are near navmesh
// get start and end positions
getStartPosition(x, y, z);
float startPos[3] = {y, z, x};
getEndPosition(x, y, z);
float endPos[3] = {y, z, x};
// find start and end poly
dtPolyRef startPoly = m_navMesh->findNearestPoly(startPos, extents, &filter, 0);
dtPolyRef endPoly = m_navMesh->findNearestPoly(endPos, extents, &filter, 0);
Build(startPoly, endPoly);
}
示例2: pgassert
void
Pgr_linear<G>::add_shortcut(
G &graph, V vertex,
E incoming_edge,
E outgoing_edge) {
pgassert(incoming_edge != outgoing_edge);
auto a = graph.adjacent(vertex, incoming_edge);
auto c = graph.adjacent(vertex, outgoing_edge);
pgassert(a != vertex);
pgassert(a != c);
pgassert(vertex != c);
if (graph.is_undirected()) {
Identifiers<V> adjacent_vertices = graph.find_adjacent_vertices(vertex);
V vertex_1 = adjacent_vertices.front();
adjacent_vertices.pop_front();
V vertex_2 = adjacent_vertices.front();
adjacent_vertices.pop_front();
E shortcut_E;
CH_edge shortcut(get_next_id(), graph[vertex_1].id,
graph[vertex_2].id,
graph[incoming_edge].cost + graph[outgoing_edge].cost);
shortcut.add_contracted_vertex(graph[vertex], vertex);
shortcut.add_contracted_edge_vertices(graph[incoming_edge]);
shortcut.add_contracted_edge_vertices(graph[outgoing_edge]);
debug << "Adding shortcut\n";
debug << shortcut;
graph.add_shortcut(shortcut);
debug << "Added shortcut\n";
} else {
CH_edge shortcut(
get_next_id(),
graph[a].id,
graph[c].id,
graph[incoming_edge].cost + graph[outgoing_edge].cost);
shortcut.add_contracted_vertex(graph[vertex], vertex);
shortcut.add_contracted_edge_vertices(graph[incoming_edge]);
shortcut.add_contracted_edge_vertices(graph[outgoing_edge]);
debug << "Adding shortcut\n";
debug << shortcut;
graph.add_shortcut(shortcut);
debug << "Added shortcut\n";
}
}
示例3: handle_key
bool Shortcut_trigger::handle_key(const KShortcut &shortcut_P)
{
if(shortcut() == shortcut_P)
{
windows_handler->set_action_window(0); // use active window
data->execute();
return true;
}
return false;
}
示例4: bootUpSettings
void ValueSetters::RunOnBootValueSetter(QString group, QString name, QVariant value)
{
bool runOnBoot = value.toBool();
#ifdef Q_WS_WIN
QSettings bootUpSettings(QString("HKEY_LOCAL_MACHINE\\SOFTWARE\\") + (StaticHelpers::IsWow64() ? "Wow6432Node\\" : "") + "Microsoft\\Windows\\CurrentVersion\\Run", QSettings::NativeFormat);
QString applicationFilePath = QDir::toNativeSeparators(QFileInfo(QApplication::applicationFilePath()).absoluteFilePath());
if (runOnBoot)
{
bootUpSettings.setValue("CuteTorrent", "\"" + applicationFilePath + "\"");
}
else
{
bootUpSettings.remove("CuteTorrent");
}
#elif Q_WS_X11
if (runOnBoot)
{
if (!QFile::exists(StaticHelpers::CombinePathes(QDir::homePath(), ".config/autostart/CuteTorrent.desktop")))
{
QFile shortcut("/usr/share/applications/CuteTorrent.desktop");
if (!shortcut.copy(StaticHelpers::CombinePathes(QDir::homePath(), ".config/autostart/CuteTorrent.desktop")))
{
qCritical() << "Unable to copy /usr/share/applications/CuteTorrent.desktop to ~/.config/autostart/CuteTorrent.desktop" << shortcut.errorString();
}
}
}
else
{
QFile shortcut(StaticHelpers::CombinePathes(QDir::homePath(), ".config/autostart/CuteTorrent.desktop"));
if (shortcut.exists())
{
if (!shortcut.remove())
{
qCritical() << "failed to remove ~/.config/autostart/CuteTorrent.desktop" << shortcut.errorString();
}
}
}
#endif
}
示例5: shortcut
void QQuickMenuItem::updateShortcut()
{
if (platformItem()) {
QKeySequence sequence;
QVariant var = shortcut();
if (var.type() == QVariant::Int)
sequence = QKeySequence(static_cast<QKeySequence::StandardKey>(var.toInt()));
else
sequence = QKeySequence::fromString(var.toString(), QKeySequence::NativeText);
platformItem()->setShortcut(sequence);
syncWithPlatformMenu();
}
emit shortcutChanged();
}
示例6: retranslateUi
void retranslateUi()
{
switch (m_iState)
{
case 0:
{
setName(QApplication::translate("UIActionPool", "S&tart"));
setStatusTip(QApplication::translate("UIActionPool", "Start the selected virtual machines"));
setToolTip(text().remove('&').remove('.') +
(shortcut().toString().isEmpty() ? "" : QString(" (%1)").arg(shortcut().toString())));
break;
}
case 1:
{
setName(QApplication::translate("UIActionPool", "S&how"));
setStatusTip(QApplication::translate("UIActionPool", "Switch to the windows of the selected virtual machines"));
setToolTip(text().remove('&').remove('.') +
(shortcut().toString().isEmpty() ? "" : QString(" (%1)").arg(shortcut().toString())));
break;
}
default:
break;
}
}
示例7: shortcut
void ShortcutDialog::accept()
{
QKeySequence seq = shortcut();
if (!seq.isEmpty()) {
if (seq[0] == Qt::Key_Escape) {
reject();
return;
}
if (seq[0] == Qt::Key_Space
|| (seq[0] & Qt::KeyboardModifierMask) == 0) {
// clear
widget->clearKeySequence();
KDialog::accept();
return;
}
}
KDialog::accept();
}
示例8: slotIdentitiesChanged
void KMFolder::readConfig( KConfigGroup & configGroup )
{
// KConfigGroup configGroup(config, "");
if ( !configGroup.readEntry( "SystemLabel" ).isEmpty() )
mSystemLabel = configGroup.readEntry( "SystemLabel" );
mExpireMessages = configGroup.readEntry( "ExpireMessages", false );
mReadExpireAge = configGroup.readEntry( "ReadExpireAge", 3 );
mReadExpireUnits = (ExpireUnits)configGroup.readEntry( "ReadExpireUnits", (int)expireMonths );
mUnreadExpireAge = configGroup.readEntry( "UnreadExpireAge", 12 );
mUnreadExpireUnits = (ExpireUnits)
configGroup.readEntry( "UnreadExpireUnits", (int)expireNever );
mExpireAction = configGroup.readEntry( "ExpireAction", "Delete") == "Move" ? ExpireMove : ExpireDelete;
mExpireToFolderId = configGroup.readEntry( "ExpireToFolder" );
mUseCustomIcons = configGroup.readEntry( "UseCustomIcons", false );
mNormalIconPath = configGroup.readEntry( "NormalIconPath" );
mUnreadIconPath = configGroup.readEntry( "UnreadIconPath" );
mMailingListEnabled = configGroup.readEntry( "MailingListEnabled", false );
mMailingList.readConfig( configGroup );
mUseDefaultIdentity = configGroup.readEntry( "UseDefaultIdentity", true );
uint defaultIdentity = kmkernel->identityManager()->defaultIdentity().uoid();
mIdentity = configGroup.readEntry("Identity", defaultIdentity );
slotIdentitiesChanged();
setUserWhoField( configGroup.readEntry( "WhoField" ), false );
uint savedId = configGroup.readEntry( "Id", 0 );
// make sure that we don't overwrite a valid id
if ( savedId != 0 && mId == 0 )
mId = savedId;
mPutRepliesInSameFolder = configGroup.readEntry( "PutRepliesInSameFolder", false );
mHideInSelectionDialog = configGroup.readEntry( "HideInSelectionDialog", false );
setIgnoreNewMail( configGroup.readEntry( "IgnoreNewMail", false ) );
if ( mUseCustomIcons )
emit iconsChanged();
QString shortcut( configGroup.readEntry( "Shortcut" ) );
if ( !shortcut.isEmpty() ) {
KShortcut sc( shortcut );
setShortcut( sc );
}
}
示例9: shortcut
void BtActionCollection::readSettings() {
QSettings* settings = CBTConfig::getConfig();
settings->beginGroup(m_groupName);
QStringList keyList = settings->childKeys();
for (int i = 0; i < keyList.size(); i++) {
QString key = keyList.at(i);
QVariant variant = settings->value(key);
QList<QKeySequence> shortcuts;
if ( variant != QVariant()) {
QList<QVariant> varShortcuts = variant.toList();
for (int i = 0; i < varShortcuts.count(); i++) {
QString keys = varShortcuts.at(i).toString();
QKeySequence shortcut(keys);
shortcuts.append(shortcut);
}
}
action(key)->setShortcuts(shortcuts);
}
settings->endGroup();
}
示例10: Get
bool MenuCommands::SetShortcuts(int ind, QString shorts)
{
QStringList list = shorts.split(QChar(' '));
QString key = Get(ind,Key);
int i = 0;
foreach(QString s, list)
{
if (!s.trimmed().isEmpty())
{
QKeySequence shortcut(s.trimmed());
if (shortcut.isEmpty())
return false;
m_data.setValue(key + QString("_%1").arg(++i), shortcut.toString() );
}
}
QString shortcut = m_data.value(key + QString("_%1").arg(++i) ).toString();
if (!shortcut.isEmpty())
m_data.setValue(key + QString("_%1").arg(i), "");
return true;
}
示例11: QKeySequence
void QQuickAction::setShortcut(const QVariant &arg)
{
QKeySequence sequence;
if (arg.type() == QVariant::Int)
sequence = QKeySequence(static_cast<QKeySequence::StandardKey>(arg.toInt()));
else
sequence = QKeySequence::fromString(arg.toString());
if (sequence == m_shortcut)
return;
if (!m_shortcut.isEmpty())
QGuiApplicationPrivate::instance()->shortcutMap.removeShortcut(0, this, m_shortcut);
m_shortcut = sequence;
if (!m_shortcut.isEmpty()) {
Qt::ShortcutContext context = Qt::WindowShortcut;
QGuiApplicationPrivate::instance()->shortcutMap.addShortcut(this, m_shortcut, context, qShortcutContextMatcher);
}
emit shortcutChanged(shortcut());
}
示例12: forward
const KShortcut& forward() { return shortcut( Forward ); }
示例13: back
const KShortcut& back() { return shortcut( Back ); }
示例14: up
const KShortcut& up() { return shortcut( Up ); }
示例15: selectAll
const KShortcut& selectAll() { return shortcut( SelectAll ); }