本文整理汇总了C++中ktexteditor::View::show方法的典型用法代码示例。如果您正苦于以下问题:C++ View::show方法的具体用法?C++ View::show怎么用?C++ View::show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ktexteditor::View
的用法示例。
在下文中一共展示了View::show方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showView
bool KateViewSpace::showView(KTextEditor::Document *document)
{
const int index = m_lruDocList.lastIndexOf(document);
if (index < 0) {
return false;
}
if (! m_docToView.contains(document)) {
return false;
}
KTextEditor::View *kv = m_docToView[document];
// move view to end of list
m_lruDocList.removeAt(index);
m_lruDocList.append(document);
stack->setCurrentWidget(kv);
kv->show();
// in case a tab does not exist, add one
if (! m_docToTabId.contains(document)) {
// if space is available, add button
if (m_tabBar->count() < m_tabBar->maxTabCount()) {
// just insert
insertTab(m_tabBar->count(), document);
} else {
// remove "oldest" button and replace with new one
Q_ASSERT(m_lruDocList.size() > m_tabBar->count());
// we need to subtract by 1 more, as we just added ourself to the end of the lru list!
KTextEditor::Document * docToHide = m_lruDocList[m_lruDocList.size() - m_tabBar->maxTabCount() - 1];
Q_ASSERT(m_docToTabId.contains(docToHide));
const int insertIndex = removeTab(docToHide, false);
// add new one at removed position
insertTab(insertIndex, document);
}
}
// follow current view
Q_ASSERT(m_docToTabId.contains(document));
m_tabBar->setCurrentTab(m_docToTabId.value(document, -1));
return true;
}