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

View File

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

View File

@ -17,7 +17,7 @@ void InfoDisplayWidget::generateLayerForm()
QLayoutItem *item;
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;
@ -80,7 +80,7 @@ void InfoDisplayWidget::generateLayerForm()
QListWidgetItem* item = new QListWidgetItem("样式列表");
item->setFlags(Qt::NoItemFlags);
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) {
QListWidgetItem* item = new QListWidgetItem;
QWidget* w = new QWidget;
@ -137,16 +137,8 @@ void InfoDisplayWidget::generateLayerForm()
this->setLayout(layout);
}
void InfoDisplayWidget::generateElementForm()
{
}
void InfoDisplayWidget::triggerSelfRefresh()
{
if (this->displayLayer != nullptr)
this->generateLayerForm();
else
this->generateElementForm();
}

View File

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