本文整理汇总了C++中core::EditorManager::activateEditorForEntry方法的典型用法代码示例。如果您正苦于以下问题:C++ EditorManager::activateEditorForEntry方法的具体用法?C++ EditorManager::activateEditorForEntry怎么用?C++ EditorManager::activateEditorForEntry使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core::EditorManager
的用法示例。
在下文中一共展示了EditorManager::activateEditorForEntry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sp
TabBar::TabBar(QWidget *parent) :
QTabBar(parent)
{
setExpanding(false);
setMovable(true);
setTabsClosable(true);
setUsesScrollButtons(true);
QSizePolicy sp(QSizePolicy::Preferred, QSizePolicy::Fixed);
sp.setHorizontalStretch(1);
sp.setVerticalStretch(0);
sp.setHeightForWidth(sizePolicy().hasHeightForWidth());
setSizePolicy(sp);
connect(this, &QTabBar::tabMoved, [this](int from, int to) {
m_editors.move(from, to);
});
Core::EditorManager *em = Core::EditorManager::instance();
connect(em, &Core::EditorManager::editorOpened, this, &TabBar::addEditorTab);
connect(em, &Core::EditorManager::editorsClosed, this, &TabBar::removeEditorTabs);
connect(em, SIGNAL(currentEditorChanged(Core::IEditor*)), SLOT(selectEditorTab(Core::IEditor*)));
connect(this, &QTabBar::currentChanged, this, &TabBar::activateEditor);
connect(this, &QTabBar::tabCloseRequested, this, &TabBar::closeTab);
ProjectExplorer::SessionManager *sm = ProjectExplorer::SessionManager::instance();
connect(sm, &ProjectExplorer::SessionManager::sessionLoaded, [this, em]() {
foreach (Core::DocumentModel::Entry *entry, Core::DocumentModel::entries())
em->activateEditorForEntry(entry, Core::EditorManager::DoNotChangeCurrentEditor);
});
const QString shortCutSequence = QStringLiteral("Ctrl+Alt+%1");
for (int i = 1; i <= 10; ++i) {
QShortcut *shortcut = new QShortcut(shortCutSequence.arg(i % 10), this);
connect(shortcut, &QShortcut::activated, [this, shortcut]() {
setCurrentIndex(m_shortcuts.indexOf(shortcut));
});
m_shortcuts.append(shortcut);
}
QAction *prevTabAction = new QAction(tr("Switch to previous tab"), this);
Core::Command *prevTabCommand
= Core::ActionManager::registerAction(prevTabAction,
TabbedEditor::Constants::PREV_TAB_ID,
Core::Context(Core::Constants::C_GLOBAL));
prevTabCommand->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+J")));
connect(prevTabAction, SIGNAL(triggered()), this, SLOT(prevTabAction()));
QAction *nextTabAction = new QAction(tr("Switch to next tab"), this);
Core::Command *nextTabCommand
= Core::ActionManager::registerAction(nextTabAction,
TabbedEditor::Constants::NEXT_TAB_ID,
Core::Context(Core::Constants::C_GLOBAL));
nextTabCommand->setDefaultKeySequence(QKeySequence(tr("Ctrl+Shift+K")));
connect(nextTabAction, SIGNAL(triggered()), this, SLOT(nextTabAction()));
}