diff --git a/Source/src/scene/OEScene.cpp b/Source/src/scene/OEScene.cpp index 16b9cf4e..c93a4782 100644 --- a/Source/src/scene/OEScene.cpp +++ b/Source/src/scene/OEScene.cpp @@ -39,6 +39,7 @@ void OEScene::InitEventHandle(class OsgView* view) { //view->GetView()->addEventHandler(new osgEarth::Util::EarthManipulator()); view->GetView()->addEventHandler(new osgViewer::HelpHandler); + view->GetView()->addEventHandler(new osgViewer::StatsHandler); } void OEScene::AttachView(OsgView* view) { diff --git a/Source/src/translations/Dyt_zh_CN.ts b/Source/src/translations/Dyt_zh_CN.ts index 45401bc1..8452bdeb 100644 --- a/Source/src/translations/Dyt_zh_CN.ts +++ b/Source/src/translations/Dyt_zh_CN.ts @@ -388,60 +388,60 @@ - - Tab 1 - - - - - Tab 2 - - - - + model elements 模型元素 - + attribte 属性 - + Wave Curve - + Speed Curve - + 3D Curve - + Report Table - + Report - + Signal Indicator Lamp - + ParamSetting + + + name: 5year 0412 + + + + + start: no start + + ModelBrowser @@ -1064,12 +1064,12 @@ QtOsgViewWidget - + notify - + open dyt file failed diff --git a/Source/src/ui/MainWindow.cpp b/Source/src/ui/MainWindow.cpp index 425f7ccf..9d695215 100644 --- a/Source/src/ui/MainWindow.cpp +++ b/Source/src/ui/MainWindow.cpp @@ -48,9 +48,12 @@ MainWindow::~MainWindow() { } void MainWindow::InitUI() { - ui->tabWidget->setTabPosition(QTabWidget::South); - ui->tabWidget->tabBar()->setMinimumWidth(300); + tabWidget_ = new QTabWidget; + tabWidget_->setTabPosition(QTabWidget::South); + tabWidget_->tabBar()->setMinimumWidth(300); + + ui->viewWidget->layout()->addWidget(tabWidget_); pSettingUI = new LayoutSettingUI(); @@ -80,36 +83,32 @@ void MainWindow::InitUI() { connect(modelBrowser_, &ModelBrowser::EntityChange, propertyBrowser_, &PropertyBrowser::OnEntityChange); qtOsgViewWidget_ = new QtOsgViewWidget; - setCentralWidget(qtOsgViewWidget_); //ui->viewWidget->layout()->addWidget(qtOsgViewWidget_); OsgViewer::Get().Initialize(); OsgViewer::Get().OnFrame(); - + m_mapDockWidget.insert("PropertyBrowser", attribte); QString wavePath = WorkSpaceManager::Get().GetDYTWaveFile(); - if (wavePath.isEmpty()) - { + if (wavePath.isEmpty()) { wavePath = RecourceHelper::Get().GetBasePath() + "/workspace/Wave.txt"; WorkSpaceManager::Get().SetDYTWaveFile(wavePath); } // const QString wavePath = RecourceHelper::Get().GetBasePath() + "/workspace/Wave.txt"; QString speedPath = WorkSpaceManager::Get().GetDYTReportFile(); - if (speedPath.isEmpty()) - { + if (speedPath.isEmpty()) { speedPath = RecourceHelper::Get().GetBasePath() + "/workspace/Report.txt"; WorkSpaceManager::Get().SetDYTReportFile(speedPath); } //const QString speedPath = RecourceHelper::Get().GetBasePath() + "/workspace/Report.txt"; QString rdPath = WorkSpaceManager::Get().GetDYTRDFile(); - if (rdPath.isEmpty()) - { + if (rdPath.isEmpty()) { rdPath = RecourceHelper::Get().GetBasePath() + "/workspace/RD.txt"; WorkSpaceManager::Get().SetDYTRDFile(rdPath); } - // const QString rdPath = RecourceHelper::Get().GetBasePath() + "/workspace/RD.txt"; - + // const QString rdPath = RecourceHelper::Get().GetBasePath() + "/workspace/RD.txt"; + DockWidget* fitCurveDock = new DockWidget(tr("Wave Curve"), 0); // addDockWidget(pSettingUI->GetArea("2DCurveDialog"), fitCurveDock); fitCurveDlg_ = new FitCurveDialog(1); @@ -206,9 +205,9 @@ void MainWindow::InitUI() { addParamDlg_->AttachDock(addParamSettingDock); m_mapDockWidget.insert("ParamSetting", addParamSettingDock); - //ui->discript->setText(tr("name: 5year 0412")); - //ui->status->setText(tr("start: no start")); - + ui->discript->setText(tr("name: 5year 0412")); + ui->status->setText(tr("start: no start")); + InitDockLayout(); #if 0 @@ -217,77 +216,68 @@ void MainWindow::InitUI() { #endif // 1 } -void MainWindow::InitDockLayout() -{ - return; +void MainWindow::InitDockLayout() { + while (tabWidget_->count() > 0) { + tabWidget_->removeTab(0); + } + QVariantList listTab = pSettingUI->GetAreaLayout().toList(); - for (int i = 0; i < listTab.size(); i++) - { + for (int i = 0; i < listTab.size(); i++) { QVariantMap mapTab = listTab[i].toMap(); QString strTabName = mapTab.value("Name").toString(); - QWidget* mainWindow_ = new QWidget; + QMainWindow* mainWindow_ = new QMainWindow; QVariantList listDocArea = mapTab.value("Widget").toList(); - //tabWidget_->insertTab(i, mainWindow_, strTabName); - - if (listDocArea.size() > 0) - { + tabWidget_->insertTab(i, mainWindow_, strTabName); + if (listDocArea[0].toList().size() > 0) { + mainWindow_->setCentralWidget(qtOsgViewWidget_); + OsgViewer::Get().Initialize(); + OsgViewer::Get().OnFrame(); + } else { + mainWindow_->takeCentralWidget(); + } + + + if (listDocArea.size() > 0) { QDockWidget* lastDock = nullptr; - for (int j = 1; j < listDocArea.size(); j++) - { + for (int j = 1; j < listDocArea.size(); j++) { Qt::DockWidgetArea dockArea; - if (j == 1) - { + if (j == 1) { dockArea = Qt::LeftDockWidgetArea; - } - else if (j == 2) - { + } else if (j == 2) { dockArea = Qt::TopDockWidgetArea; - } - else if (j == 3) - { + } else if (j == 3) { dockArea = Qt::RightDockWidgetArea; - } - else if (j == 4) - { + } else if (j == 4) { dockArea = Qt::BottomDockWidgetArea; } QVariantList listDocAreaChild = listDocArea[j].toList(); - for (int m = 0; m < listDocAreaChild.size(); m++) - { + for (int m = 0; m < listDocAreaChild.size(); m++) { QVariant varWidget = listDocAreaChild[m]; - if (varWidget.type() == QVariant::String) - { + if (varWidget.type() == QVariant::String) { QDockWidget* pDock = m_mapDockWidget.value(varWidget.toString()); if (pDock == nullptr) { continue; } - addDockWidget(dockArea, pDock); + mainWindow_->addDockWidget(dockArea, pDock); lastDock = pDock; - } - else - { + } else { QVariantList listWidget = varWidget.toList(); - for (int k = 0; k < listWidget.size(); k++) - { + for (int k = 0; k < listWidget.size(); k++) { QDockWidget* pDock = m_mapDockWidget.value(listWidget[k].toString()); - addDockWidget(dockArea, pDock); + mainWindow_->addDockWidget(dockArea, pDock); - if (k == 0) - { - if (lastDock) - { - splitDockWidget(lastDock, pDock, Qt::Vertical); + if (k == 0) { + if (lastDock) { + mainWindow_->splitDockWidget(lastDock, pDock, Qt::Vertical); } - } - else - { - splitDockWidget(lastDock, pDock, Qt::Horizontal); + } else { + mainWindow_->splitDockWidget(lastDock, pDock, Qt::Horizontal); } lastDock = pDock; @@ -298,69 +288,52 @@ void MainWindow::InitDockLayout() } } - /* AddDockArea("DockLeftArea"); - AddDockArea("DockTopArea"); - AddDockArea("DockRightArea"); - AddDockArea("DockBottomArea");*/ + /* AddDockArea("DockLeftArea"); + AddDockArea("DockTopArea"); + AddDockArea("DockRightArea"); + AddDockArea("DockBottomArea");*/ } -void MainWindow::AddDockArea(const QString& strArea) -{ +void MainWindow::AddDockArea(const QString& strArea) { Qt::DockWidgetArea dockArea; Qt::Orientation orient; - if (strArea == "DockLeftArea") - { + if (strArea == "DockLeftArea") { dockArea = Qt::LeftDockWidgetArea; orient = Qt::Vertical; - } - else if (strArea == "DockTopArea") - { + } else if (strArea == "DockTopArea") { dockArea = Qt::TopDockWidgetArea; orient = Qt::Horizontal; - } - else if (strArea == "DockRightArea") - { + } else if (strArea == "DockRightArea") { dockArea = Qt::RightDockWidgetArea; orient = Qt::Vertical; - } - else if (strArea == "DockBottomArea") - { + } else if (strArea == "DockBottomArea") { dockArea = Qt::BottomDockWidgetArea; orient = Qt::Horizontal; - } - else - { + } else { return; } QList listAdd; QVariant varArea = pSettingUI->GetAreaLayout(); - if (varArea.isValid()) - { + if (varArea.isValid()) { QVariantList listWidget = varArea.toList(); - for each (QVariant varWidget in listWidget) - { - if (varWidget.type() == QVariant::String) - { + for each(QVariant varWidget in listWidget) { + if (varWidget.type() == QVariant::String) { QDockWidget* pDock = m_mapDockWidget.value(varWidget.toString()); addDockWidget(dockArea, pDock); listAdd.push_back(pDock); - } - else - { + } else { QDockWidget* pLastDock = nullptr; QVariantList listTab = varWidget.toList(); - for each (QVariant tabChild in listTab) - { + for each(QVariant tabChild in listTab) { QDockWidget* pDock = m_mapDockWidget.value(tabChild.toString()); addDockWidget(dockArea, pDock); - if (pLastDock) - { - //tabifyDockWidget(pLastDock, pDock); + if (pLastDock) { + //tabifyDockWidget(pLastDock, pDock); splitDockWidget(pLastDock, pDock, Qt::Horizontal); } @@ -372,15 +345,13 @@ void MainWindow::AddDockArea(const QString& strArea) } } QList listSpliter; - for (size_t i = 0; i < listAdd.size(); i++) - { + for (size_t i = 0; i < listAdd.size(); i++) { listSpliter.push_back(1); } resizeDocks(listAdd, listSpliter, orient); } -void MainWindow::slotShowUISetting() -{ +void MainWindow::slotShowUISetting() { pSettingUI->show(); } diff --git a/Source/src/ui/MainWindow.h b/Source/src/ui/MainWindow.h index 37ae8174..ba04855e 100644 --- a/Source/src/ui/MainWindow.h +++ b/Source/src/ui/MainWindow.h @@ -44,22 +44,23 @@ private: void AddDockArea(const QString& strArea); protected: - + private: Ui::MainWindow* ui; class ModelBrowser* modelBrowser_{ nullptr }; class PropertyBrowser* propertyBrowser_{ nullptr }; - class QWebEngineView* webEngineView_{nullptr }; + class QWebEngineView* webEngineView_{ nullptr }; class QtOsgViewWidget* qtOsgViewWidget_{ nullptr }; class FitCurveDialog* fitCurveDlg_{ nullptr }; class FitCurveDialog* fitYLgCurveDlg_{ nullptr }; class SurfaceDialog* surfaceDlg_{ nullptr }; class LayoutSettingUI* pSettingUI{ nullptr }; - class TargetListWgt* targetUI_{nullptr}; + class TargetListWgt* targetUI_{ nullptr }; class TargetListWgt* targetUITable_{ nullptr }; + class QTabWidget* tabWidget_{ nullptr }; class SignalIndicatorLampUI* signalIndicatorLampUI_{ nullptr }; class AddParamSetting* addParamDlg_{ nullptr }; diff --git a/Source/src/ui/MainWindow.ui b/Source/src/ui/MainWindow.ui index a1d25cfe..61c17f6e 100644 --- a/Source/src/ui/MainWindow.ui +++ b/Source/src/ui/MainWindow.ui @@ -1,124 +1,131 @@ - MainWindow - - - - 0 - 0 - 1112 - 774 - - - - MainWindow - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - QTabWidget::South - - - - Tab 1 - - - - - Tab 2 - - - - - - - - - - - - 0 - 20 - - - - - 16777215 - 30 - - - - - 0 - - - 0 - - - - - - - - - - - - - - - - - - - Qt::Horizontal - - - - 767 - 20 - - - - - - - - - - - - + MainWindow + + + + 0 + 0 + 800 + 658 + + + + MainWindow + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 19 + + + 19 + + + 19 + + + 19 + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + + + + + + + + + + 0 + 20 + + + + + 16777215 + 30 + + + + + 0 + + + 0 + + + + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 767 + 20 + + + + + + + + + + + + diff --git a/Source/src/viewer/QtOsgViewWidget.cpp b/Source/src/viewer/QtOsgViewWidget.cpp index a94b383f..bd982399 100644 --- a/Source/src/viewer/QtOsgViewWidget.cpp +++ b/Source/src/viewer/QtOsgViewWidget.cpp @@ -37,7 +37,7 @@ QtOsgViewWidget::QtOsgViewWidget(QWidget* parent) setAttribute(Qt::WA_NoSystemBackground, false); setAttribute(Qt::WA_OpaquePaintEvent, false); setAttribute(Qt::WA_DontCreateNativeAncestors, false); - + setFocusPolicy(Qt::StrongFocus); Initialize(); }