本文整理汇总了C++中ktexteditor::Document::views方法的典型用法代码示例。如果您正苦于以下问题:C++ Document::views方法的具体用法?C++ Document::views怎么用?C++ Document::views使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ktexteditor::Document
的用法示例。
在下文中一共展示了Document::views方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testKateDocumentAndViewCreation
void TestShellDocumentOperation::testKateDocumentAndViewCreation()
{
//create one document
IDocumentController *documentController = Core::self()->documentController();
documentController->openDocumentFromText(QLatin1String(""));
QCOMPARE(documentController->openDocuments().count(), 1);
//assure we have only one kate view for the newly created document
KTextEditor::Document *doc = documentController->openDocuments().at(0)->textDocument();
QCOMPARE(doc->views().count(), 1);
QCOMPARE(dynamic_cast<KTextEditor::MovingInterface*>(doc)->revision(), qint64(0));
//also assure the view's xmlgui is plugged in
KParts::MainWindow *main = Core::self()->uiControllerInternal()->activeMainWindow();
QVERIFY(main);
QVERIFY(main->guiFactory()->clients().contains(doc->views().at(0)));
//KTextEditor::views is internally a QHash::keys() call: so the order of the views will vary
const auto originalView = doc->views().at(0);
//create the new view and activate it (using split action from mainwindow)
QAction *splitAction = main->actionCollection()->action(QStringLiteral("split_vertical"));
QVERIFY(splitAction);
splitAction->trigger();
const auto viewList = doc->views();
QCOMPARE(viewList.count(), 2);
const auto newlySplitView = originalView == viewList[0] ? viewList[1] : viewList[0];
//check that we did switch to the new xmlguiclient
QVERIFY(!main->guiFactory()->clients().contains(originalView));
QVERIFY(main->guiFactory()->clients().contains(newlySplitView));
documentController->openDocuments().at(0)->close(IDocument::Discard);
}
示例2: sync
void Konsole::sync()
{
if(!KileConfig::syncConsoleDirWithTabs()) {
return;
}
KTextEditor::Document *doc = m_ki->activeTextDocument();
KTextEditor::View *view = Q_NULLPTR;
if(doc) {
view = doc->views().first();
}
if(view) {
QString finame;
QUrl url = view->document()->url();
if(url.path().isEmpty()) {
return;
}
QFileInfo fic(url.adjusted(QUrl::RemoveFilename|QUrl::StripTrailingSlash).path());
if(fic.isReadable()) {
setDirectory(url.adjusted(QUrl::RemoveFilename|QUrl::StripTrailingSlash).path());
}
}
}
示例3: guiFactory
KWrite::~KWrite()
{
guiFactory()->removeClient(m_view);
winList.removeAll(this);
KTextEditor::Document *doc = m_view->document();
delete m_view;
// kill document, if last view is closed
if (doc->views().isEmpty()) {
docList.removeAll(doc);
delete doc;
}
KSharedConfig::openConfig()->sync();
}