添加dataPanel配置窗口

This commit is contained in:
duanshengchao 2025-01-14 18:39:52 +08:00
parent ef2a086495
commit 5a92f5cb90
12 changed files with 643 additions and 5 deletions

View File

@ -85,6 +85,7 @@ set(UI_FILES
ui/panelToolWidget.ui ui/panelToolWidget.ui
ui/dateTimeWidget.ui ui/dateTimeWidget.ui
ui/dateTimeSelectionPanel.ui ui/dateTimeSelectionPanel.ui
ui/dpConfigurationDialog.ui
) )
set(UTIL_FILES set(UTIL_FILES
@ -103,6 +104,8 @@ set(UTIL_FILES
set(DATAPANEL_FILES set(DATAPANEL_FILES
dataPanel/dpGlobals.h dataPanel/dpGlobals.h
dataPanel/dpConfigurationDialog.h
dataPanel/dpConfigurationDialog.cpp
dataPanel/dpBaseWidget.h dataPanel/dpBaseWidget.h
dataPanel/dpBaseWidget.cpp dataPanel/dpBaseWidget.cpp
dataPanel/dpLineChart.h dataPanel/dpLineChart.h

View File

@ -0,0 +1,100 @@
#include "dpConfigurationDialog.h"
#include "ui_dpConfigurationDialog.h"
#include "dataPanel.h"
dpConfigurationDialog::dpConfigurationDialog(QWidget *parent)
: QDialog(parent)
, ui(new Ui::dpConfigurationDialog)
, m_curActiveTab(nullptr)
, m_pDataPanel(nullptr)
{
ui->setupUi(this);
setWindowFlags(Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus);
setAttribute(Qt::WA_TranslucentBackground);
initialize();
}
dpConfigurationDialog::~dpConfigurationDialog()
{
delete ui;
}
void dpConfigurationDialog::initialize()
{
ui->tabDataType->setProperty("index", 0);
connect(ui->tabDataType, SIGNAL(clicked()), this, SLOT(onBtnClicked_tabBtn()));
ui->tabDataSource->setProperty("index", 1);
connect(ui->tabDataSource, SIGNAL(clicked()), this, SLOT(onBtnClicked_tabBtn()));
ui->tabDisplaySetting->setProperty("index", 2);
connect(ui->tabDisplaySetting, SIGNAL(clicked()), this, SLOT(onBtnClicked_tabBtn()));
m_curActiveTab = ui->tabDataType;
ui->stackedWidget->setCurrentIndex(0);
connect(ui->btnConfirm, SIGNAL(clicked()), this, SLOT(onBtnClicked_confirm()));
connect(ui->btnCancle, SIGNAL(clicked()), this, SLOT(onBtnClicked_cancle()));
}
void dpConfigurationDialog::setPanel(DataPanel* pPanel)
{
m_pDataPanel = pPanel;
}
void dpConfigurationDialog::onBtnClicked_tabBtn()
{
QPushButton* pTab = qobject_cast<QPushButton*>(sender());
if(pTab == m_curActiveTab)
return;
if(m_curActiveTab)
{
m_curActiveTab->setStyleSheet("QPushButton\n"
"{\n"
"color: rgb(250, 250, 250);\n"
"font: 700 12pt \"黑体\";\n"
"border:0px;\n"
"background-color:transparent;\n"
"}\n"
"QPushButton:hover\n"
"{\n"
"}\n"
"QPushButton:pressed\n"
"{\n"
"}");
}
if(pTab)
{
pTab->setStyleSheet("QPushButton\n"
"{\n"
"color: rgb(250, 250, 250);\n"
"font: 700 12pt \"黑体\";\n"
"border:1px solid rgb(200,200,200);\n"
"border-bottom:0px;\n"
"background-color:rgba(36,43,50, 250);\n"
"}\n"
"QPushButton:hover\n"
"{\n"
"}\n"
"QPushButton:pressed\n"
"{\n"
"}");
int nIndex = pTab->property("index").toInt();
ui->stackedWidget->setCurrentIndex(nIndex);
}
m_curActiveTab = pTab;
}
void dpConfigurationDialog::onBtnClicked_confirm()
{
hide();
emit sgl_hide();
}
void dpConfigurationDialog::onBtnClicked_cancle()
{
hide();
emit sgl_hide();
}

View File

@ -0,0 +1,42 @@
#ifndef DPCONFIGURATIONDIALOG_H
#define DPCONFIGURATIONDIALOG_H
#include <QDialog>
QT_BEGIN_NAMESPACE
namespace Ui {
class dpConfigurationDialog;
}
QT_END_NAMESPACE
class DataPanel;
class dpConfigurationDialog : public QDialog
{
Q_OBJECT
public:
dpConfigurationDialog(QWidget *parent = nullptr);
~dpConfigurationDialog();
void setPanel(DataPanel*);
signals:
void sgl_hide();
public slots:
void onBtnClicked_tabBtn();
void onBtnClicked_confirm();
void onBtnClicked_cancle();
private:
void initialize();
Ui::dpConfigurationDialog* ui;
QPushButton* m_curActiveTab;
DataPanel* m_pDataPanel;
};
#endif

View File

@ -10,6 +10,7 @@ class DashboardFrame;
class CustomTab; class CustomTab;
class QMenu; class QMenu;
class DataPanel; class DataPanel;
class Dashboard : public QObject class Dashboard : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -39,6 +40,7 @@ public slots:
void onAction_remove(); void onAction_remove();
void onSignal_removePanel(const QString&); void onSignal_removePanel(const QString&);
void onSignal_openConfigurationDlg(DataPanel*);
signals: signals:
void sgl_rename(); void sgl_rename();

View File

@ -20,6 +20,8 @@ class DashboardNamingDialog;
class PanelSelectionDialog; class PanelSelectionDialog;
class DateTimeWidget; class DateTimeWidget;
class TimeLineWidget; class TimeLineWidget;
class DataPanel;
class dpConfigurationDialog;
namespace dashboardFrame { namespace dashboardFrame {
enum frameType enum frameType
@ -46,6 +48,7 @@ public:
DashboardFrame* getDashboardFrame(const QString&); DashboardFrame* getDashboardFrame(const QString&);
void setDashboardAreaHighlight(bool); void setDashboardAreaHighlight(bool);
void moveDashboardToNewDVIEWindow(const QString&, QPoint); void moveDashboardToNewDVIEWindow(const QString&, QPoint);
void openPanelConfigurationDialog(DataPanel*);
protected: protected:
bool eventFilter(QObject*, QEvent*) override; bool eventFilter(QObject*, QEvent*) override;
@ -106,6 +109,8 @@ private:
DateTimeWidget* m_pDateTimeWidget; DateTimeWidget* m_pDateTimeWidget;
TimeLineWidget* m_pTimeLineWidget; TimeLineWidget* m_pTimeLineWidget;
dpConfigurationDialog* m_pPanelConfigurationDialog;
QTimer* m_pTimer_RealTime; QTimer* m_pTimer_RealTime;
}; };

View File

@ -85,8 +85,11 @@ public slots:
void onAboutToHide_toolMenu(); void onAboutToHide_toolMenu();
void onSignal_configure();
signals: signals:
void sgl_remove(const QString&); void sgl_remove(const QString&);
void sgl_openCofigurationDialog(DataPanel*);
private: private:
void setupScrollArea(); void setupScrollArea();

View File

@ -33,7 +33,7 @@ signals:
void sgl_funBtnClicke(QString); void sgl_funBtnClicke(QString);
private: private:
void initialzie(); void initialize();
Ui::functionNavigationBar* ui; Ui::functionNavigationBar* ui;
QPushButton* m_pLastFunButton; QPushButton* m_pLastFunButton;

View File

@ -139,6 +139,7 @@ void Dashboard::addPanel(DataPanelType type)
{ {
DataPanel* panel = new DataPanel(m_pDisplayArea, type); DataPanel* panel = new DataPanel(m_pDisplayArea, type);
connect(panel, SIGNAL(sgl_remove(const QString&)), this, SLOT(onSignal_removePanel(const QString&))); connect(panel, SIGNAL(sgl_remove(const QString&)), this, SLOT(onSignal_removePanel(const QString&)));
connect(panel, SIGNAL(sgl_openCofigurationDialog(DataPanel*)), this, SLOT(onSignal_openConfigurationDlg(DataPanel*)));
QString strDefaultName = "dataPanel-" + QString::number(m_nPanenlNameNumber); QString strDefaultName = "dataPanel-" + QString::number(m_nPanenlNameNumber);
m_nPanenlNameNumber++; m_nPanenlNameNumber++;
panel->setName(strDefaultName); panel->setName(strDefaultName);
@ -210,3 +211,9 @@ void Dashboard::onSignal_removePanel(const QString& strName)
{ {
removePanel(strName); removePanel(strName);
} }
void Dashboard::onSignal_openConfigurationDlg(DataPanel* pPanel)
{
if(m_pFrame)
m_pFrame->openPanelConfigurationDialog(pPanel);
}

View File

@ -7,8 +7,10 @@
#include "customTabBar.h" #include "customTabBar.h"
#include "dashboard.h" #include "dashboard.h"
#include "customTab.h" #include "customTab.h"
#include "dataPanel.h"
#include "dashboardNamingDialog.h" #include "dashboardNamingDialog.h"
#include "panelSelectionDialog.h" #include "panelSelectionDialog.h"
#include "dataPanel/dpConfigurationDialog.h"
#include "dateTimeWidget.h" #include "dateTimeWidget.h"
#include "util/TimeLine/timeLineWidget.h" #include "util/TimeLine/timeLineWidget.h"
@ -30,6 +32,7 @@ DashboardFrame::DashboardFrame(const QString& strName, dashboardFrame::frameType
, m_curActiveDashboard(nullptr) , m_curActiveDashboard(nullptr)
, m_curOperationDashboard(nullptr) , m_curOperationDashboard(nullptr)
, m_pPanelSelectionDialog(nullptr) , m_pPanelSelectionDialog(nullptr)
, m_pPanelConfigurationDialog(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
setAcceptDrops(true); setAcceptDrops(true);
@ -451,6 +454,22 @@ void DashboardFrame::moveDashboardToNewDVIEWindow(const QString& strDashboard, Q
} }
} }
void DashboardFrame::openPanelConfigurationDialog(DataPanel* pPanel)
{
if(m_pPanelConfigurationDialog == nullptr)
{
m_pPanelConfigurationDialog = new dpConfigurationDialog(this);
connect(m_pPanelConfigurationDialog, SIGNAL(sgl_hide()), this, SLOT(onSignal_subDialogClose()));
}
showTransparentMask();
int nX = (ui->navigationPanel->width() - m_pPanelConfigurationDialog->width()) * 0.5;
int nY = ui->navigationPanel->y() + ui->navigationPanel->height() * 0.5;
m_pPanelConfigurationDialog->move(nX, nY);
m_pPanelConfigurationDialog->show();
m_pPanelConfigurationDialog->raise();
}
void DashboardFrame::onSignal_showMask() void DashboardFrame::onSignal_showMask()
{ {
showTransparentMask(); showTransparentMask();

View File

@ -54,6 +54,7 @@ DataPanel::DataPanel(QWidget *parent, DataPanelType type)
centralWidget->setLayout(m_pLayout); centralWidget->setLayout(m_pLayout);
m_pConfigurationWidget = new PanelConfigurationWidget(this); m_pConfigurationWidget = new PanelConfigurationWidget(this);
connect(m_pConfigurationWidget, SIGNAL(sgl_configure()), this, SLOT(onSignal_configure()));
m_pConfigurationWidget->raise(); m_pConfigurationWidget->raise();
//setWiget(m_pConfigurationWidget); //setWiget(m_pConfigurationWidget);
//resize(533, 300); //resize(533, 300);
@ -338,12 +339,11 @@ void DataPanel::setTimeRange(TimeUnit unit)
void DataPanel::onToolBtnClicked_setting() void DataPanel::onToolBtnClicked_setting()
{ {
emit sgl_openCofigurationDialog(this);
} }
void DataPanel::onToolBtnClicked_fullScreen() void DataPanel::onToolBtnClicked_fullScreen()
{ {
QString strCurState = m_pToolWidget->ui->btnFullScree->property("currentState").toString(); QString strCurState = m_pToolWidget->ui->btnFullScree->property("currentState").toString();
if(strCurState == "enterFullScreen") if(strCurState == "enterFullScreen")
{ {
@ -411,3 +411,8 @@ void DataPanel::onAboutToHide_toolMenu()
m_pToolWidget->hide(); m_pToolWidget->hide();
m_pCustomBorderContainer->hideBorderDraw(); m_pCustomBorderContainer->hideBorderDraw();
} }
void DataPanel::onSignal_configure()
{
emit sgl_openCofigurationDialog(this);
}

View File

@ -9,11 +9,12 @@
FunctionNavigationBar::FunctionNavigationBar(QWidget *parent) FunctionNavigationBar::FunctionNavigationBar(QWidget *parent)
: QWidget(parent) : QWidget(parent)
, ui(new Ui::functionNavigationBar) , ui(new Ui::functionNavigationBar)
, m_pLastFunButton(nullptr)
{ {
ui->setupUi(this); ui->setupUi(this);
setAttribute(Qt::WA_TranslucentBackground); setAttribute(Qt::WA_TranslucentBackground);
initialzie(); initialize();
} }
FunctionNavigationBar::~FunctionNavigationBar() FunctionNavigationBar::~FunctionNavigationBar()
@ -22,7 +23,7 @@ FunctionNavigationBar::~FunctionNavigationBar()
} }
void FunctionNavigationBar::initialzie() void FunctionNavigationBar::initialize()
{ {
ui->funBtn_Dvie->setProperty("skin", "icon_dashboard"); ui->funBtn_Dvie->setProperty("skin", "icon_dashboard");
ui->funBtn_Dvie->setProperty("funName", "DVIE"); ui->funBtn_Dvie->setProperty("funName", "DVIE");

451
ui/dpConfigurationDialog.ui Normal file
View File

@ -0,0 +1,451 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>dpConfigurationDialog</class>
<widget class="QDialog" name="dpConfigurationDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>569</width>
<height>505</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<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="contentWidget" native="true">
<property name="styleSheet">
<string notr="true">QWidget #contentWidget
{
border:1px solid rgb(76,88,105);
background-color:rgba(36,43,50,250);
}
QLabel
{
font: 12pt &quot;黑体&quot;;
}
QLineEdit
{
font: 12pt &quot;黑体&quot;;
border:1px solid rgb(200,200,200);
background:transparent;
}
QLineEdit:focus
{
border:1px solid rgb(67,160,249);
}
QTreeView
{
padding-top:6px;
font: 12pt &quot;黑体&quot;;
color: rgb(250, 250, 250);
border:0px;
border-top:1px solid rgb(200,200,200);
border-bottom:1px solid rgb(200,200,200);
background-color:rgba(25,25,25,200);
}
QTreeView::branch
{
image:none;
}
QTreeView::item
{
height:25px;
}
QTreeView::item:selected {
color: rgb(250, 250, 250);
background-color: transparent;
border:0px;
}
QTreeView::item:hover {
background-color: rgba(67,160,249, 30);
border:0px;
}
QTreeView::branch:has-children:!has-siblings:closed,
QTreeView::branch:closed:has-children:has-siblings {
}
QTreeView::branch:open:has-children:!has-siblings,
QTreeView::branch:open:has-children:has-siblings {
}
QTableView
{
padding-top:6px;
font: 12pt &quot;黑体&quot;;
color: rgb(250, 250, 250);
border:0px;
border-top:1px solid rgb(200,200,200);
border-bottom:1px solid rgb(200,200,200);
background-color:rgba(25,25,25,200);
}
QTableView::item
{
height:25px;
}
QTableView::item:selected {
color: rgb(250, 250, 250);
background-color: transparent;
border:0px;
}
QTableView::item:hover {
background-color: rgba(67,160,249, 30);
border:0px;
}
QListView
{
padding-top:6px;
font: 12pt &quot;黑体&quot;;
color: rgb(250, 250, 250);
border:0px;
border-top:1px solid rgb(200,200,200);
border-bottom:1px solid rgb(200,200,200);
background-color:rgba(25,25,25,200);
}
QListView::item
{
height:25px;
}
QListView::item:selected {
color: rgb(250, 250, 250);
background-color: transparent;
border:0px;
}
QListView::item:hover {
background-color: rgba(67,160,249, 30);
border:0px;
}
</string>
</property>
<widget class="QLabel" name="labeWindowlTitle">
<property name="geometry">
<rect>
<x>25</x>
<y>25</y>
<width>521</width>
<height>31</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(250, 250, 250);
font: 700 13pt &quot;微软雅黑&quot;;
border:1px solid rgb(250,250,250);
border-left:0px;
border-top:0px;
border-right:0px;</string>
</property>
<property name="text">
<string>配置面板</string>
</property>
</widget>
<widget class="QWidget" name="tabBar" native="true">
<property name="geometry">
<rect>
<x>25</x>
<y>65</y>
<width>521</width>
<height>46</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QWidget #tabBar
{
background-color: rgb(54, 62, 74);
border-bottom:1px solid rgb(200,200,200);
}</string>
</property>
<widget class="QPushButton" name="tabDataSource">
<property name="geometry">
<rect>
<x>110</x>
<y>16</y>
<width>75</width>
<height>30</height>
</rect>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="styleSheet">
<string notr="true">QPushButton
{
color: rgb(250, 250, 250);
font: 700 12pt &quot;黑体&quot;;
border:0px;
background-color:transparent;
}
QPushButton:hover
{
}
QPushButton:pressed
{
}</string>
</property>
<property name="text">
<string>数据源</string>
</property>
</widget>
<widget class="QPushButton" name="tabDisplaySetting">
<property name="geometry">
<rect>
<x>185</x>
<y>16</y>
<width>100</width>
<height>30</height>
</rect>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="styleSheet">
<string notr="true">QPushButton
{
color: rgb(250, 250, 250);
font: 700 12pt &quot;黑体&quot;;
border:0px;
background-color:transparent;
}
QPushButton:hover
{
}
QPushButton:pressed
{
}</string>
</property>
<property name="text">
<string>显示设置</string>
</property>
</widget>
<widget class="QPushButton" name="tabDataType">
<property name="geometry">
<rect>
<x>10</x>
<y>16</y>
<width>100</width>
<height>30</height>
</rect>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="styleSheet">
<string notr="true">QPushButton
{
color: rgb(250, 250, 250);
font: 700 12pt &quot;黑体&quot;;
border:1px solid rgb(200,200,200);
border-bottom:0px;
background-color:rgba(36,43,50, 250);
}
QPushButton:hover
{
}
QPushButton:pressed
{
}</string>
</property>
<property name="text">
<string>数据类型</string>
</property>
</widget>
</widget>
<widget class="QStackedWidget" name="stackedWidget">
<property name="geometry">
<rect>
<x>25</x>
<y>120</y>
<width>521</width>
<height>331</height>
</rect>
</property>
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="pageDataType">
<property name="styleSheet">
<string notr="true">QWidget #pageDataType
{
background-color:transparent;
}</string>
</property>
<widget class="QLineEdit" name="dataTypeSearch">
<property name="geometry">
<rect>
<x>0</x>
<y>10</y>
<width>251</width>
<height>31</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
</widget>
<widget class="QListWidget" name="dataTypeList">
<property name="geometry">
<rect>
<x>0</x>
<y>55</y>
<width>251</width>
<height>261</height>
</rect>
</property>
</widget>
<widget class="QTableView" name="typeSelectedList">
<property name="geometry">
<rect>
<x>270</x>
<y>55</y>
<width>251</width>
<height>261</height>
</rect>
</property>
</widget>
</widget>
<widget class="QWidget" name="pageDataSource">
<property name="styleSheet">
<string notr="true">QWidget #pageDataSource
{
background-color:transparent;
}</string>
</property>
<widget class="QLineEdit" name="dataSourceSearch">
<property name="geometry">
<rect>
<x>0</x>
<y>10</y>
<width>251</width>
<height>31</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true"/>
</property>
</widget>
<widget class="QTreeView" name="dataSourceList">
<property name="geometry">
<rect>
<x>0</x>
<y>55</y>
<width>251</width>
<height>261</height>
</rect>
</property>
</widget>
<widget class="QTableView" name="dataSelectedList">
<property name="geometry">
<rect>
<x>270</x>
<y>55</y>
<width>251</width>
<height>261</height>
</rect>
</property>
</widget>
</widget>
<widget class="QWidget" name="pageDisplaySetting">
<property name="styleSheet">
<string notr="true">QWidget #pageDisplaySetting
{
background-color:transparent;
}</string>
</property>
</widget>
</widget>
<widget class="QPushButton" name="btnCancle">
<property name="geometry">
<rect>
<x>470</x>
<y>460</y>
<width>71</width>
<height>26</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QPushButton
{
color: rgb(250, 250, 250);
font: 700 12pt &quot;微软雅黑&quot;;
border:1px solid rgb(200,200,200);
border-radius:2px;
background-color:rgb(24,32,38);
}
QPushButton:hover
{
background-color:rgb(8,11,13);
}
QPushButton:pressed
{
background-color:rgb(24,32,38);
}</string>
</property>
<property name="text">
<string>取消</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
<widget class="QPushButton" name="btnConfirm">
<property name="geometry">
<rect>
<x>380</x>
<y>460</y>
<width>71</width>
<height>26</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QPushButton
{
color: rgb(250, 250, 250);
font: 700 12pt &quot;微软雅黑&quot;;
border:0px;
border-radius:2px;
background-color:rgb(67,160,249);
}
QPushButton:hover
{
background-color:rgb(55,131,204);
}
QPushButton:pressed
{
background-color:rgb(67,160,249);
}</string>
</property>
<property name="text">
<string>确认</string>
</property>
<property name="flat">
<bool>false</bool>
</property>
</widget>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>