优化ui,剔除不必要部分

TaoZhang-Branch
karlis 2023-03-08 12:16:15 +08:00
parent 368eaa6c89
commit 477517d919
4 changed files with 67 additions and 29 deletions

View File

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1139</width> <width>1139</width>
<height>685</height> <height>862</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -169,6 +169,12 @@
</item> </item>
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="minimumSize">
<size>
<width>0</width>
<height>800</height>
</size>
</property>
<property name="currentIndex"> <property name="currentIndex">
<number>0</number> <number>0</number>
</property> </property>

View File

@ -7,13 +7,22 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1124</width> <width>1124</width>
<height>695</height> <height>1010</height>
</rect> </rect>
</property> </property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="windowTitle"> <property name="windowTitle">
<string>RendererWidget</string> <string>RendererWidget</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>0</number>
</property>
<property name="leftMargin"> <property name="leftMargin">
<number>0</number> <number>0</number>
</property> </property>
@ -28,19 +37,21 @@
</property> </property>
<item> <item>
<widget class="QWidget" name="MainWindow" native="true"> <widget class="QWidget" name="MainWindow" native="true">
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="1,30"> <layout class="QVBoxLayout" name="verticalLayout_2" stretch="30">
<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> <item>
<widget class="QLabel" name="Title"> <layout class="QHBoxLayout" name="horizontalLayout" stretch="0,12,5">
<property name="text">
<string/>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,18,5">
<item> <item>
<widget class="QWidget" name="LeftBar" native="true"/> <widget class="QWidget" name="LeftBar" native="true"/>
</item> </item>
@ -49,32 +60,62 @@
</item> </item>
<item> <item>
<widget class="QWidget" name="RightBar" native="true"> <widget class="QWidget" name="RightBar" native="true">
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="1,2"> <layout class="QVBoxLayout" name="verticalLayout_4" stretch="3,2">
<property name="spacing">
<number>20</number>
</property>
<property name="leftMargin">
<number>11</number>
</property>
<property name="topMargin">
<number>11</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>11</number>
</property>
<item> <item>
<widget class="QTabWidget" name="DisplayTab"> <widget class="QTabWidget" name="DisplayTab">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="currentIndex"> <property name="currentIndex">
<number>1</number> <number>1</number>
</property> </property>
<widget class="InfoDisplayWidget" name="LayerDisplay"> <widget class="InfoDisplayWidget" name="LayerDisplay">
<attribute name="title"> <attribute name="title">
<string>Layer</string> <string>图层信息</string>
</attribute> </attribute>
</widget> </widget>
<widget class="ElementPoolWidget" name="ElementDisplay"> <widget class="ElementPoolWidget" name="ElementDisplay">
<attribute name="title"> <attribute name="title">
<string>Element</string> <string>图元池</string>
</attribute> </attribute>
</widget> </widget>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="LayerTreeWidget" name="LayerTree"> <widget class="LayerTreeWidget" name="LayerTree">
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="contextMenuPolicy"> <property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum> <enum>Qt::CustomContextMenu</enum>
</property> </property>
<property name="accessibleName">
<string/>
</property>
<column> <column>
<property name="text"> <property name="text">
<string notr="true">1</string> <string>图层树</string>
</property> </property>
</column> </column>
</widget> </widget>

View File

@ -17,7 +17,7 @@ void InfoDisplayWidget::generateLayerForm()
QLayoutItem *item; QLayoutItem *item;
if (this->layout() != nullptr) if (this->layout() != nullptr)
{ {
while ((item = this->layout()->takeAt(0)) != nullptr) while (this->layout()->count() > 0 && (item = this->layout()->takeAt(0)) != nullptr)
{ {
delete item->widget(); delete item->widget();
delete item; delete item;
@ -80,7 +80,7 @@ void InfoDisplayWidget::generateLayerForm()
QListWidgetItem* item = new QListWidgetItem("样式列表"); QListWidgetItem* item = new QListWidgetItem("样式列表");
item->setFlags(Qt::NoItemFlags); item->setFlags(Qt::NoItemFlags);
styleList->addItem(item); styleList->addItem(item);
static vector<QString> styleNames = { "样例1", "样例2", "样例3" }; static vector<QString> styleNames = { "样例1", "样例2", "样例3" , "样例4" , "样例5" , "样例6" , "样例7" , "样例8" };
auto createStyleItem = [this, styleList](int index) { auto createStyleItem = [this, styleList](int index) {
QListWidgetItem* item = new QListWidgetItem; QListWidgetItem* item = new QListWidgetItem;
QWidget* w = new QWidget; QWidget* w = new QWidget;
@ -137,16 +137,8 @@ void InfoDisplayWidget::generateLayerForm()
this->setLayout(layout); this->setLayout(layout);
} }
void InfoDisplayWidget::generateElementForm()
{
}
void InfoDisplayWidget::triggerSelfRefresh() void InfoDisplayWidget::triggerSelfRefresh()
{ {
if (this->displayLayer != nullptr) if (this->displayLayer != nullptr)
this->generateLayerForm(); this->generateLayerForm();
else
this->generateElementForm();
} }

View File

@ -16,7 +16,6 @@ class InfoDisplayWidget : public QWidget
public: public:
void setLayer(LayerWrapper *layer); void setLayer(LayerWrapper *layer);
void generateLayerForm(); void generateLayerForm();
void generateElementForm();
public slots: public slots:
void triggerSelfRefresh(); void triggerSelfRefresh();