一系列修改
parent
c1ad6a61f0
commit
8ca036fafb
|
@ -104,8 +104,9 @@
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="src\CaptionButton.cpp" />
|
|
||||||
<ClCompile Include="src\Editor\EditorWidget.cpp" />
|
<ClCompile Include="src\Editor\EditorWidget.cpp" />
|
||||||
|
<ClCompile Include="src\CaptionButton.cpp" />
|
||||||
|
<ClCompile Include="src\Editor\EditorWidgetItem.cpp" />
|
||||||
<ClCompile Include="src\Editor\ElementManager.cpp" />
|
<ClCompile Include="src\Editor\ElementManager.cpp" />
|
||||||
<ClCompile Include="src\Editor\GraphicElement.cpp" />
|
<ClCompile Include="src\Editor\GraphicElement.cpp" />
|
||||||
<ClCompile Include="src\Editor\LayerManager.cpp" />
|
<ClCompile Include="src\Editor\LayerManager.cpp" />
|
||||||
|
@ -149,11 +150,12 @@
|
||||||
<ClCompile Include="src\Renderer\VirtualTextureManager.cpp" />
|
<ClCompile Include="src\Renderer\VirtualTextureManager.cpp" />
|
||||||
<ClCompile Include="src\SvgParser.cpp" />
|
<ClCompile Include="src\SvgParser.cpp" />
|
||||||
<ClCompile Include="src\TitleWidget.cpp" />
|
<ClCompile Include="src\TitleWidget.cpp" />
|
||||||
<QtUic Include="EditorWidget.ui" />
|
<QtUic Include="EditorWidgetItem.ui" />
|
||||||
<QtUic Include="FramelessWindow.ui" />
|
<QtUic Include="FramelessWindow.ui" />
|
||||||
<QtUic Include="MainWindow.ui" />
|
<QtUic Include="MainWindow.ui" />
|
||||||
<QtUic Include="NavigationBarWidget.ui" />
|
<QtUic Include="NavigationBarWidget.ui" />
|
||||||
<QtUic Include="RendererWidget.ui" />
|
<QtUic Include="RendererWidget.ui" />
|
||||||
|
<QtUic Include="EditorWidget.ui" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\data.json" />
|
<None Include="..\data.json" />
|
||||||
|
@ -187,6 +189,7 @@
|
||||||
<QtMoc Include="src\Editor\RightBar\LayerTreeWidget.h" />
|
<QtMoc Include="src\Editor\RightBar\LayerTreeWidget.h" />
|
||||||
<QtMoc Include="src\Editor\RightBar\InfoDisplayWidget.h" />
|
<QtMoc Include="src\Editor\RightBar\InfoDisplayWidget.h" />
|
||||||
<QtMoc Include="src\MainWindow.h" />
|
<QtMoc Include="src\MainWindow.h" />
|
||||||
|
<QtMoc Include="src\Editor\EditorWidget.h" />
|
||||||
<ClInclude Include="src\Editor\ElementManager.h" />
|
<ClInclude Include="src\Editor\ElementManager.h" />
|
||||||
<ClInclude Include="src\Editor\GraphicElement.h" />
|
<ClInclude Include="src\Editor\GraphicElement.h" />
|
||||||
<ClInclude Include="src\Editor\LayerManager.h" />
|
<ClInclude Include="src\Editor\LayerManager.h" />
|
||||||
|
@ -216,7 +219,7 @@
|
||||||
<QtMoc Include="src\CaptionButton.h" />
|
<QtMoc Include="src\CaptionButton.h" />
|
||||||
<QtMoc Include="src\NavigationBarWidget.h" />
|
<QtMoc Include="src\NavigationBarWidget.h" />
|
||||||
<QtMoc Include="src\Renderer\RendererWidget.h" />
|
<QtMoc Include="src\Renderer\RendererWidget.h" />
|
||||||
<QtMoc Include="src\Editor\EditorWidget.h" />
|
<QtMoc Include="src\Editor\EditorWidgetItem.h" />
|
||||||
<ClInclude Include="src\Renderer\Painting\BvhTree.h" />
|
<ClInclude Include="src\Renderer\Painting\BvhTree.h" />
|
||||||
<ClInclude Include="src\Renderer\Camera.h" />
|
<ClInclude Include="src\Renderer\Camera.h" />
|
||||||
<ClInclude Include="src\Renderer\Painting\CubicBezier.h" />
|
<ClInclude Include="src\Renderer\Painting\CubicBezier.h" />
|
||||||
|
|
|
@ -76,9 +76,12 @@
|
||||||
<QtUic Include="FramelessWindow.ui">
|
<QtUic Include="FramelessWindow.ui">
|
||||||
<Filter>Form Files</Filter>
|
<Filter>Form Files</Filter>
|
||||||
</QtUic>
|
</QtUic>
|
||||||
|
<QtUic Include="EditorWidget.ui">
|
||||||
|
<Filter>Form Files</Filter>
|
||||||
|
</QtUic>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="src\Editor\EditorWidget.cpp">
|
<ClCompile Include="src\Editor\EditorWidgetItem.cpp">
|
||||||
<Filter>Source Files\Editor</Filter>
|
<Filter>Source Files\Editor</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="src\Renderer\Camera.cpp">
|
<ClCompile Include="src\Renderer\Camera.cpp">
|
||||||
|
@ -213,12 +216,15 @@
|
||||||
<ClCompile Include="src\Editor\PixelPath.cpp">
|
<ClCompile Include="src\Editor\PixelPath.cpp">
|
||||||
<Filter>Source Files\Editor</Filter>
|
<Filter>Source Files\Editor</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="src\Editor\EditorWidget.cpp">
|
||||||
|
<Filter>Source Files</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtMoc Include="src\Renderer\RendererGLWidget.h">
|
<QtMoc Include="src\Renderer\RendererGLWidget.h">
|
||||||
<Filter>Header Files\Renderer</Filter>
|
<Filter>Header Files\Renderer</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
<QtMoc Include="src\Editor\EditorWidget.h">
|
<QtMoc Include="src\Editor\EditorWidgetItem.h">
|
||||||
<Filter>Header Files\Editor</Filter>
|
<Filter>Header Files\Editor</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
<QtMoc Include="src\Renderer\RendererWidget.h">
|
<QtMoc Include="src\Renderer\RendererWidget.h">
|
||||||
|
@ -248,6 +254,9 @@
|
||||||
<QtMoc Include="src\Editor\RightBar\InfoDisplayWidget.h">
|
<QtMoc Include="src\Editor\RightBar\InfoDisplayWidget.h">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</QtMoc>
|
</QtMoc>
|
||||||
|
<QtMoc Include="src\Editor\EditorWidget.h">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</QtMoc>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\data.json" />
|
<None Include="..\data.json" />
|
||||||
|
@ -328,7 +337,7 @@
|
||||||
</None>
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtUic Include="EditorWidget.ui">
|
<QtUic Include="EditorWidgetItem.ui">
|
||||||
<Filter>Form Files</Filter>
|
<Filter>Form Files</Filter>
|
||||||
</QtUic>
|
</QtUic>
|
||||||
<QtUic Include="RendererWidget.ui">
|
<QtUic Include="RendererWidget.ui">
|
||||||
|
|
|
@ -1,110 +1,146 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>EditorWidgetClass</class>
|
<class>EditorWidget</class>
|
||||||
<widget class="QWidget" name="EditorWidgetClass">
|
<widget class="QWidget" name="EditorWidget">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1124</width>
|
<width>1139</width>
|
||||||
<height>695</height>
|
<height>685</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>RendererWidget</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<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="QWidget" name="MainWindow" native="true">
|
<layout class="QVBoxLayout" name="verticalLayout" stretch="1,1,20">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="1,30">
|
<item>
|
||||||
<item>
|
<widget class="QWidget" name="widget" native="true">
|
||||||
<widget class="QLabel" name="Title">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<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"/>
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
</item>
|
<item>
|
||||||
<item>
|
<widget class="QPushButton" name="createButton">
|
||||||
<widget class="PreviewWindow" name="Preview"/>
|
<property name="minimumSize">
|
||||||
</item>
|
<size>
|
||||||
<item>
|
<width>80</width>
|
||||||
<widget class="QWidget" name="RightBar" native="true">
|
<height>0</height>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="1,2">
|
</size>
|
||||||
<item>
|
</property>
|
||||||
<widget class="QTabWidget" name="DisplayTab">
|
<property name="maximumSize">
|
||||||
<property name="currentIndex">
|
<size>
|
||||||
<number>0</number>
|
<width>80</width>
|
||||||
</property>
|
<height>16777215</height>
|
||||||
<widget class="InfoDisplayWidget" name="LayerDisplay">
|
</size>
|
||||||
<attribute name="title">
|
</property>
|
||||||
<string>Layer</string>
|
<property name="text">
|
||||||
</attribute>
|
<string>新建</string>
|
||||||
</widget>
|
</property>
|
||||||
<widget class="QWidget" name="ElementDisplay">
|
</widget>
|
||||||
<attribute name="title">
|
</item>
|
||||||
<string>Element</string>
|
<item>
|
||||||
</attribute>
|
<widget class="QPushButton" name="saveButton">
|
||||||
</widget>
|
<property name="minimumSize">
|
||||||
</widget>
|
<size>
|
||||||
</item>
|
<width>80</width>
|
||||||
<item>
|
<height>0</height>
|
||||||
<widget class="LayerTreeWidget" name="LayerTree">
|
</size>
|
||||||
<property name="contextMenuPolicy">
|
</property>
|
||||||
<enum>Qt::CustomContextMenu</enum>
|
<property name="maximumSize">
|
||||||
</property>
|
<size>
|
||||||
<column>
|
<width>80</width>
|
||||||
<property name="text">
|
<height>16777215</height>
|
||||||
<string notr="true">1</string>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</column>
|
<property name="text">
|
||||||
</widget>
|
<string>保存</string>
|
||||||
</item>
|
</property>
|
||||||
</layout>
|
</widget>
|
||||||
</widget>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="saveAsButton">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>80</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>80</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>另存为</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="closeButton">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>80</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>80</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>关闭</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</widget>
|
||||||
</layout>
|
</item>
|
||||||
</widget>
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<widget class="EditorWidgetItem" name="tab">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Tab 1</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="EditorWidgetItem" name="tab_2">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Tab 2</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
<class>PreviewWindow</class>
|
<class>EditorWidgetItem</class>
|
||||||
<extends>QOpenGLWidget</extends>
|
|
||||||
<header>PreviewWindow.h</header>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>LayerTreeWidget</class>
|
|
||||||
<extends>QTreeWidget</extends>
|
|
||||||
<header location="global">LayerTreeWidget.h</header>
|
|
||||||
</customwidget>
|
|
||||||
<customwidget>
|
|
||||||
<class>InfoDisplayWidget</class>
|
|
||||||
<extends>QWidget</extends>
|
<extends>QWidget</extends>
|
||||||
<header location="global">InfoDisplayWidget.h</header>
|
<header>EditorWidgetItem.h</header>
|
||||||
<container>1</container>
|
<container>1</container>
|
||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
|
|
|
@ -0,0 +1,113 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>EditorWidgetItem</class>
|
||||||
|
<widget class="QWidget" name="EditorWidgetItem">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1124</width>
|
||||||
|
<height>695</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>RendererWidget</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<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="MainWindow" native="true">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="1,30">
|
||||||
|
<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">
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="LeftBar" native="true"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="PreviewWindow" name="Preview"/>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="RightBar" native="true">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4" stretch="1,2">
|
||||||
|
<item>
|
||||||
|
<widget class="QTabWidget" name="DisplayTab">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<widget class="InfoDisplayWidget" name="LayerDisplay">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Layer</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="ElementDisplay">
|
||||||
|
<attribute name="title">
|
||||||
|
<string>Element</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="LayerTreeWidget" name="LayerTree">
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">1</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>PreviewWindow</class>
|
||||||
|
<extends>QOpenGLWidget</extends>
|
||||||
|
<header>PreviewWindow.h</header>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>LayerTreeWidget</class>
|
||||||
|
<extends>QTreeWidget</extends>
|
||||||
|
<header location="global">LayerTreeWidget.h</header>
|
||||||
|
</customwidget>
|
||||||
|
<customwidget>
|
||||||
|
<class>InfoDisplayWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header location="global">InfoDisplayWidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
|
@ -60,16 +60,16 @@
|
||||||
</property>
|
</property>
|
||||||
<property name="styleSheet">
|
<property name="styleSheet">
|
||||||
<string notr="true">
|
<string notr="true">
|
||||||
QTabBar::tab {
|
QTabBar::tab.rendererWidget {
|
||||||
height: 0px;
|
height: 0px;
|
||||||
margin-top:0px;
|
margin-top:0px;
|
||||||
}
|
}
|
||||||
QTabWidget::tab-bar
|
QTabWidget::tab-bar.rendererWidget
|
||||||
{
|
{
|
||||||
height: 0px;
|
height: 0px;
|
||||||
top:0px;
|
top:0px;
|
||||||
}
|
}
|
||||||
QTabWidget::pane {
|
QTabWidget::pane.rendererWidget {
|
||||||
border: 0px;
|
border: 0px;
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,63 +1,33 @@
|
||||||
#include "EditorWidget.h"
|
#include "EditorWidget.h"
|
||||||
|
#include "EditorWidgetItem.h"
|
||||||
|
#include <QMouseEvent>
|
||||||
|
#include <QInputDialog>
|
||||||
|
#include <QMenu>
|
||||||
|
|
||||||
EditorWidget::EditorWidget(QWidget *parent) : QWidget(parent)
|
EditorWidget::EditorWidget(QWidget* parent) : QWidget(parent)
|
||||||
{
|
{
|
||||||
QImage x;
|
ui.setupUi(this);
|
||||||
displayLayer = nullptr;
|
this->createButton = ui.createButton;
|
||||||
displayElement = nullptr;
|
this->closeButton = ui.closeButton;
|
||||||
ui.setupUi(this);
|
this->saveButton = ui.saveButton;
|
||||||
previewWindow = ui.Preview;
|
this->saveAsButton = ui.saveAsButton;
|
||||||
treeWidget = ui.LayerTree;
|
this->tabWidget = ui.tabWidget;
|
||||||
tabWidget = ui.DisplayTab;
|
while (this->tabWidget->count() > 0)
|
||||||
layerInfoDisplayWidget = dynamic_cast<InfoDisplayWidget *>(tabWidget->widget(0));
|
{
|
||||||
elementInfoDisplayWidget = dynamic_cast<InfoDisplayWidget *>(tabWidget->widget(1));
|
this->tabWidget->removeTab(0);
|
||||||
connect(treeWidget, &LayerTreeWidget::displayLayerChange, this, &EditorWidget::onLayerChange);
|
}
|
||||||
connect(layerInfoDisplayWidget, &InfoDisplayWidget::requireRefreshPreview, this,
|
connect(this->createButton, &QPushButton::clicked, this, [this]() {
|
||||||
&EditorWidget::triggerRefreshPreview);
|
static int count = 0;
|
||||||
connect(treeWidget, &LayerTreeWidget::requireRefreshPreview, this,
|
this->tabWidget->addTab(new EditorWidgetItem(this),"untitled"+QString::number(count++));
|
||||||
&EditorWidget::triggerRefreshPreview);
|
});
|
||||||
connect(layerInfoDisplayWidget, &InfoDisplayWidget::requireSelfRefresh, layerInfoDisplayWidget, &InfoDisplayWidget::triggerSelfRefresh);
|
connect(this->closeButton, &QPushButton::clicked, this, [this]() {
|
||||||
// &EditorWidget::triggerRefreshPreview);
|
this->tabWidget->removeTab(this->tabWidget->currentIndex());
|
||||||
// test
|
});
|
||||||
QFile settingFile;
|
connect(this->saveButton, &QPushButton::clicked, this, [this]() {
|
||||||
settingFile.setFileName("../data.json");
|
|
||||||
settingFile.open(QFile::ReadOnly);
|
});
|
||||||
QByteArray setting = settingFile.readAll().trimmed();
|
connect(this->saveAsButton, &QPushButton::clicked, this, [this]() {
|
||||||
QJsonParseError jError;
|
|
||||||
QJsonDocument jsonDoc(QJsonDocument::fromJson(setting, &jError));
|
});
|
||||||
qDebug() << jsonDoc.object().value("height").toDouble();
|
|
||||||
qDebug() << jError.errorString();
|
|
||||||
// end test
|
|
||||||
QJsonObject source = jsonDoc.object();
|
|
||||||
elementManager = new ElementManager(source,previewWindow->getRenderer());
|
|
||||||
layerManager = new LayerManager(source, elementManager);
|
|
||||||
qDebug() << layerManager->toJson();
|
|
||||||
previewWindow->initialize(layerManager,QSize(jsonDoc.object().value("width").toDouble(),jsonDoc.object().value("height").toDouble()));
|
|
||||||
if (layerManager->getRoot() != nullptr)
|
|
||||||
{
|
|
||||||
treeWidget->root = layerManager->getRoot();
|
|
||||||
treeWidget->refresh();
|
|
||||||
treeWidget->addTopLevelItem(treeWidget->root->getQTreeItem());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
EditorWidget::~EditorWidget()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditorWidget::paintEvent(QPaintEvent *event)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditorWidget::onLayerChange(LayerWrapper *layer)
|
|
||||||
{
|
|
||||||
displayLayer = layer;
|
|
||||||
// TODO : notify InfoDisplayWidget and update
|
|
||||||
dynamic_cast<InfoDisplayWidget *>(tabWidget->widget(0))->setLayer(layer);
|
|
||||||
this->update();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditorWidget::triggerRefreshPreview()
|
|
||||||
{
|
|
||||||
previewWindow->update();
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,39 +1,22 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <qwidget.h>
|
||||||
#include "ElementManager.h"
|
|
||||||
#include "InfoDisplayWidget.h"
|
|
||||||
#include "LayerManager.h"
|
|
||||||
#include "LayerTreeWidget.h"
|
|
||||||
#include "PreviewWindow.h"
|
|
||||||
#include "ui_EditorWidget.h"
|
#include "ui_EditorWidget.h"
|
||||||
#include <QPainter>
|
|
||||||
#include <QTreeWidget>
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
class EditorWidget : public QWidget
|
class EditorWidget :
|
||||||
|
public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
private:
|
||||||
private:
|
Ui::EditorWidget ui;
|
||||||
// DATA PART
|
QTabWidget* tabWidget;
|
||||||
PreviewWindow *previewWindow;
|
QPushButton* createButton;
|
||||||
ElementManager *elementManager;
|
QPushButton* closeButton;
|
||||||
LayerManager *layerManager;
|
QPushButton* saveButton;
|
||||||
// QT GUI PART
|
QPushButton* saveAsButton;
|
||||||
Ui::EditorWidgetClass ui;
|
|
||||||
LayerTreeWidget *treeWidget;
|
public:
|
||||||
QTabWidget *tabWidget;
|
EditorWidget(QWidget* parent = nullptr);
|
||||||
InfoDisplayWidget *layerInfoDisplayWidget, *elementInfoDisplayWidget;
|
~EditorWidget()=default;
|
||||||
// QT DATA PART
|
|
||||||
LayerWrapper *displayLayer;
|
|
||||||
GraphicElement *displayElement;
|
|
||||||
|
|
||||||
public:
|
|
||||||
EditorWidget(QWidget *parent = nullptr);
|
|
||||||
~EditorWidget();
|
|
||||||
void paintEvent(QPaintEvent *event) override;
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void onLayerChange(LayerWrapper *layer);
|
|
||||||
void triggerRefreshPreview();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,63 @@
|
||||||
|
#include "EditorWidgetItem.h"
|
||||||
|
|
||||||
|
EditorWidgetItem::EditorWidgetItem(QWidget *parent) : QWidget(parent)
|
||||||
|
{
|
||||||
|
QImage x;
|
||||||
|
displayLayer = nullptr;
|
||||||
|
displayElement = nullptr;
|
||||||
|
ui.setupUi(this);
|
||||||
|
previewWindow = ui.Preview;
|
||||||
|
treeWidget = ui.LayerTree;
|
||||||
|
tabWidget = ui.DisplayTab;
|
||||||
|
layerInfoDisplayWidget = dynamic_cast<InfoDisplayWidget *>(tabWidget->widget(0));
|
||||||
|
elementInfoDisplayWidget = dynamic_cast<InfoDisplayWidget *>(tabWidget->widget(1));
|
||||||
|
connect(treeWidget, &LayerTreeWidget::displayLayerChange, this, &EditorWidgetItem::onLayerChange);
|
||||||
|
connect(layerInfoDisplayWidget, &InfoDisplayWidget::requireRefreshPreview, this,
|
||||||
|
&EditorWidgetItem::triggerRefreshPreview);
|
||||||
|
connect(treeWidget, &LayerTreeWidget::requireRefreshPreview, this,
|
||||||
|
&EditorWidgetItem::triggerRefreshPreview);
|
||||||
|
connect(layerInfoDisplayWidget, &InfoDisplayWidget::requireSelfRefresh, layerInfoDisplayWidget, &InfoDisplayWidget::triggerSelfRefresh);
|
||||||
|
// &EditorWidget::triggerRefreshPreview);
|
||||||
|
// test
|
||||||
|
QFile settingFile;
|
||||||
|
settingFile.setFileName("../data.json");
|
||||||
|
settingFile.open(QFile::ReadOnly);
|
||||||
|
QByteArray setting = settingFile.readAll().trimmed();
|
||||||
|
QJsonParseError jError;
|
||||||
|
QJsonDocument jsonDoc(QJsonDocument::fromJson(setting, &jError));
|
||||||
|
qDebug() << jsonDoc.object().value("height").toDouble();
|
||||||
|
qDebug() << jError.errorString();
|
||||||
|
// end test
|
||||||
|
QJsonObject source = jsonDoc.object();
|
||||||
|
elementManager = new ElementManager(source,previewWindow->getRenderer());
|
||||||
|
layerManager = new LayerManager(source, elementManager);
|
||||||
|
qDebug() << layerManager->toJson();
|
||||||
|
previewWindow->initialize(layerManager,QSize(jsonDoc.object().value("width").toDouble(),jsonDoc.object().value("height").toDouble()));
|
||||||
|
if (layerManager->getRoot() != nullptr)
|
||||||
|
{
|
||||||
|
treeWidget->root = layerManager->getRoot();
|
||||||
|
treeWidget->refresh();
|
||||||
|
treeWidget->addTopLevelItem(treeWidget->root->getQTreeItem());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EditorWidgetItem::~EditorWidgetItem()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditorWidgetItem::paintEvent(QPaintEvent *event)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditorWidgetItem::onLayerChange(LayerWrapper *layer)
|
||||||
|
{
|
||||||
|
displayLayer = layer;
|
||||||
|
// TODO : notify InfoDisplayWidget and update
|
||||||
|
dynamic_cast<InfoDisplayWidget *>(tabWidget->widget(0))->setLayer(layer);
|
||||||
|
this->update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditorWidgetItem::triggerRefreshPreview()
|
||||||
|
{
|
||||||
|
previewWindow->update();
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include "ElementManager.h"
|
||||||
|
#include "InfoDisplayWidget.h"
|
||||||
|
#include "LayerManager.h"
|
||||||
|
#include "LayerTreeWidget.h"
|
||||||
|
#include "PreviewWindow.h"
|
||||||
|
#include "ui_EditorWidgetItem.h"
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QTreeWidget>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
class EditorWidgetItem : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
private:
|
||||||
|
// DATA PART
|
||||||
|
PreviewWindow *previewWindow;
|
||||||
|
ElementManager *elementManager;
|
||||||
|
LayerManager *layerManager;
|
||||||
|
// QT GUI PART
|
||||||
|
Ui::EditorWidgetItem ui;
|
||||||
|
LayerTreeWidget *treeWidget;
|
||||||
|
QTabWidget *tabWidget;
|
||||||
|
InfoDisplayWidget *layerInfoDisplayWidget, *elementInfoDisplayWidget;
|
||||||
|
// QT DATA PART
|
||||||
|
LayerWrapper *displayLayer;
|
||||||
|
GraphicElement *displayElement;
|
||||||
|
|
||||||
|
public:
|
||||||
|
EditorWidgetItem(QWidget *parent = nullptr);
|
||||||
|
~EditorWidgetItem();
|
||||||
|
void paintEvent(QPaintEvent *event) override;
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void onLayerChange(LayerWrapper *layer);
|
||||||
|
void triggerRefreshPreview();
|
||||||
|
};
|
|
@ -96,7 +96,6 @@ void FolderLayerWrapper::refresh()
|
||||||
{
|
{
|
||||||
cache.clear();
|
cache.clear();
|
||||||
for (auto& child : children) {
|
for (auto& child : children) {
|
||||||
qDebug() << child.get();
|
|
||||||
cache.addPath(child.get()->getCache());
|
cache.addPath(child.get()->getCache());
|
||||||
}
|
}
|
||||||
LayerWrapper::refresh();
|
LayerWrapper::refresh();
|
||||||
|
|
Loading…
Reference in New Issue