|
@@ -50,6 +50,11 @@ void StackedWidget::addWidget(QWidget *widget)
|
|
|
m_view->addWidget(widget);
|
|
|
}
|
|
|
|
|
|
+QWidget *StackedWidget::widget(int index) const
|
|
|
+{
|
|
|
+ return m_view->widget(index);
|
|
|
+}
|
|
|
+
|
|
|
void StackedWidget::removeWidget(QWidget *widget)
|
|
|
{
|
|
|
m_view->removeWidget(widget);
|
|
@@ -155,6 +160,7 @@ void MainWindow::initMainPage()
|
|
|
connect(m_naviInterface, &NavigationInterface::displayModeChanged, m_titleBar, &StandardTitleBar::raise);
|
|
|
connect(m_userView, &UserView::signalLogout, this, &MainWindow::slotLogout);
|
|
|
connect(m_homeView, &HomeView::sigOpenProject, this, &MainWindow::slotOpenProject);
|
|
|
+ connect(m_homeView, &HomeView::sigDeleteProject, this, &MainWindow::slotDeleteProject);
|
|
|
}
|
|
|
|
|
|
void MainWindow::initNavigation()
|
|
@@ -274,3 +280,15 @@ void MainWindow::slotCloseProject()
|
|
|
m_naviInterface->removeWidget(sender()->objectName());
|
|
|
m_stackWidget->setCurrentIndex(0);
|
|
|
}
|
|
|
+
|
|
|
+void MainWindow::slotDeleteProject(ProjectInfo *proj)
|
|
|
+{
|
|
|
+ QString n = QString("project_%1").arg(proj->id);
|
|
|
+ int index = m_stackWidget->index(n);
|
|
|
+ if (index >= 0) {
|
|
|
+ QWidget *w = m_stackWidget->widget(index);
|
|
|
+ m_stackWidget->removeWidget(w);
|
|
|
+ m_naviInterface->removeWidget(n);
|
|
|
+ m_stackWidget->setCurrentIndex(0);
|
|
|
+ }
|
|
|
+}
|