MCPcopy Create free account
hub / github.com/KDE/kdevelop / viewsInSameSplitView

Method viewsInSameSplitView

kdevplatform/shell/ktexteditorpluginintegration.cpp:616–651  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

614}
615
616bool MainWindow::viewsInSameSplitView(KTextEditor::View *kteView1, KTextEditor::View *kteView2) const
617{
618 if (!kteView1 || !kteView2) {
619 return false;
620 }
621 if (kteView1 == kteView2) {
622 return true;
623 }
624
625 bool view1Found = false;
626 bool view2Found = false;
627 const auto containers = m_mainWindow->containers();
628 for (const auto* container : containers) {
629 const auto views = container->views();
630 for (auto* view : views) {
631 const KTextEditor::View *kteView = toKteView(view);
632 if (kteView == kteView1) {
633 view1Found = true;
634 } else if (kteView == kteView2) {
635 view2Found = true;
636 }
637
638 if (view1Found && view2Found) {
639 // both views found in the same container
640 return true;
641 }
642 }
643
644 if (view1Found != view2Found) {
645 // only one view being found implies that the other is in a different container
646 return false;
647 }
648 }
649
650 return false;
651}
652
653QObject *MainWindow::pluginView(const QString &id) const
654{

Callers

nothing calls this directly

Calls 3

toKteViewFunction · 0.85
containersMethod · 0.80
viewsMethod · 0.45

Tested by

no test coverage detected