MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / SetView

Method SetView

App/Client/mainwindow.cpp:573–628  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

571}
572
573void MainWindow::SetView(CView* pView)
574{
575 qDebug(log) << Q_FUNC_INFO;
576 if(!pView)
577 return;
578 if(m_pView)
579 m_pView->disconnect();
580
581 m_pView = pView;
582 auto* pContain = centralWidget();
583 if(!pContain) return;
584 auto* pOldLayout = pContain->layout();
585 if(pOldLayout) {
586 pContain->setLayout(nullptr);
587 // Remove all child controls from the layout
588 QLayoutItem* item;
589 while ((item = pOldLayout->takeAt(0)) != nullptr) {
590 if (item->widget()) {
591 item->widget()->deleteLater();
592 }
593 delete item;
594 }
595 delete pOldLayout;
596 }
597 auto* pLayout = new QVBoxLayout(pContain);
598 if(pLayout) {
599 pLayout->setContentsMargins(0, 0, 0, 0);
600 pLayout->setSpacing(0);
601 pContain->setLayout(pLayout);
602 pLayout->addWidget(m_pView);
603 }
604
605 bool check = false;
606 //m_pView->setFocusPolicy(Qt::NoFocus);
607 check = connect(m_pView, SIGNAL(sigCloseView(const QWidget*)),
608 this, SLOT(slotCloseView(const QWidget*)));
609 Q_ASSERT(check);
610 check = connect(m_pView, SIGNAL(sigCurrentChanged(const QWidget*)),
611 this, SLOT(slotCurrentViewChanged(const QWidget*)));
612 Q_ASSERT(check);
613 if(m_pFrmActive) {
614 check = connect(m_pView, SIGNAL(sigCurrentChanged(const QWidget*)),
615 m_pFrmActive, SLOT(slotViewChanged(const QWidget*)));
616 Q_ASSERT(check);
617 }
618 check = connect(m_pView, SIGNAL(customContextMenuRequested(const QPoint&)),
619 this, SLOT(slotCustomContextMenuRequested(const QPoint&)));
620 Q_ASSERT(check);
621
622 foreach (auto c, m_Operates) {
623 m_pView->AddView(c->GetViewer());
624 m_pView->SetWidowsTitle(
625 c->GetViewer(), c->Name(), c->Icon(), c->Description());
626 }
627 m_pView->SetVisibleTab(m_Parameter.GetTabBar());
628}
629
630void MainWindow::on_actionViewTab_triggered()

Callers

nothing calls this directly

Calls 2

GetTabBarMethod · 0.80
SetVisibleTabMethod · 0.45

Tested by

no test coverage detected