优化程序结构
This commit is contained in:
parent
c9b8f01ad2
commit
b2f7f6500b
|
|
@ -27,6 +27,7 @@ set(H_HEADER_FILES
|
|||
include/customTabBar.h
|
||||
include/functionNavigationBar.h
|
||||
include/dvieMainWindow.h
|
||||
include/dvieSecondaryWindow.h
|
||||
include/tccMainWindow.h
|
||||
include/tccToolBox.h
|
||||
include/transparentMask.h
|
||||
|
|
@ -52,6 +53,7 @@ set(CPP_SOURCE_FILES
|
|||
source/customTabBar.cpp
|
||||
source/functionNavigationBar.cpp
|
||||
source/dvieMainWindow.cpp
|
||||
source/dvieSecondaryWindow.cpp
|
||||
source/tccMainWindow.cpp
|
||||
source/tccToolBox.cpp
|
||||
source/transparentMask.cpp
|
||||
|
|
@ -71,6 +73,7 @@ set(UI_FILES
|
|||
ui/mainWindow.ui
|
||||
ui/functionNavigationBar.ui
|
||||
ui/dvieMainWindow.ui
|
||||
ui/dvieSecondaryWindow.ui
|
||||
ui/tccToolBox.ui
|
||||
ui/transparentMask.ui
|
||||
ui/messageDialog.ui
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
class QLabel;
|
||||
class QBoxLayout;
|
||||
class Dashboard;
|
||||
class CustomTab : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
@ -20,8 +21,8 @@ public:
|
|||
|
||||
void setIcon(const QIcon&);
|
||||
|
||||
void setTabBar(const QString);
|
||||
QString tabBar();
|
||||
void setDashboard(Dashboard*);
|
||||
Dashboard* dashboard();
|
||||
|
||||
signals:
|
||||
void clicked();
|
||||
|
|
@ -37,7 +38,8 @@ private:
|
|||
QLabel* m_pIconLabel;
|
||||
QLabel* m_pTitle;
|
||||
QBoxLayout* m_pLayout;
|
||||
QString m_strTabBar; //所在的tabBar
|
||||
|
||||
Dashboard* m_pDashboard; //所属于的dashboard
|
||||
|
||||
QPoint m_pStartPos;
|
||||
bool m_bLeftButtonPressed;
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public:
|
|||
CustomTabBar(QWidget *parent = nullptr);
|
||||
virtual ~CustomTabBar();
|
||||
|
||||
//void insertTab(int, CustomTab*);
|
||||
void insertTab(int, CustomTab*);
|
||||
void addTab(CustomTab*);
|
||||
void removeTab(CustomTab*);
|
||||
CustomTab* tab(int);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "qboxlayout.h"
|
||||
#include <QObject>
|
||||
|
||||
class DashboardFrame;
|
||||
class CustomTab;
|
||||
class QMenu;
|
||||
class DataPanel;
|
||||
|
|
@ -17,6 +18,8 @@ public:
|
|||
|
||||
const QString& getName();
|
||||
void setName(const QString&);
|
||||
void setFrame(DashboardFrame*);
|
||||
DashboardFrame* frame();
|
||||
void setDisplayAreaLayout(QHBoxLayout*);
|
||||
CustomTab* tab();
|
||||
QWidget* displayArea();
|
||||
|
|
@ -38,6 +41,7 @@ signals:
|
|||
|
||||
private:
|
||||
QString m_strName;
|
||||
DashboardFrame* m_pFrame;
|
||||
CustomTab* m_pTab;
|
||||
QMenu* m_pTabMenu;
|
||||
QWidget* m_pDisplayArea;
|
||||
|
|
|
|||
|
|
@ -31,21 +31,28 @@ class DashboardFrame : public QWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DashboardFrame(QWidget *parent = nullptr);
|
||||
DashboardFrame(const QString&, QWidget *parent = nullptr);
|
||||
~DashboardFrame();
|
||||
|
||||
CustomTabBar* tabBar();
|
||||
|
||||
void setType(dashboardFrame::frameType);
|
||||
void addDashboard(const QString&);
|
||||
void insertDashboard(int, Dashboard*);
|
||||
void removeDashboard(const QString&, bool);
|
||||
|
||||
private:
|
||||
void showTransparentMask();
|
||||
void hideTransparentMask();
|
||||
|
||||
void addDashboard(const QString&);
|
||||
void setCurrentDashboard(const QString&);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject*, QEvent*);
|
||||
bool eventFilter(QObject*, QEvent*) override;
|
||||
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||
//void dragMoveEvent(QDragMoveEvent* event) override;
|
||||
void dragLeaveEvent(QDragLeaveEvent* event) override;
|
||||
void dropEvent(QDropEvent* event) override;
|
||||
|
||||
public:
|
||||
void showMessageDialog(MessageDialogType,const QString&,const QString&);
|
||||
|
|
@ -72,6 +79,7 @@ public slots:
|
|||
|
||||
private:
|
||||
Ui::dashboardFrame* ui;
|
||||
QString m_strName;
|
||||
dashboardFrame::frameType m_type;
|
||||
QWidget* m_pParentWindow;
|
||||
TransparentMask* m_pTransparentMask;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ class dvieMainWindow;
|
|||
QT_END_NAMESPACE
|
||||
|
||||
class DashboardFrame;
|
||||
class DvieSecondaryWindow;
|
||||
|
||||
class DvieMainWindow : public QMainWindow
|
||||
{
|
||||
|
|
@ -19,10 +20,13 @@ public:
|
|||
DvieMainWindow(QWidget *parent = nullptr);
|
||||
~DvieMainWindow();
|
||||
|
||||
public slots:
|
||||
|
||||
|
||||
private:
|
||||
Ui::dvieMainWindow* ui;
|
||||
DashboardFrame* m_pDashboardFrame;
|
||||
Ui::dvieMainWindow* ui;
|
||||
DashboardFrame* m_pDashboardFrame;
|
||||
QList<DvieSecondaryWindow*> m_listSecondaryWindow;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
#ifndef DVIESECONDARYWINDOW_H
|
||||
#define DVIESECONDARYWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
namespace Ui {
|
||||
class dvieSecondaryWindow;
|
||||
}
|
||||
QT_END_NAMESPACE
|
||||
|
||||
class DashboardFrame;
|
||||
|
||||
class DvieSecondaryWindow : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DvieSecondaryWindow(const QString&, QWidget *parent = nullptr);
|
||||
~DvieSecondaryWindow();
|
||||
|
||||
|
||||
private:
|
||||
Ui::dvieSecondaryWindow* ui;
|
||||
QString m_strName;
|
||||
DashboardFrame* m_pDashboardFrame;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -1,4 +1,7 @@
|
|||
#include "customTab.h"
|
||||
#include "customTabBar.h"
|
||||
#include "dashboard.h"
|
||||
#include "dashboardFrame.h"
|
||||
#include <QLabel>
|
||||
#include <QBoxLayout>
|
||||
#include <QMouseEvent>
|
||||
|
|
@ -18,6 +21,8 @@ CustomTab::CustomTab(QWidget* parent)
|
|||
" background-color:transparent;\n"
|
||||
"}\n");
|
||||
|
||||
m_pDashboard = nullptr;
|
||||
|
||||
m_bLeftButtonPressed = false;
|
||||
m_bDragging = false;
|
||||
|
||||
|
|
@ -40,8 +45,6 @@ CustomTab::CustomTab(QWidget* parent)
|
|||
m_pLayout->addWidget(m_pTitle);
|
||||
m_pLayout->addLayout(iconLayout);
|
||||
setLayout(m_pLayout);
|
||||
|
||||
m_strTabBar = "";
|
||||
}
|
||||
|
||||
CustomTab::~CustomTab()
|
||||
|
|
@ -71,10 +74,10 @@ void CustomTab::mouseMoveEvent(QMouseEvent* event)
|
|||
|
||||
QByteArray data;
|
||||
QDataStream dataStream(&data, QIODevice::WriteOnly);
|
||||
dataStream << text() << m_strTabBar;
|
||||
dataStream << text() << m_pDashboard->frame()->tabBar()->objectName();
|
||||
|
||||
QMimeData *mimeData = new QMimeData;
|
||||
mimeData->setData("customTabDrag", data);
|
||||
mimeData->setData("dragData/customTab", data);
|
||||
|
||||
QDrag* drag = new QDrag(this);
|
||||
drag->setMimeData(mimeData);
|
||||
|
|
@ -83,10 +86,16 @@ void CustomTab::mouseMoveEvent(QMouseEvent* event)
|
|||
|
||||
m_bDragging = true;
|
||||
Qt::DropAction dropAction = drag->exec();
|
||||
qDebug() << dropAction;
|
||||
//exec之后的语句都会在drg操作完成之后(鼠标抬起)执行
|
||||
delete drag;
|
||||
m_bLeftButtonPressed = false;
|
||||
m_bDragging = false;
|
||||
|
||||
if(dropAction == Qt::IgnoreAction) //创建新的dvieSecondaryWindow
|
||||
{
|
||||
qDebug() << "create dvieSecondaryWindow on" << QCursor::pos();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -159,11 +168,12 @@ void CustomTab::setIcon(const QIcon& icon)
|
|||
m_pIconLabel->setPixmap(icon.pixmap(m_IconSize));
|
||||
}
|
||||
|
||||
void CustomTab::setTabBar(const QString strBar)
|
||||
void CustomTab::setDashboard(Dashboard* dashboard)
|
||||
{
|
||||
m_strTabBar = strBar;
|
||||
m_pDashboard = dashboard;
|
||||
}
|
||||
QString CustomTab::tabBar()
|
||||
Dashboard* CustomTab::dashboard()
|
||||
{
|
||||
return m_strTabBar;
|
||||
return m_pDashboard;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@ CustomTabBar::~CustomTabBar()
|
|||
void CustomTabBar::dragEnterEvent(QDragEnterEvent* event)
|
||||
{
|
||||
const QMimeData* mimeData = event->mimeData();
|
||||
if( mimeData->hasFormat("customTabDrag") )
|
||||
if( mimeData->hasFormat("dragData/customTab") )
|
||||
{
|
||||
event->acceptProposedAction();
|
||||
//qDebug() << "dragEnterEvent";
|
||||
//qDebug() << "dragEnterEvent-tabBar";
|
||||
}
|
||||
else
|
||||
event->ignore();
|
||||
|
|
@ -89,7 +89,7 @@ void CustomTabBar::dragMoveEvent(QDragMoveEvent* event)
|
|||
}
|
||||
}
|
||||
|
||||
qDebug() << toIndex;
|
||||
//qDebug() << toIndex;
|
||||
if(toIndex != -1)
|
||||
{
|
||||
m_pPosMarking->show();
|
||||
|
|
@ -99,33 +99,52 @@ void CustomTabBar::dragMoveEvent(QDragMoveEvent* event)
|
|||
|
||||
void CustomTabBar::dragLeaveEvent(QDragLeaveEvent* event)
|
||||
{
|
||||
qDebug() << "dragLeaveEvent";
|
||||
//qDebug() << "dragLeaveEvent-tabBar";
|
||||
if(m_pPosMarking->isVisible())
|
||||
{
|
||||
m_pPosMarking->hide();
|
||||
m_pTabsLayout->removeWidget(m_pPosMarking);
|
||||
}
|
||||
}
|
||||
|
||||
void CustomTabBar::dropEvent(QDropEvent* event)
|
||||
{
|
||||
//qDebug() << "dropEvent";
|
||||
//qDebug() << "dropEvent-tabBar";
|
||||
event->setDropAction(Qt::MoveAction);
|
||||
event->accept();
|
||||
|
||||
int toIndex = m_pTabsLayout->indexOf(m_pPosMarking);
|
||||
m_pPosMarking->hide();
|
||||
m_pTabsLayout->removeWidget(m_pPosMarking);
|
||||
|
||||
CustomTab* sourceObj = qobject_cast<CustomTab*>(event->source());
|
||||
if(!sourceObj)
|
||||
return;
|
||||
int fromIndex = m_pTabsLayout->indexOf(sourceObj);
|
||||
QByteArray itemData = event->mimeData()->data("dragData/customTab");
|
||||
QDataStream dataStream(&itemData, QIODevice::ReadOnly);
|
||||
QString strTabText = "";
|
||||
QString strFromBar = "";
|
||||
dataStream >> strTabText >> strFromBar;
|
||||
|
||||
if(toIndex > fromIndex)//因为被移动的tab要先remove出来再insert,如果是向后移动,remove会引起索引的变化,所以要-1
|
||||
toIndex -= 1;
|
||||
|
||||
if(toIndex != fromIndex) //移动
|
||||
if(strFromBar == objectName()) //同一组的tab,做移动操作
|
||||
{
|
||||
m_pTabsLayout->removeWidget(sourceObj);
|
||||
m_pTabsLayout->insertWidget(toIndex, sourceObj);
|
||||
emit tabMoved(fromIndex, toIndex);
|
||||
}
|
||||
CustomTab* sourceObj = qobject_cast<CustomTab*>(event->source());
|
||||
if(!sourceObj)
|
||||
return;
|
||||
int fromIndex = m_pTabsLayout->indexOf(sourceObj);
|
||||
|
||||
qDebug() << fromIndex << toIndex;
|
||||
if(toIndex > fromIndex)//因为被移动的tab要先remove出来再insert,如果是向后移动,remove会引起索引的变化,所以要-1
|
||||
toIndex -= 1;
|
||||
|
||||
if(toIndex != fromIndex) //移动
|
||||
{
|
||||
m_pTabsLayout->removeWidget(sourceObj);
|
||||
m_pTabsLayout->insertWidget(toIndex, sourceObj);
|
||||
emit tabMoved(fromIndex, toIndex);
|
||||
}
|
||||
//qDebug() << fromIndex << toIndex;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
int CustomTabBar::count()
|
||||
|
|
@ -134,7 +153,7 @@ int CustomTabBar::count()
|
|||
return m_pTabsLayout->count() - 1;
|
||||
}
|
||||
|
||||
/*void CustomTabBar::insertTab(int index, CustomTab* tab)
|
||||
void CustomTabBar::insertTab(int index, CustomTab* tab)
|
||||
{
|
||||
if(index < 0)
|
||||
index = 0;
|
||||
|
|
@ -142,15 +161,12 @@ int CustomTabBar::count()
|
|||
index = count();
|
||||
|
||||
m_pTabsLayout->insertWidget(index, tab);
|
||||
ensureWidgetVisible(tab); //定位到可以显示该tab
|
||||
m_nCurrentIndex = index;
|
||||
}*/
|
||||
ensureWidgetVisible(tab); //定位到可以显示该tab的位置
|
||||
}
|
||||
|
||||
void CustomTabBar::addTab(CustomTab* tab)
|
||||
{
|
||||
m_pTabsLayout->insertWidget(count(), tab);
|
||||
ensureWidgetVisible(tab); //定位到可以显示该tab
|
||||
tab->setTabBar(objectName());
|
||||
insertTab(count(), tab);
|
||||
}
|
||||
void CustomTabBar::removeTab(CustomTab* tab)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#include "dashboard.h"
|
||||
#include "dashboardFrame.h"
|
||||
#include "dataPanel.h"
|
||||
#include "customTab.h"
|
||||
|
||||
|
|
@ -12,11 +13,12 @@
|
|||
Dashboard::Dashboard(const QString& strName, QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
m_pFrame = nullptr;
|
||||
//displayArea
|
||||
m_pDisplayArea = new QWidget();
|
||||
m_pDisplayArea->setObjectName("displayArea");
|
||||
m_pDisplayAreaLayout = nullptr;
|
||||
//m_pDisplayArea->setObjectName("displayArea");
|
||||
//m_pDisplayArea->setStyleSheet("QWidget #displayArea {background-color: rgb(18, 25, 30);}");
|
||||
m_pDisplayAreaLayout = nullptr;
|
||||
//tab,自适应text内容
|
||||
m_pTab = new CustomTab();
|
||||
//m_pTabButton->setIcon(QIcon(":/images/btn_float_default.png"));
|
||||
|
|
@ -80,6 +82,16 @@ void Dashboard::setName(const QString& strName)
|
|||
m_pTab->setText(strName);
|
||||
}
|
||||
|
||||
void Dashboard::setFrame(DashboardFrame* frame)
|
||||
{
|
||||
m_pFrame = frame;
|
||||
setParent(m_pFrame);
|
||||
}
|
||||
DashboardFrame* Dashboard::frame()
|
||||
{
|
||||
return m_pFrame;
|
||||
}
|
||||
|
||||
void Dashboard::setDisplayAreaLayout(QHBoxLayout* pLayout)
|
||||
{
|
||||
m_pDisplayAreaLayout = pLayout;
|
||||
|
|
|
|||
|
|
@ -12,8 +12,9 @@
|
|||
#include <QKeyEvent>
|
||||
#include <QMenu>
|
||||
#include <QDateTime>
|
||||
#include <QMimeData>
|
||||
|
||||
DashboardFrame::DashboardFrame(QWidget *parent)
|
||||
DashboardFrame::DashboardFrame(const QString& strName, QWidget *parent)
|
||||
: QWidget(parent)
|
||||
, ui(new Ui::dashboardFrame)
|
||||
, m_pParentWindow(nullptr)
|
||||
|
|
@ -26,7 +27,9 @@ DashboardFrame::DashboardFrame(QWidget *parent)
|
|||
, m_pPanelSelectionDialog(nullptr)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setAcceptDrops(true);
|
||||
|
||||
m_strName = strName;
|
||||
m_pParentWindow = parent;
|
||||
m_type = dashboardFrame::ft_main;
|
||||
|
||||
|
|
@ -37,7 +40,7 @@ DashboardFrame::DashboardFrame(QWidget *parent)
|
|||
connect(m_pDateTimeWidget, SIGNAL(viewHistoricalData(QDateTime)), this, SLOT(onSignal_viewHistoricalData(QDateTime)));
|
||||
|
||||
m_pDashboardTabBar = new CustomTabBar(this);
|
||||
m_pDashboardTabBar->setObjectName("mainWindow_Bar");
|
||||
m_pDashboardTabBar->setObjectName(strName + "_tabBar");
|
||||
ui->hLayout_dashboardTabBar->addWidget(m_pDashboardTabBar);
|
||||
connect(m_pDashboardTabBar, SIGNAL(tabMoved(int, int)), this, SLOT(onSignal_dashboardTabMoved(int, int)));
|
||||
|
||||
|
|
@ -52,6 +55,11 @@ DashboardFrame::~DashboardFrame()
|
|||
delete ui;
|
||||
}
|
||||
|
||||
CustomTabBar* DashboardFrame::tabBar()
|
||||
{
|
||||
return m_pDashboardTabBar;
|
||||
}
|
||||
|
||||
void DashboardFrame::setType(dashboardFrame::frameType type)
|
||||
{
|
||||
if(type == dashboardFrame::ft_secondary) //只有主window具有报警提示
|
||||
|
|
@ -80,6 +88,39 @@ bool DashboardFrame::eventFilter(QObject* obj, QEvent* event)
|
|||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
void DashboardFrame::dragEnterEvent(QDragEnterEvent* event)
|
||||
{
|
||||
const QMimeData* mimeData = event->mimeData();
|
||||
if( mimeData->hasFormat("dragData/cutomTab") )
|
||||
{
|
||||
event->acceptProposedAction();
|
||||
//qDebug() << "dragEnterEvent-frame";
|
||||
}
|
||||
else
|
||||
event->ignore();
|
||||
}
|
||||
void DashboardFrame::dragLeaveEvent(QDragLeaveEvent* event)
|
||||
{
|
||||
//qDebug() << "dragLeaveEvent-frame";
|
||||
}
|
||||
void DashboardFrame::dropEvent(QDropEvent* event)
|
||||
{
|
||||
//qDebug() << "dropEvent-frame";
|
||||
event->setDropAction(Qt::MoveAction);
|
||||
event->accept();
|
||||
|
||||
QByteArray itemData = event->mimeData()->data("dragData/cutomTab");
|
||||
QDataStream dataStream(&itemData, QIODevice::ReadOnly);
|
||||
QString strTabText = "";
|
||||
QString strFromBar = "";
|
||||
dataStream >> strTabText >> strFromBar;
|
||||
|
||||
if(strFromBar != m_pDashboardTabBar->objectName()) //来自别的frame
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void DashboardFrame::showTransparentMask()
|
||||
{
|
||||
if(m_pTransparentMask == nullptr)
|
||||
|
|
@ -125,17 +166,41 @@ void DashboardFrame::showMessageDialog(MessageDialogType type,const QString& str
|
|||
|
||||
void DashboardFrame::addDashboard(const QString& strName)
|
||||
{
|
||||
Dashboard* dashboard = new Dashboard(strName, this);
|
||||
Dashboard* dashboard = new Dashboard(strName);
|
||||
insertDashboard(m_listDashboard.count(), dashboard);
|
||||
// connect(dashboard, SIGNAL(sgl_rename()), this, SLOT(onSignal_renameDashboard()));
|
||||
// connect(dashboard, SIGNAL(sgl_remove()), this, SLOT(onSignal_removeDashboard()));
|
||||
// dashboard->setDisplayAreaLayout(ui->hLayout_dashboardDisplayArea);
|
||||
|
||||
// //添加tab
|
||||
// CustomTab* tab = dashboard->tab();
|
||||
// m_pDashboardTabBar->addTab(tab);
|
||||
// connect(tab, SIGNAL(clicked()), this, SLOT(onBtnClicked_dashboardTab()));
|
||||
|
||||
// m_listDashboard.push_back(dashboard);
|
||||
// if(m_curActiveDashboard)
|
||||
// m_curActiveDashboard->setActive(false);
|
||||
// dashboard->setActive(true);
|
||||
// m_curActiveDashboard = dashboard;
|
||||
}
|
||||
void DashboardFrame::insertDashboard(int index, Dashboard* dashboard)
|
||||
{
|
||||
if(index < 0)
|
||||
index = 0;
|
||||
else if(index > m_listDashboard.count())
|
||||
index = m_listDashboard.count();
|
||||
|
||||
dashboard->setFrame(this);
|
||||
connect(dashboard, SIGNAL(sgl_rename()), this, SLOT(onSignal_renameDashboard()));
|
||||
connect(dashboard, SIGNAL(sgl_remove()), this, SLOT(onSignal_removeDashboard()));
|
||||
dashboard->setDisplayAreaLayout(ui->hLayout_dashboardDisplayArea);
|
||||
|
||||
//添加tab
|
||||
CustomTab* tab = dashboard->tab();
|
||||
m_pDashboardTabBar->addTab(tab);
|
||||
m_pDashboardTabBar->insertTab(index, tab);
|
||||
connect(tab, SIGNAL(clicked()), this, SLOT(onBtnClicked_dashboardTab()));
|
||||
|
||||
m_listDashboard.push_back(dashboard);
|
||||
m_listDashboard.insert(index, dashboard);
|
||||
if(m_curActiveDashboard)
|
||||
m_curActiveDashboard->setActive(false);
|
||||
dashboard->setActive(true);
|
||||
|
|
@ -187,6 +252,10 @@ void DashboardFrame::removeDashboard(const QString& strName, bool bDelete) //右
|
|||
dashboard->deleteSubWidgets();
|
||||
delete dashboard;
|
||||
}
|
||||
else
|
||||
{
|
||||
dashboard->disconnect(this); //断开和当前frame的信号/槽链接
|
||||
}
|
||||
}
|
||||
|
||||
void DashboardFrame::setCurrentDashboard(const QString& strName)
|
||||
|
|
|
|||
|
|
@ -9,8 +9,10 @@ DvieMainWindow::DvieMainWindow(QWidget *parent)
|
|||
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setProperty("windowType", "main");
|
||||
|
||||
m_pDashboardFrame = new DashboardFrame(this);
|
||||
m_pDashboardFrame = new DashboardFrame("mainDvie", this);
|
||||
m_pDashboardFrame->setType(dashboardFrame::ft_main);
|
||||
ui->centralLayout->addWidget(m_pDashboardFrame);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
#include "dvieSecondaryWindow.h"
|
||||
#include "./ui_dvieSecondaryWindow.h"
|
||||
#include "dashboardFrame.h"
|
||||
|
||||
DvieSecondaryWindow::DvieSecondaryWindow(const QString& strName, QWidget *parent)
|
||||
: QMainWindow(parent)
|
||||
, ui(new Ui::dvieSecondaryWindow)
|
||||
, m_pDashboardFrame(nullptr)
|
||||
|
||||
{
|
||||
ui->setupUi(this);
|
||||
setProperty("windowType", "secondary");
|
||||
|
||||
m_strName = strName;
|
||||
|
||||
QString strDashboard = strName + "_dashboard";
|
||||
m_pDashboardFrame = new DashboardFrame(strDashboard, this);
|
||||
m_pDashboardFrame->setType(dashboardFrame::ft_secondary);
|
||||
ui->centralLayout->addWidget(m_pDashboardFrame);
|
||||
}
|
||||
|
||||
DvieSecondaryWindow::~DvieSecondaryWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="hLayoutToolBar">
|
||||
<layout class="QHBoxLayout" name="hLayoutToolBar" stretch="1,0,0">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,218 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>dvieSecondaryWindow</class>
|
||||
<widget class="QMainWindow" name="dvieSecondaryWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1544</width>
|
||||
<height>956</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QScrollBar:vertical
|
||||
{
|
||||
width:5px;
|
||||
border:0px;
|
||||
padding-top:10px;
|
||||
padding-bottom:10px;
|
||||
background-color: transparent;
|
||||
}
|
||||
QScrollBar::handle:vertical
|
||||
{
|
||||
background-color: rgb(83, 90, 117);
|
||||
}
|
||||
QScrollBar::handle:vertical:hover
|
||||
{
|
||||
background-color: rgb(100, 109, 141);
|
||||
}
|
||||
QScrollBar::handle:vertical:pressed
|
||||
{
|
||||
background-color: rgb(83, 90, 117);
|
||||
}
|
||||
QScrollBar::add-page:vertical,
|
||||
QScrollBar::sub-page:vertical
|
||||
{
|
||||
background-color: transparent;
|
||||
}
|
||||
QScrollBar::add-line:vertical
|
||||
{
|
||||
background-color: transparent;
|
||||
}
|
||||
QScrollBar::add-line:vertical:hover
|
||||
{
|
||||
}
|
||||
QScrollBar::add-line:vertical:pressed
|
||||
{
|
||||
}
|
||||
QScrollBar::sub-line:vertical
|
||||
{
|
||||
background-color: transparent;
|
||||
}
|
||||
QScrollBar::sub-line:vertical:hover
|
||||
{
|
||||
}
|
||||
QScrollBar::sub-line:vertical:pressed
|
||||
{
|
||||
}
|
||||
|
||||
QScrollBar:horizontal
|
||||
{
|
||||
height:5px;
|
||||
border:0px;
|
||||
padding-left:10px;
|
||||
padding-right:10px;
|
||||
background-color: transparent;
|
||||
}
|
||||
QScrollBar::handle:horizontal
|
||||
{
|
||||
background-color: rgb(83, 90, 117);
|
||||
}
|
||||
QScrollBar::handle:horizontal:hover
|
||||
{
|
||||
background-color: rgb(100, 109, 141);
|
||||
}
|
||||
QScrollBar::handle:horizontal:pressed
|
||||
{
|
||||
background-color: rgb(83, 90, 117);
|
||||
}
|
||||
QScrollBar::add-page:horizontal,
|
||||
QScrollBar::sub-page:horizontal
|
||||
{
|
||||
background-color: transparent;
|
||||
}
|
||||
QScrollBar::add-line:horizontal
|
||||
{
|
||||
background-color: transparent;
|
||||
}
|
||||
QScrollBar::add-line:horizontal:hover
|
||||
{
|
||||
}
|
||||
QScrollBar::add-line:horizontal:pressed
|
||||
{
|
||||
}
|
||||
QScrollBar::sub-line:horizontal
|
||||
{
|
||||
background-color: transparent;
|
||||
}
|
||||
QScrollBar::sub-line:horizontal:hover
|
||||
{
|
||||
}
|
||||
QScrollBar::sub-line:horizontal:pressed
|
||||
{
|
||||
}</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QWidget #centralwidget
|
||||
{
|
||||
background-color: rgb(18, 25, 30);
|
||||
}</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="centralLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</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="topWidget" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>45</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QWidget #topWidget
|
||||
{
|
||||
background-color:rgb(6, 91, 143);
|
||||
}</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>15</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelSystemTitle">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">color: rgb(250, 250, 250);
|
||||
font: 700 12pt "微软雅黑";</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>DVIE数据监控</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Orientation::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>776</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="topToolPanel" native="true">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>550</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>550</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resource/PowerMaster.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
||||
Loading…
Reference in New Issue