modify ui layout
This commit is contained in:
parent
bfd45c3a4a
commit
0e8d2aaf7d
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,3 +2,5 @@
|
|||||||
build/
|
build/
|
||||||
bin/
|
bin/
|
||||||
thirdparty/
|
thirdparty/
|
||||||
|
tritoin/
|
||||||
|
QWEN.md
|
||||||
|
|||||||
@ -14,8 +14,8 @@ find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core Widgets LinguistTools DataVis
|
|||||||
|
|
||||||
message("qt VERSION " ${QT_VERSION_MAJOR})
|
message("qt VERSION " ${QT_VERSION_MAJOR})
|
||||||
|
|
||||||
FILE(GLOB_RECURSE HEADER_FILES ./*.h common/*.h common/*.hpp model/*.h app/*.h)
|
FILE(GLOB_RECURSE HEADER_FILES ./*.h common/*.h common/*.hpp model/*.h app/*.h utils/*.h)
|
||||||
FILE(GLOB_RECURSE CPP_FILES ./*.cpp common/*.cpp model/*.cpp app/*.cpp)
|
FILE(GLOB_RECURSE CPP_FILES ./*.cpp common/*.cpp model/*.cpp app/*.cpp utils/*.cpp)
|
||||||
FILE(GLOB_RECURSE CC_FILES ./*.cc)
|
FILE(GLOB_RECURSE CC_FILES ./*.cc)
|
||||||
FILE(GLOB_RECURSE UI_FILES ./*.ui)
|
FILE(GLOB_RECURSE UI_FILES ./*.ui)
|
||||||
FILE(GLOB_RECURSE QRC_FILES ./*.qrc)
|
FILE(GLOB_RECURSE QRC_FILES ./*.qrc)
|
||||||
|
|||||||
@ -540,127 +540,132 @@
|
|||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="65"/>
|
<location filename="../ui/MainWindow.cpp" line="57"/>
|
||||||
<source>model elements</source>
|
<source>model elements</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="71"/>
|
<location filename="../ui/MainWindow.cpp" line="64"/>
|
||||||
<source>attribte</source>
|
<source>attribte</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="108"/>
|
<location filename="../ui/MainWindow.cpp" line="79"/>
|
||||||
|
<source>Main View</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../ui/MainWindow.cpp" line="113"/>
|
||||||
<source>Wave Curve</source>
|
<source>Wave Curve</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="114"/>
|
<location filename="../ui/MainWindow.cpp" line="121"/>
|
||||||
<source>Speed Curve</source>
|
<source>Speed Curve</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="123"/>
|
<location filename="../ui/MainWindow.cpp" line="133"/>
|
||||||
<source>3D Curve</source>
|
<source>3D Curve</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="135"/>
|
<location filename="../ui/MainWindow.cpp" line="148"/>
|
||||||
<source>Target number</source>
|
<source>Target number</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="135"/>
|
<location filename="../ui/MainWindow.cpp" line="148"/>
|
||||||
<source>Signal-to-noise ratio</source>
|
<source>Signal-to-noise ratio</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="136"/>
|
<location filename="../ui/MainWindow.cpp" line="149"/>
|
||||||
<source>Azimuth line of sight</source>
|
<source>Azimuth line of sight</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="136"/>
|
<location filename="../ui/MainWindow.cpp" line="149"/>
|
||||||
<source>Pitch gaze angle</source>
|
<source>Pitch gaze angle</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="137"/>
|
<location filename="../ui/MainWindow.cpp" line="150"/>
|
||||||
<source>azimuth</source>
|
<source>azimuth</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="137"/>
|
<location filename="../ui/MainWindow.cpp" line="150"/>
|
||||||
<source>Pitch angle</source>
|
<source>Pitch angle</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="138"/>
|
<location filename="../ui/MainWindow.cpp" line="151"/>
|
||||||
<source>attribute</source>
|
<source>attribute</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="138"/>
|
<location filename="../ui/MainWindow.cpp" line="151"/>
|
||||||
<source>Doppler</source>
|
<source>Doppler</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="139"/>
|
<location filename="../ui/MainWindow.cpp" line="152"/>
|
||||||
<source>course</source>
|
<source>course</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="139"/>
|
<location filename="../ui/MainWindow.cpp" line="152"/>
|
||||||
<source>Speed</source>
|
<source>Speed</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="140"/>
|
<location filename="../ui/MainWindow.cpp" line="153"/>
|
||||||
<source>longitude</source>
|
<source>longitude</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="140"/>
|
<location filename="../ui/MainWindow.cpp" line="153"/>
|
||||||
<source>latitude</source>
|
<source>latitude</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="141"/>
|
<location filename="../ui/MainWindow.cpp" line="154"/>
|
||||||
<source>distance</source>
|
<source>distance</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="141"/>
|
<location filename="../ui/MainWindow.cpp" line="154"/>
|
||||||
<source>velocity</source>
|
<source>velocity</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="142"/>
|
<location filename="../ui/MainWindow.cpp" line="155"/>
|
||||||
<source>Radial dimensions</source>
|
<source>Radial dimensions</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="142"/>
|
<location filename="../ui/MainWindow.cpp" line="155"/>
|
||||||
<source>Target RCS</source>
|
<source>Target RCS</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="148"/>
|
<location filename="../ui/MainWindow.cpp" line="161"/>
|
||||||
<source>Report Table</source>
|
<source>Report Table</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="157"/>
|
<location filename="../ui/MainWindow.cpp" line="173"/>
|
||||||
<source>Signal Indicator Lamp</source>
|
<source>Signal Indicator Lamp</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="164"/>
|
<location filename="../ui/MainWindow.cpp" line="183"/>
|
||||||
<source>ParamSetting</source>
|
<source>ParamSetting</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ui/MainWindow.cpp" line="169"/>
|
<location filename="../ui/MainWindow.cpp" line="191"/>
|
||||||
<source>bat File</source>
|
<source>bat File</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
|
||||||
#include <qtabwidget.h>
|
#include <qtabwidget.h>
|
||||||
|
#include "utils/UiLayoutManager.h"
|
||||||
|
|
||||||
#include "PropertyBrowser.h"
|
#include "PropertyBrowser.h"
|
||||||
#include "ModelBrowser.h"
|
#include "ModelBrowser.h"
|
||||||
@ -43,43 +44,47 @@ MainWindow::~MainWindow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::InitUI() {
|
void MainWindow::InitUI() {
|
||||||
|
QWidget* centralWidget = takeCentralWidget();
|
||||||
tabWidget_ = new QTabWidget;
|
if (nullptr != centralWidget) {
|
||||||
tabWidget_->setTabPosition(QTabWidget::South);
|
delete centralWidget;
|
||||||
tabWidget_->tabBar()->setMinimumWidth(300);
|
}
|
||||||
|
setDockNestingEnabled(true);
|
||||||
ui->viewWidget->layout()->addWidget(tabWidget_);
|
|
||||||
|
|
||||||
pSettingUI = new LayoutSettingUI();
|
|
||||||
|
|
||||||
const QString uiLaytouPath = RecourceHelper::Get().GetBasePath() + "/workspace/UILayout.xml";
|
|
||||||
|
|
||||||
pSettingUI->InitConfig(uiLaytouPath);
|
|
||||||
//pSettingUI->show();
|
|
||||||
|
|
||||||
connect(pSettingUI, &LayoutSettingUI::signalUpdate, this, &MainWindow::InitDockLayout);
|
|
||||||
|
|
||||||
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
|
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
|
||||||
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
|
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
|
||||||
|
setDockOptions(QMainWindow::AllowTabbedDocks | QMainWindow::AllowNestedDocks | QMainWindow::AnimatedDocks);
|
||||||
|
|
||||||
DockWidget* model = new DockWidget(tr("model elements"), 0);
|
DockWidget* model = new DockWidget(tr("model elements"), 0);
|
||||||
|
model->setObjectName("Dock.ModelBrowser");
|
||||||
// addDockWidget(pSettingUI->GetArea("ModelBrowser"), model);
|
// addDockWidget(pSettingUI->GetArea("ModelBrowser"), model);
|
||||||
modelBrowser_ = new ModelBrowser(0);
|
modelBrowser_ = new ModelBrowser(0);
|
||||||
modelBrowser_->AttachDock(model);
|
modelBrowser_->AttachDock(model);
|
||||||
m_mapDockWidget.insert("ModelBrowser", model);
|
m_mapDockWidget.insert("ModelBrowser", model);
|
||||||
|
|
||||||
DockWidget* attribte = new DockWidget(tr("attribte"), 0);
|
DockWidget* attribte = new DockWidget(tr("attribte"), 0);
|
||||||
|
attribte->setObjectName("Dock.PropertyBrowser");
|
||||||
//addDockWidget(pSettingUI->GetArea("PropertyBrowser"), attribte);
|
//addDockWidget(pSettingUI->GetArea("PropertyBrowser"), attribte);
|
||||||
propertyBrowser_ = new PropertyBrowser(0);
|
propertyBrowser_ = new PropertyBrowser(0);
|
||||||
propertyBrowser_->AttachDock(attribte);
|
propertyBrowser_->AttachDock(attribte);
|
||||||
m_mapDockWidget.insert("PropertyBrowser", attribte);
|
m_mapDockWidget.insert("PropertyBrowser", attribte);
|
||||||
|
addDockWidget(Qt::RightDockWidgetArea, attribte);
|
||||||
|
|
||||||
connect(modelBrowser_, &ModelBrowser::WorkSpaceChange, propertyBrowser_, &PropertyBrowser::OnWorkSpaceChange);
|
connect(modelBrowser_, &ModelBrowser::WorkSpaceChange, propertyBrowser_, &PropertyBrowser::OnWorkSpaceChange);
|
||||||
connect(modelBrowser_, &ModelBrowser::EntityChange, propertyBrowser_, &PropertyBrowser::OnEntityChange);
|
connect(modelBrowser_, &ModelBrowser::EntityChange, propertyBrowser_, &PropertyBrowser::OnEntityChange);
|
||||||
|
|
||||||
qtOsgViewWidget_ = new OsgWidget;
|
qtOsgViewWidget_ = new OsgWidget;
|
||||||
qtOsgViewWidget_->Initialize();
|
qtOsgViewWidget_->Initialize();
|
||||||
//m_mapDockWidget.insert("PropertyBrowser", attribte);
|
|
||||||
|
// 主视图改为 DockWidget,支持自由停靠
|
||||||
|
DockWidget* viewDock = new DockWidget(tr("Main View"), 0);
|
||||||
|
viewDock->setObjectName("Dock.MainView");
|
||||||
|
viewDock->setWidget(qtOsgViewWidget_);
|
||||||
|
addDockWidget(Qt::LeftDockWidgetArea, viewDock);
|
||||||
|
m_mapDockWidget.insert("MainView", viewDock);
|
||||||
|
|
||||||
|
// 左侧模型面板,并与主视图横向并排(类似 VS 左侧工具 + 中间视图)
|
||||||
|
addDockWidget(Qt::LeftDockWidgetArea, model);
|
||||||
|
splitDockWidget(model, viewDock, Qt::Horizontal);
|
||||||
|
|
||||||
QString wavePath ="", speedPath = "", rdPath = "", matlabParam="";
|
QString wavePath ="", speedPath = "", rdPath = "", matlabParam="";
|
||||||
if (WorkSpaceManager::Get().GetCurrent())
|
if (WorkSpaceManager::Get().GetCurrent())
|
||||||
@ -106,25 +111,33 @@ void MainWindow::InitUI() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DockWidget* fitCurveDock = new DockWidget(tr("Wave Curve"), 0);
|
DockWidget* fitCurveDock = new DockWidget(tr("Wave Curve"), 0);
|
||||||
|
fitCurveDock->setObjectName("Dock.WaveCurveDialog");
|
||||||
fitCurveDlg_ = new FitCurveDialog(1);
|
fitCurveDlg_ = new FitCurveDialog(1);
|
||||||
fitCurveDlg_->AttachDock(fitCurveDock);
|
fitCurveDlg_->AttachDock(fitCurveDock);
|
||||||
m_mapDockWidget.insert("WaveCurveDialog", fitCurveDock);
|
m_mapDockWidget.insert("WaveCurveDialog", fitCurveDock);
|
||||||
|
addDockWidget(Qt::BottomDockWidgetArea, fitCurveDock);
|
||||||
|
|
||||||
fitCurveDlg_->InitWaveFile(wavePath);
|
fitCurveDlg_->InitWaveFile(wavePath);
|
||||||
DockWidget* fitLgCurveDock = new DockWidget(tr("Speed Curve"), 0);
|
DockWidget* fitLgCurveDock = new DockWidget(tr("Speed Curve"), 0);
|
||||||
|
fitLgCurveDock->setObjectName("Dock.SpeedCurveDialog");
|
||||||
|
|
||||||
fitYLgCurveDlg_ = new FitCurveDialog(1);
|
fitYLgCurveDlg_ = new FitCurveDialog(1);
|
||||||
fitYLgCurveDlg_->AttachDock(fitLgCurveDock);
|
fitYLgCurveDlg_->AttachDock(fitLgCurveDock);
|
||||||
m_mapDockWidget.insert("SpeedCurveDialog", fitLgCurveDock);
|
m_mapDockWidget.insert("SpeedCurveDialog", fitLgCurveDock);
|
||||||
|
addDockWidget(Qt::BottomDockWidgetArea, fitLgCurveDock);
|
||||||
|
tabifyDockWidget(fitCurveDock, fitLgCurveDock);
|
||||||
|
|
||||||
|
|
||||||
fitYLgCurveDlg_->InitReportFile(speedPath);
|
fitYLgCurveDlg_->InitReportFile(speedPath);
|
||||||
|
|
||||||
DockWidget* surfaceCurveDock = new DockWidget(tr("3D Curve"), 0);
|
DockWidget* surfaceCurveDock = new DockWidget(tr("3D Curve"), 0);
|
||||||
|
surfaceCurveDock->setObjectName("Dock.3DCurveDialog");
|
||||||
|
|
||||||
surfaceDlg_ = new SurfaceDialog();
|
surfaceDlg_ = new SurfaceDialog();
|
||||||
surfaceDlg_->AttachDock(surfaceCurveDock);
|
surfaceDlg_->AttachDock(surfaceCurveDock);
|
||||||
m_mapDockWidget.insert("3DCurveDialog", surfaceCurveDock);
|
m_mapDockWidget.insert("3DCurveDialog", surfaceCurveDock);
|
||||||
|
addDockWidget(Qt::BottomDockWidgetArea, surfaceCurveDock);
|
||||||
|
tabifyDockWidget(fitCurveDock, surfaceCurveDock);
|
||||||
|
|
||||||
surfaceDlg_->InitRD(rdPath);
|
surfaceDlg_->InitRD(rdPath);
|
||||||
|
|
||||||
@ -146,36 +159,51 @@ void MainWindow::InitUI() {
|
|||||||
targetUITable_->InitFile(speedPath, 50);
|
targetUITable_->InitFile(speedPath, 50);
|
||||||
|
|
||||||
DockWidget* dataTableDock = new DockWidget(tr("Report Table"), 0);
|
DockWidget* dataTableDock = new DockWidget(tr("Report Table"), 0);
|
||||||
|
dataTableDock->setObjectName("Dock.TargetListWgt_Table");
|
||||||
// addDockWidget(pSettingUI->GetArea("TargetListWgt"), dataTableDock);
|
// addDockWidget(pSettingUI->GetArea("TargetListWgt"), dataTableDock);
|
||||||
targetUITable_->AttachDock(dataTableDock);
|
targetUITable_->AttachDock(dataTableDock);
|
||||||
m_mapDockWidget.insert("TargetListWgt_Table", dataTableDock);
|
m_mapDockWidget.insert("TargetListWgt_Table", dataTableDock);
|
||||||
|
addDockWidget(Qt::BottomDockWidgetArea, dataTableDock);
|
||||||
|
tabifyDockWidget(fitCurveDock, dataTableDock);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const QString lampPath = RecourceHelper::Get().GetBasePath() + "/workspace/Lamp.txt";
|
const QString lampPath = RecourceHelper::Get().GetBasePath() + "/workspace/Lamp.txt";
|
||||||
|
|
||||||
DockWidget* signalIndicatorLampDock = new DockWidget(tr("Signal Indicator Lamp"), 0);
|
DockWidget* signalIndicatorLampDock = new DockWidget(tr("Signal Indicator Lamp"), 0);
|
||||||
|
signalIndicatorLampDock->setObjectName("Dock.SignalIndicatorLampUI");
|
||||||
signalIndicatorLampUI_ = new SignalIndicatorLampUI;
|
signalIndicatorLampUI_ = new SignalIndicatorLampUI;
|
||||||
signalIndicatorLampUI_->AttachDock(signalIndicatorLampDock);
|
signalIndicatorLampUI_->AttachDock(signalIndicatorLampDock);
|
||||||
signalIndicatorLampUI_->InitLamp(lampPath);
|
signalIndicatorLampUI_->InitLamp(lampPath);
|
||||||
|
|
||||||
m_mapDockWidget.insert("SignalIndicatorLampUI", signalIndicatorLampDock);
|
m_mapDockWidget.insert("SignalIndicatorLampUI", signalIndicatorLampDock);
|
||||||
|
addDockWidget(Qt::BottomDockWidgetArea, signalIndicatorLampDock);
|
||||||
|
tabifyDockWidget(fitCurveDock, signalIndicatorLampDock);
|
||||||
|
|
||||||
DockWidget* addParamSettingDock = new DockWidget(tr("ParamSetting"), 0);
|
DockWidget* addParamSettingDock = new DockWidget(tr("ParamSetting"), 0);
|
||||||
|
addParamSettingDock->setObjectName("Dock.ParamSetting");
|
||||||
addParamDlg_ = new AddParamSetting(matlabParam);
|
addParamDlg_ = new AddParamSetting(matlabParam);
|
||||||
addParamDlg_->AttachDock(addParamSettingDock);
|
addParamDlg_->AttachDock(addParamSettingDock);
|
||||||
m_mapDockWidget.insert("ParamSetting", addParamSettingDock);
|
m_mapDockWidget.insert("ParamSetting", addParamSettingDock);
|
||||||
|
addDockWidget(Qt::BottomDockWidgetArea, addParamSettingDock);
|
||||||
|
tabifyDockWidget(fitCurveDock, addParamSettingDock);
|
||||||
|
|
||||||
DockWidget* matlabDock = new DockWidget(tr("bat File"), 0);
|
DockWidget* matlabDock = new DockWidget(tr("bat File"), 0);
|
||||||
|
matlabDock->setObjectName("Dock.Matlab");
|
||||||
matlabFileDlg_ = new CodeEdtUI;
|
matlabFileDlg_ = new CodeEdtUI;
|
||||||
matlabFileDlg_->AttachDock(matlabDock);
|
matlabFileDlg_->AttachDock(matlabDock);
|
||||||
m_mapDockWidget.insert("Matlab", matlabDock);
|
m_mapDockWidget.insert("Matlab", matlabDock);
|
||||||
|
addDockWidget(Qt::BottomDockWidgetArea, matlabDock);
|
||||||
|
tabifyDockWidget(fitCurveDock, matlabDock);
|
||||||
|
|
||||||
//ui->discript->setText(tr("name: 5year 0412"));
|
//ui->discript->setText(tr("name: 5year 0412"));
|
||||||
//ui->status->setText(tr("start: no start"));
|
//ui->status->setText(tr("start: no start"));
|
||||||
|
|
||||||
InitDockLayout();
|
// InitDockLayout();
|
||||||
|
|
||||||
|
// Restore previous UI layout if available
|
||||||
|
UiLayoutManager::Restore(this, 1);
|
||||||
|
|
||||||
//ui->viewWidget->layout()->addWidget(qtOsgViewWidget_);
|
//ui->viewWidget->layout()->addWidget(qtOsgViewWidget_);
|
||||||
qtOsgViewWidget_->LoadDefaultScene();
|
qtOsgViewWidget_->LoadDefaultScene();
|
||||||
/*OsgViewer::Get().Initialize();
|
/*OsgViewer::Get().Initialize();
|
||||||
@ -188,6 +216,8 @@ void MainWindow::InitUI() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::UninitUI() {
|
void MainWindow::UninitUI() {
|
||||||
|
// Save layout state before tearing down widgets
|
||||||
|
UiLayoutManager::Save(this, 1);
|
||||||
if (qtOsgViewWidget_) {
|
if (qtOsgViewWidget_) {
|
||||||
qtOsgViewWidget_->Uninitialize();
|
qtOsgViewWidget_->Uninitialize();
|
||||||
delete qtOsgViewWidget_;
|
delete qtOsgViewWidget_;
|
||||||
@ -195,157 +225,6 @@ void MainWindow::UninitUI() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::InitDockLayout() {
|
|
||||||
while (tabWidget_->count() > 0) {
|
|
||||||
tabWidget_->removeTab(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
tabWidget_->tabBar()->setExpanding(true);
|
|
||||||
|
|
||||||
QVariantList listTab = pSettingUI->GetAreaLayout().toList();
|
|
||||||
for (int i = 0; i < listTab.size(); i++) {
|
|
||||||
QVariantMap mapTab = listTab[i].toMap();
|
|
||||||
QString strTabName = mapTab.value("Name").toString();
|
|
||||||
|
|
||||||
QMainWindow* mainWindow_ = new QMainWindow;
|
|
||||||
connect(mainWindow_, &QMainWindow::tabifiedDockWidgetActivated, this, &MainWindow::OnTabifiedDockWidgetActivated);
|
|
||||||
|
|
||||||
QVariantList listDocArea = mapTab.value("Widget").toList();
|
|
||||||
|
|
||||||
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++) {
|
|
||||||
Qt::DockWidgetArea dockArea;
|
|
||||||
if (j == 1) {
|
|
||||||
dockArea = Qt::LeftDockWidgetArea;
|
|
||||||
} else if (j == 2) {
|
|
||||||
dockArea = Qt::TopDockWidgetArea;
|
|
||||||
} else if (j == 3) {
|
|
||||||
dockArea = Qt::RightDockWidgetArea;
|
|
||||||
} else if (j == 4) {
|
|
||||||
dockArea = Qt::BottomDockWidgetArea;
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantList listDocAreaChild = listDocArea[j].toList();
|
|
||||||
for (int m = 0; m < listDocAreaChild.size(); m++) {
|
|
||||||
QVariant varWidget = listDocAreaChild[m];
|
|
||||||
|
|
||||||
if (varWidget.type() == QVariant::String) {
|
|
||||||
QDockWidget* pDock = m_mapDockWidget.value(varWidget.toString());
|
|
||||||
if (pDock == nullptr) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
mainWindow_->addDockWidget(dockArea, pDock);
|
|
||||||
lastDock = pDock;
|
|
||||||
} else {
|
|
||||||
QVariantList listWidget = varWidget.toList();
|
|
||||||
for (int k = 0; k < listWidget.size(); k++) {
|
|
||||||
QDockWidget* pDock = m_mapDockWidget.value(listWidget[k].toString());
|
|
||||||
mainWindow_->addDockWidget(dockArea, pDock);
|
|
||||||
|
|
||||||
if (k == 0) {
|
|
||||||
if (lastDock) {
|
|
||||||
mainWindow_->splitDockWidget(lastDock, pDock, Qt::Vertical);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
mainWindow_->splitDockWidget(lastDock, pDock, Qt::Horizontal);
|
|
||||||
}
|
|
||||||
|
|
||||||
lastDock = pDock;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
tabWidget_->tabBar()->setMinimumWidth(500);
|
|
||||||
/* AddDockArea("DockLeftArea");
|
|
||||||
AddDockArea("DockTopArea");
|
|
||||||
AddDockArea("DockRightArea");
|
|
||||||
AddDockArea("DockBottomArea");*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::AddDockArea(const QString& strArea) {
|
|
||||||
Qt::DockWidgetArea dockArea;
|
|
||||||
Qt::Orientation orient;
|
|
||||||
|
|
||||||
if (strArea == "DockLeftArea") {
|
|
||||||
dockArea = Qt::LeftDockWidgetArea;
|
|
||||||
orient = Qt::Vertical;
|
|
||||||
} else if (strArea == "DockTopArea") {
|
|
||||||
dockArea = Qt::TopDockWidgetArea;
|
|
||||||
orient = Qt::Horizontal;
|
|
||||||
} else if (strArea == "DockRightArea") {
|
|
||||||
dockArea = Qt::RightDockWidgetArea;
|
|
||||||
orient = Qt::Vertical;
|
|
||||||
} else if (strArea == "DockBottomArea") {
|
|
||||||
dockArea = Qt::BottomDockWidgetArea;
|
|
||||||
orient = Qt::Horizontal;
|
|
||||||
} else {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
QList<QDockWidget*> listAdd;
|
|
||||||
|
|
||||||
QVariant varArea = pSettingUI->GetAreaLayout();
|
|
||||||
if (varArea.isValid()) {
|
|
||||||
QVariantList listWidget = varArea.toList();
|
|
||||||
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 {
|
|
||||||
QDockWidget* pLastDock = nullptr;
|
|
||||||
QVariantList listTab = varWidget.toList();
|
|
||||||
for each(QVariant tabChild in listTab) {
|
|
||||||
QDockWidget* pDock = m_mapDockWidget.value(tabChild.toString());
|
|
||||||
addDockWidget(dockArea, pDock);
|
|
||||||
|
|
||||||
if (pLastDock) {
|
|
||||||
//tabifyDockWidget(pLastDock, pDock);
|
|
||||||
splitDockWidget(pLastDock, pDock, Qt::Horizontal);
|
|
||||||
}
|
|
||||||
|
|
||||||
listAdd.push_back(pDock);
|
|
||||||
|
|
||||||
pLastDock = pDock;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
QList<int> listSpliter;
|
|
||||||
for (size_t i = 0; i < listAdd.size(); i++) {
|
|
||||||
listSpliter.push_back(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
resizeDocks(listAdd, listSpliter, orient);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::OnTabifiedDockWidgetActivated(QDockWidget* dockWidget) {
|
|
||||||
//if (dockWidget) {
|
|
||||||
// QMainWindow* mainWindow = qobject_cast<QMainWindow*>(dockWidget->parentWidget());
|
|
||||||
// if (mainWindow) {
|
|
||||||
// mainWindow->removeDockWidget(dockWidget);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // tabWidget_->setCurrentWidget(dockWidget->parentWidget());
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::slotShowUISetting() {
|
void MainWindow::slotShowUISetting() {
|
||||||
pSettingUI->show();
|
pSettingUI->show();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,12 +44,6 @@ private:
|
|||||||
void InitUI();
|
void InitUI();
|
||||||
void UninitUI();
|
void UninitUI();
|
||||||
|
|
||||||
void InitDockLayout();
|
|
||||||
void AddDockArea(const QString& strArea);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void OnTabifiedDockWidgetActivated(QDockWidget* dockWidget);
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow* ui;
|
Ui::MainWindow* ui;
|
||||||
|
|
||||||
|
|||||||
@ -1,131 +1,20 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>MainWindow</class>
|
<class>MainWindow</class>
|
||||||
<widget class="QMainWindow" name="MainWindow">
|
<widget class="QMainWindow" name="MainWindow">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>1223</width>
|
||||||
<height>658</height>
|
<height>950</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>MainWindow</string>
|
<string>MainWindow</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget"/>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
</widget>
|
||||||
<property name="spacing">
|
<resources/>
|
||||||
<number>0</number>
|
<connections/>
|
||||||
</property>
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="viewDisplay" native="true">
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>19</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>19</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>19</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>19</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="viewWidget" native="true">
|
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
|
||||||
<property name="leftMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="rightMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="spacing">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<layout class="QGridLayout" name="gridLayout"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="statusWidget" native="true">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="maximumSize">
|
|
||||||
<size>
|
|
||||||
<width>16777215</width>
|
|
||||||
<height>30</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<property name="bottomMargin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="discript">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="status">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>767</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
</ui>
|
||||||
|
|||||||
38
src/utils/UiLayoutManager.cpp
Normal file
38
src/utils/UiLayoutManager.cpp
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
#include "UiLayoutManager.h"
|
||||||
|
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
#include "common/RecourceHelper.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
static inline QString layoutIniPath() {
|
||||||
|
return RecourceHelper::Get().GetBasePath() + "/config/UIState.ini";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void UiLayoutManager::Save(QMainWindow* mainWindow, int version) {
|
||||||
|
if (!mainWindow) return;
|
||||||
|
const QString iniPath = layoutIniPath();
|
||||||
|
QSettings settings(iniPath, QSettings::IniFormat);
|
||||||
|
settings.setValue("MainWindow/geometry", mainWindow->saveGeometry());
|
||||||
|
settings.setValue("MainWindow/state", mainWindow->saveState(version));
|
||||||
|
}
|
||||||
|
|
||||||
|
void UiLayoutManager::Restore(QMainWindow* mainWindow, int version) {
|
||||||
|
if (!mainWindow) return;
|
||||||
|
const QString iniPath = layoutIniPath();
|
||||||
|
if (!QFile::exists(iniPath)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
QSettings settings(iniPath, QSettings::IniFormat);
|
||||||
|
const QByteArray geometry = settings.value("MainWindow/geometry").toByteArray();
|
||||||
|
if (!geometry.isEmpty()) {
|
||||||
|
mainWindow->restoreGeometry(geometry);
|
||||||
|
}
|
||||||
|
const QByteArray state = settings.value("MainWindow/state").toByteArray();
|
||||||
|
if (!state.isEmpty()) {
|
||||||
|
mainWindow->restoreState(state, version);
|
||||||
|
}
|
||||||
|
}
|
||||||
13
src/utils/UiLayoutManager.h
Normal file
13
src/utils/UiLayoutManager.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
class QMainWindow;
|
||||||
|
|
||||||
|
class UiLayoutManager {
|
||||||
|
public:
|
||||||
|
// 保存主窗口布局到 workspace/UIState.ini
|
||||||
|
static void Save(QMainWindow* mainWindow, int version = 1);
|
||||||
|
|
||||||
|
// 从 workspace/UIState.ini 恢复布局
|
||||||
|
static void Restore(QMainWindow* mainWindow, int version = 1);
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue
Block a user