优化更改dataPanel逻辑结构
This commit is contained in:
parent
9b00b92d23
commit
f7550112e4
|
|
@ -101,6 +101,13 @@ set(UTIL_FILES
|
|||
util/Chart/qcustomplot.cpp
|
||||
)
|
||||
|
||||
set(DATAPANEL_FILES
|
||||
dataPanel/dpBaseWidget.h
|
||||
dataPanel/dpBaseWidget.cpp
|
||||
dataPanel/dpLineChart.h
|
||||
dataPanel/dpLineChart.cpp
|
||||
)
|
||||
|
||||
# 包含源文件目录
|
||||
INCLUDE_DIRECTORIES(${PROJECT_SOURCE_DIR})
|
||||
|
||||
|
|
@ -111,6 +118,7 @@ if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
|
|||
${CPP_SOURCE_FILES}
|
||||
${UI_FILES}
|
||||
${UTIL_FILES}
|
||||
${DATAPANEL_FILES}
|
||||
resource/PowerMaster.qrc
|
||||
)
|
||||
# Define target properties for Android with Qt 6 as:
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ private:
|
|||
void autoSetGeometry(); //在缩放和移动时以其它panel和parent的border为依据自动调整
|
||||
|
||||
bool m_bMouseEnter;
|
||||
bool m_bConfigurationComplete;
|
||||
QString m_strName;
|
||||
QSize m_displayAreaSize;
|
||||
QRect m_curGeometry;
|
||||
|
|
|
|||
|
|
@ -32,15 +32,28 @@ DataPanel::DataPanel(QWidget *parent)
|
|||
|
||||
m_strName = "";
|
||||
m_bMouseEnter = false;
|
||||
m_bConfigurationComplete = false;
|
||||
m_pContentWidget = nullptr;
|
||||
m_pScrollArea = nullptr;
|
||||
|
||||
QWidget* centralWidget = new QWidget(this);
|
||||
centralWidget->setObjectName("centralWidget");
|
||||
centralWidget->setStyleSheet("QWidget #centralWidget{\n"
|
||||
" border:2px solid rgb(76,88,105);\n"
|
||||
" background-color:rgba(36,43,50,250);\n"
|
||||
"}\n");
|
||||
QBoxLayout* centralLayout = new QBoxLayout(QBoxLayout::TopToBottom, this);
|
||||
centralLayout->setContentsMargins(0, 0, 0, 0);
|
||||
centralLayout->addWidget(centralWidget);
|
||||
setLayout(centralLayout);
|
||||
m_pLayout = new QBoxLayout(QBoxLayout::TopToBottom, this);
|
||||
m_pLayout->setContentsMargins(0, 0, 0, 0);
|
||||
m_pLayout->setSpacing(0);
|
||||
setLayout(m_pLayout);
|
||||
centralWidget->setLayout(m_pLayout);
|
||||
|
||||
m_pConfigurationWidget = new PanelConfigurationWidget();
|
||||
setWiget(m_pConfigurationWidget);
|
||||
m_pConfigurationWidget = new PanelConfigurationWidget(this);
|
||||
m_pConfigurationWidget->raise();
|
||||
//setWiget(m_pConfigurationWidget);
|
||||
//resize(533, 300);
|
||||
|
||||
m_pCustomBorderContainer = new CustomBorderContainer(this);
|
||||
|
|
@ -76,9 +89,17 @@ bool DataPanel::event(QEvent* event)
|
|||
if (pKeyEvent->key() == Qt::Key_Escape)
|
||||
return true;
|
||||
}
|
||||
else if(event->type() == QEvent::Resize)
|
||||
else if(event->type() == QEvent::Show)
|
||||
{
|
||||
m_pToolWidget->move(this->width() - m_pToolWidget->width() - 8, 3);
|
||||
m_pConfigurationWidget->move((this->width() - m_pConfigurationWidget->width()) * 0.5, (this->height() - m_pConfigurationWidget->height()) * 0.5);
|
||||
}
|
||||
else if(event->type() == QEvent::Resize || event->type() == QEvent::Move)
|
||||
{
|
||||
if(m_pToolWidget->isVisible())
|
||||
m_pToolWidget->move(this->width() - m_pToolWidget->width() - 8, 3);
|
||||
if(m_pConfigurationWidget->isVisible())
|
||||
m_pConfigurationWidget->move((this->width() - m_pConfigurationWidget->width()) * 0.5, (this->height() - m_pConfigurationWidget->height()) * 0.5);
|
||||
}
|
||||
else if(event->type() == QEvent::MouseButtonPress)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -30,11 +30,11 @@
|
|||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="contentWidget" native="true">
|
||||
<widget class="QWidget" name="centralWidget" native="true">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QWidget #contentWidget
|
||||
<string notr="true">QWidget #centralWidget
|
||||
{
|
||||
border:1px solid rgb(76,88,105);
|
||||
border:2px solid rgb(76,88,105);
|
||||
background-color:rgba(36,43,50,250);
|
||||
}</string>
|
||||
</property>
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>710</width>
|
||||
<height>400</height>
|
||||
<width>365</width>
|
||||
<height>94</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
|
@ -37,8 +37,7 @@
|
|||
<property name="styleSheet">
|
||||
<string notr="true">QWidget #contentWidget
|
||||
{
|
||||
border:2px solid rgb(76,88,105);
|
||||
background-color:rgb(24,32,38);
|
||||
background-color:transparent;
|
||||
}</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
|
|
|
|||
Loading…
Reference in New Issue