Commit ef84e19f authored by Tao Zhong's avatar Tao Zhong

#131 Show/ hide options tab

parent 8c91f4e1
Pipeline #19790 passed with stages
in 25 seconds
......@@ -1160,13 +1160,6 @@ void jpsGraphicsView::select_line(jpsLineItem *mline)
void jpsGraphicsView::disable_drawing()
{
/* statWall=false;
statDoor=false;
statExit=false;
statLandmark=false;
_statLineEdit=false;
_statHLine=false;*/
_statCopy=0;
drawingMode = Selecting;
......
......@@ -213,20 +213,15 @@ MWindow :: MWindow()
connect(actionExit,SIGNAL(triggered(bool)),this,SLOT(en_disableExit()));
connect(actionHLine,SIGNAL(triggered(bool)),this,SLOT(en_disableHLine()));
connect(actionLandmark,SIGNAL(triggered(bool)),this,SLOT(en_disableLandmark()));
connect(actionSource, SIGNAL(toggled(bool)),this,SLOT(sourceButtonClicked()));
connect(actionEditMode,SIGNAL(toggled(bool)),this,SLOT(editModeButtonClicked()));
connect(actionGoal,SIGNAL(toggled(bool)),this,SLOT(goalButtionClicked()));
connect(actionSource, SIGNAL(triggered(bool)),this,SLOT(sourceButtonClicked()));
connect(actionEditMode,SIGNAL(triggered(bool)),this,SLOT(editModeButtonClicked()));
connect(actionGoal,SIGNAL(triggered(bool)),this,SLOT(goalButtionClicked()));
// connect(actionWall,SIGNAL(triggered(bool)),this,SLOT(dis_selectMode()));
// connect(actionLandmark,SIGNAL(triggered(bool)),this,SLOT(dis_selectMode()));
// connect(actionDoor,SIGNAL(triggered(bool)),this,SLOT(dis_selectMode()));
// connect(actionExit,SIGNAL(triggered(bool)),this,SLOT(dis_selectMode()));
sourceWidget = nullptr;
sourceDockWidget = nullptr;
goalWidget = nullptr;
goalDockWidget = nullptr;
propertyDockWidget = nullptr;
//object snapping
objectsnapping = {};
......@@ -875,17 +870,10 @@ void MWindow::define_landmark()
void MWindow::en_selectMode()
{
mview->disable_drawing();
// actionSelect_Mode->setChecked(true);
// actionWall->setChecked(false);
// actionDoor->setChecked(false);
// actionExit->setChecked(false);
// actionHLine->setChecked(false);
// actionLandmark->setChecked(false);
actionSelect_Mode->setChecked(true);
actionCopy->setChecked(false);
mview->disable_drawing();
length_edit->clearFocus();
}
......@@ -1047,25 +1035,46 @@ void MWindow::on_actionZoom_Extents_triggered()
void MWindow::sourceButtonClicked()
{
mview->enableSourceMode();
if(propertyDockWidget == nullptr)
{
//source widget off, dockwidget off -> open source widget
mview->enableSourceMode();
propertyDockWidget = new QDockWidget(tr("Sources"), this);
propertyDockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
propertyDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
// source dochwidget
if(sourceDockWidget == nullptr && actionSource->isChecked())
auto *sourceWidget = new SourceWidget(this, mview, this->dmanager);
addDockWidget(Qt::RightDockWidgetArea, propertyDockWidget);
propertyDockWidget->setWidget(sourceWidget);
} else if (propertyDockWidget != nullptr && propertyDockWidget->windowTitle() == "Sources")
{
sourceDockWidget = new QDockWidget(tr("Sources"), this);
sourceDockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
sourceDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
// goal widget on, dockwidget on -> close goal widget
mview->disable_drawing();
actionSelect_Mode->setChecked(true);
propertyDockWidget->close(); //close() has deleted pointer
propertyDockWidget = nullptr;
} else if (propertyDockWidget != nullptr && propertyDockWidget->windowTitle() != "Sources")
{
// goal widget off, dockwidget on -> close other widget, open goal widget
propertyDockWidget->close();
propertyDockWidget = nullptr;
mview->enableSourceMode();
propertyDockWidget = new QDockWidget(tr("Sources"), this);
propertyDockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
propertyDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
auto *sourceWidget = new SourceWidget(this, mview, this->dmanager);
addDockWidget(Qt::RightDockWidgetArea, propertyDockWidget);
propertyDockWidget->setWidget(sourceWidget);
sourceWidget = new SourceWidget(this, mview, this->dmanager);
addDockWidget(Qt::RightDockWidgetArea, sourceDockWidget);
sourceDockWidget->setWidget(sourceWidget);
} else
{
sourceDockWidget->close(); //close() has deleted pointer
sourceDockWidget = nullptr;
delete sourceWidget;
sourceWidget = nullptr;
}
}
......@@ -1083,24 +1092,41 @@ void MWindow::editModeButtonClicked()
void MWindow::goalButtionClicked()
{
mview->enableGoalMode();
if(propertyDockWidget == nullptr)
{
//goal widget off, dockwidget off -> open goal widget
mview->enableGoalMode();
propertyDockWidget = new QDockWidget(tr("Goals"), this);
propertyDockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
propertyDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
// source dochwidget
if(goalDockWidget == nullptr && actionGoal->isChecked())
auto *goalWidget = new GoalWidget(this, mview, this->dmanager);
addDockWidget(Qt::RightDockWidgetArea, propertyDockWidget);
propertyDockWidget->setWidget(goalWidget);
} else if (propertyDockWidget != nullptr && propertyDockWidget->windowTitle() == "Goals")
{
goalDockWidget = new QDockWidget(tr("Sources"), this);
goalDockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
goalDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
// goal widget on, dockwidget on -> close goal widget
mview->disable_drawing();
actionSelect_Mode->setChecked(true);
propertyDockWidget->close(); //close() has deleted pointer
propertyDockWidget = nullptr;
} else if (propertyDockWidget != nullptr && propertyDockWidget->windowTitle() != "Goals")
{
// goal widget off, dockwidget on -> close other widget, open goal widget
propertyDockWidget->close();
propertyDockWidget = nullptr;
propertyDockWidget = new QDockWidget(tr("Goals"), this);
propertyDockWidget->setFeatures(QDockWidget::NoDockWidgetFeatures);
propertyDockWidget->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
goalWidget = new GoalWidget(this, mview, this->dmanager);
addDockWidget(Qt::RightDockWidgetArea, goalDockWidget);
goalDockWidget->setWidget(goalWidget);
auto *goalWidget = new GoalWidget(this, mview, this->dmanager);
addDockWidget(Qt::RightDockWidgetArea, propertyDockWidget);
propertyDockWidget->setWidget(goalWidget);
} else
{
goalDockWidget->close(); //close() has deleted pointer
goalDockWidget = nullptr;
delete goalWidget;
goalWidget = nullptr;
}
}
......
......@@ -63,11 +63,7 @@ private:
widgetLandmark* lwidget;
InifileWidget * inifileWidget;
QDockWidget *sourceDockWidget;
SourceWidget *sourceWidget;
QDockWidget *goalDockWidget;
GoalWidget *goalWidget;
QDockWidget *propertyDockWidget;
SnappingOptions* snappingOptions;
// WidgetSettings* _settings;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment