本文整理汇总了C++中core::Command::keySequence方法的典型用法代码示例。如果您正苦于以下问题:C++ Command::keySequence方法的具体用法?C++ Command::keySequence怎么用?C++ Command::keySequence使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core::Command
的用法示例。
在下文中一共展示了Command::keySequence方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showMarker
void FunctionDeclDefLink::showMarker(CppEditorWidget *editor)
{
if (hasMarker)
return;
QList<RefactorMarker> markers = RefactorMarker::filterOutType(
editor->refactorMarkers(), CppTools::Constants::CPP_FUNCTION_DECL_DEF_LINK_MARKER_ID);
RefactorMarker marker;
// show the marker at the end of the linked area, with a special case
// to avoid it overlapping with a trailing semicolon
marker.cursor = editor->textCursor();
marker.cursor.setPosition(linkSelection.selectionEnd());
const int endBlockNr = marker.cursor.blockNumber();
marker.cursor.setPosition(linkSelection.selectionEnd() + 1, QTextCursor::KeepAnchor);
if (marker.cursor.blockNumber() != endBlockNr
|| marker.cursor.selectedText() != QLatin1String(";")) {
marker.cursor.setPosition(linkSelection.selectionEnd());
}
QString message;
if (targetDeclaration->asFunctionDefinition())
message = tr("Apply changes to definition");
else
message = tr("Apply changes to declaration");
Core::Command *quickfixCommand = Core::ActionManager::command(TextEditor::Constants::QUICKFIX_THIS);
if (quickfixCommand)
message = ProxyAction::stringWithAppendedShortcut(message, quickfixCommand->keySequence());
marker.tooltip = message;
marker.type = CppTools::Constants::CPP_FUNCTION_DECL_DEF_LINK_MARKER_ID;
marker.callback = [](TextEditor::TextEditorWidget *widget) {
if (auto cppEditor = qobject_cast<CppEditorWidget *>(widget))
cppEditor->applyDeclDefLinkChanges(true);
};
markers += marker;
editor->setRefactorMarkers(markers);
hasMarker = true;
}
示例2: showMarker
void FunctionDeclDefLink::showMarker(CPPEditorWidget *editor)
{
if (hasMarker)
return;
QList<TextEditor::RefactorMarker> markers = removeMarkersOfType<Marker>(editor->refactorMarkers());
TextEditor::RefactorMarker marker;
// show the marker at the end of the linked area, with a special case
// to avoid it overlapping with a trailing semicolon
marker.cursor = editor->textCursor();
marker.cursor.setPosition(linkSelection.selectionEnd());
const int endBlockNr = marker.cursor.blockNumber();
marker.cursor.setPosition(linkSelection.selectionEnd() + 1, QTextCursor::KeepAnchor);
if (marker.cursor.blockNumber() != endBlockNr
|| marker.cursor.selectedText() != QLatin1String(";")) {
marker.cursor.setPosition(linkSelection.selectionEnd());
}
QString message;
if (targetDeclaration->asFunctionDefinition())
message = tr("Apply changes to definition");
else
message = tr("Apply changes to declaration");
Core::ActionManager *actionManager = Core::ICore::actionManager();
Core::Command *quickfixCommand = actionManager->command(TextEditor::Constants::QUICKFIX_THIS);
if (quickfixCommand)
message = Utils::ProxyAction::stringWithAppendedShortcut(message, quickfixCommand->keySequence());
marker.tooltip = message;
marker.data = QVariant::fromValue(Marker());
markers += marker;
editor->setRefactorMarkers(markers);
hasMarker = true;
}