清理了一些无用代码
parent
6188d6a413
commit
56f64f00f0
Binary file not shown.
|
@ -150,9 +150,7 @@
|
|||
<ClCompile Include="src\SvgParser.cpp" />
|
||||
<ClCompile Include="src\TitleWidget.cpp" />
|
||||
<QtUic Include="EditorWidget.ui" />
|
||||
<QtUic Include="FramelessWindow.ui" />
|
||||
<QtUic Include="MainWindow.ui" />
|
||||
<QtUic Include="NavigationBarWidget.ui" />
|
||||
<QtUic Include="RendererWidget.ui" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -187,6 +185,7 @@
|
|||
<QtMoc Include="src\Editor\RightBar\LayerTreeWidget.h" />
|
||||
<QtMoc Include="src\Editor\RightBar\InfoDisplayWidget.h" />
|
||||
<QtMoc Include="src\MainWindow.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="src\Editor\ElementManager.h" />
|
||||
<ClInclude Include="src\Editor\GraphicElement.h" />
|
||||
<ClInclude Include="src\Editor\LayerManager.h" />
|
||||
|
@ -241,6 +240,9 @@
|
|||
<Project>{8f360763-a045-3808-87a9-3fae38e69819}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="ArchitectureColoredPainting.rc" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
|
||||
<Import Project="$(QtMsBuild)\qt.targets" />
|
||||
|
|
|
@ -70,12 +70,6 @@
|
|||
<QtUic Include="MainWindow.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtUic Include="NavigationBarWidget.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
<QtUic Include="FramelessWindow.ui">
|
||||
<Filter>Form Files</Filter>
|
||||
</QtUic>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\Editor\EditorWidget.cpp">
|
||||
|
@ -441,10 +435,16 @@
|
|||
<ClInclude Include="src\Renderer\VirtualTextureManager.h">
|
||||
<Filter>Header Files\Renderer</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtRcc Include="res\MainWindow.qrc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</QtRcc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="ArchitectureColoredPainting.rc" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,94 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FramelessWindow</class>
|
||||
<widget class="QWidget" name="FramelessWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>560</width>
|
||||
<height>544</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<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="windowFrame" native="true">
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QWidget" name="windowContent" native="true">
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<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>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -120,8 +120,6 @@
|
|||
<header>Editor/EditorWidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="MainWindow.qrc"/>
|
||||
</resources>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
|
|
@ -1,100 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>NavigationBarWidgetClass</class>
|
||||
<widget class="QWidget" name="NavigationBarWidgetClass">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>612</width>
|
||||
<height>41</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>NavigationBarWidget</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QRadioButton::indicator {
|
||||
width: 0px;
|
||||
border: 0px;
|
||||
background-color: rgba(0, 0, 0, 0);
|
||||
}</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<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="QPushButton" name="radioButton0">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>纹理编辑</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="radioButton1">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>场景渲染</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -35,16 +35,16 @@
|
|||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="openButton">
|
||||
<widget class="QtMaterialFlatButton" name="openButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<width>80</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
|
@ -180,6 +180,11 @@
|
|||
<extends>QOpenGLWidget</extends>
|
||||
<header>RendererGLWidget.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>QtMaterialFlatButton</class>
|
||||
<extends>QPushButton</extends>
|
||||
<header location="global">qtmaterialflatbutton.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by ArchitectureColoredPainting.rc
|
||||
|
||||
// 新对象的下一组默认值
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 101
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1001
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
|
@ -11,98 +11,6 @@
|
|||
|
||||
FRAMELESSHELPER_USE_NAMESPACE
|
||||
|
||||
inline void fontTheme()
|
||||
{
|
||||
QFont defaultFont = qApp->font();
|
||||
defaultFont.setPointSize(defaultFont.pointSize() + 2);
|
||||
qApp->setFont(defaultFont);
|
||||
}
|
||||
|
||||
inline void setThemeStyleSheet(bool dark)
|
||||
{
|
||||
QFile file(dark ? ":/darkstyle.qss" : ":/lightstyle.qss");
|
||||
|
||||
if (!file.open(QFile::ReadOnly))
|
||||
return;
|
||||
|
||||
const QString style_sheet = QLatin1String(file.readAll());
|
||||
|
||||
file.close();
|
||||
|
||||
qApp->setStyleSheet(style_sheet);
|
||||
}
|
||||
|
||||
inline void darkTheme()
|
||||
{
|
||||
QPalette darkPalette = qApp->palette();
|
||||
|
||||
darkPalette.setColor(QPalette::Window, QColor(53, 53, 53));
|
||||
darkPalette.setColor(QPalette::WindowText, QColor(255, 255, 255));
|
||||
darkPalette.setColor(QPalette::Disabled, QPalette::WindowText, QColor(127, 127, 127));
|
||||
darkPalette.setColor(QPalette::Base, QColor(42, 42, 42));
|
||||
darkPalette.setColor(QPalette::AlternateBase, QColor(66, 66, 66));
|
||||
darkPalette.setColor(QPalette::ToolTipBase, QColor(255, 255, 255));
|
||||
darkPalette.setColor(QPalette::ToolTipText, QColor(255, 255, 255));
|
||||
darkPalette.setColor(QPalette::Text, QColor(255, 255, 255));
|
||||
darkPalette.setColor(QPalette::Disabled, QPalette::Text, QColor(127, 127, 127));
|
||||
darkPalette.setColor(QPalette::Dark, QColor(35, 35, 35));
|
||||
darkPalette.setColor(QPalette::Shadow, QColor(20, 20, 20));
|
||||
darkPalette.setColor(QPalette::Button, QColor(53, 53, 53));
|
||||
darkPalette.setColor(QPalette::ButtonText, QColor(255, 255, 255));
|
||||
darkPalette.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(127, 127, 127));
|
||||
darkPalette.setColor(QPalette::BrightText, QColor(255, 0, 0));
|
||||
darkPalette.setColor(QPalette::Link, QColor(42, 130, 218));
|
||||
darkPalette.setColor(QPalette::Highlight, QColor(42, 130, 218));
|
||||
darkPalette.setColor(QPalette::Disabled, QPalette::Highlight, QColor(80, 80, 80));
|
||||
darkPalette.setColor(QPalette::HighlightedText, QColor(255, 255, 255));
|
||||
darkPalette.setColor(QPalette::Disabled, QPalette::HighlightedText, QColor(127, 127, 127));
|
||||
|
||||
qApp->setPalette(darkPalette);
|
||||
|
||||
setThemeStyleSheet(true /*dark*/);
|
||||
}
|
||||
|
||||
|
||||
inline void lightTheme()
|
||||
{
|
||||
QPalette lightPalette = qApp->palette();
|
||||
|
||||
lightPalette.setColor(QPalette::Window, QColor(240, 240, 240));
|
||||
lightPalette.setColor(QPalette::WindowText, QColor(0, 0, 0));
|
||||
lightPalette.setColor(QPalette::Disabled, QPalette::WindowText, QColor(120, 120, 120));
|
||||
lightPalette.setColor(QPalette::Base, QColor(255, 255, 255));
|
||||
lightPalette.setColor(QPalette::AlternateBase, QColor(233, 231, 227));
|
||||
lightPalette.setColor(QPalette::ToolTipBase, QColor(255, 255, 220));
|
||||
lightPalette.setColor(QPalette::ToolTipText, QColor(0, 0, 0));
|
||||
lightPalette.setColor(QPalette::Text, QColor(0, 0, 0));
|
||||
lightPalette.setColor(QPalette::Disabled, QPalette::Text, QColor(120, 120, 120));
|
||||
lightPalette.setColor(QPalette::Dark, QColor(160, 160, 160));
|
||||
lightPalette.setColor(QPalette::Shadow, QColor(105, 105, 105));
|
||||
lightPalette.setColor(QPalette::Button, QColor(240, 240, 240));
|
||||
lightPalette.setColor(QPalette::ButtonText, QColor(0, 0, 0));
|
||||
lightPalette.setColor(QPalette::Disabled, QPalette::ButtonText, QColor(120, 120, 120));
|
||||
lightPalette.setColor(QPalette::BrightText, QColor(0, 0, 255));
|
||||
lightPalette.setColor(QPalette::Link, QColor(51, 153, 255));
|
||||
lightPalette.setColor(QPalette::Highlight, QColor(0, 0, 255));
|
||||
lightPalette.setColor(QPalette::Disabled, QPalette::Highlight, QColor(51, 153, 255));
|
||||
lightPalette.setColor(QPalette::HighlightedText, QColor(255, 255, 255));
|
||||
lightPalette.setColor(QPalette::Disabled, QPalette::HighlightedText, QColor(255, 255, 255));
|
||||
|
||||
qApp->setPalette(lightPalette);
|
||||
|
||||
setThemeStyleSheet(false /*dark*/);
|
||||
}
|
||||
|
||||
FramelessWindow::FramelessWindow(QWidget* parent) : QWidget(parent), ui(new Ui::FramelessWindow)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
FramelessWindow::~FramelessWindow()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
CentralWidget::CentralWidget(QWidget* parent) : QMainWindow(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
@ -136,34 +44,25 @@ MainWindow::MainWindow(QWidget* parent, const Qt::WindowFlags flags)
|
|||
m_titleBar->chromePalette()->setTitleBarActiveBackgroundColor(QColor(0,0,0,0));
|
||||
m_titleBar->chromePalette()->setTitleBarInactiveBackgroundColor(QColor(0, 0, 0, 0));
|
||||
|
||||
m_window = new FramelessWindow(this);
|
||||
m_central_widget = new CentralWidget(this);
|
||||
m_window->ui->windowContent->layout()->addWidget(m_central_widget);
|
||||
m_central_widget = new CentralWidget();
|
||||
|
||||
setMenuWidget(m_titleBar);
|
||||
setCentralWidget(m_window);
|
||||
setCentralWidget(m_central_widget);
|
||||
|
||||
FramelessWidgetsHelper* helper = FramelessWidgetsHelper::get(this);
|
||||
helper->setTitleBarWidget(m_titleBar);
|
||||
#ifndef Q_OS_MACOS
|
||||
helper->setSystemButton(m_titleBar->minimizeButton(), Global::SystemButtonType::Minimize);
|
||||
helper->setSystemButton(m_titleBar->maximizeButton(), Global::SystemButtonType::Maximize);
|
||||
helper->setSystemButton(m_titleBar->closeButton(), Global::SystemButtonType::Close);
|
||||
#endif // Q_OS_MACOS
|
||||
|
||||
connect(helper, &FramelessWidgetsHelper::ready, this, [this, helper]() {
|
||||
/*connect(helper, &FramelessWidgetsHelper::ready, this, [this, helper]() {
|
||||
helper->moveWindowToDesktopCenter();
|
||||
|
||||
});
|
||||
|
||||
});*/
|
||||
|
||||
setWindowIcon(QIcon(":/images/icon.png"));
|
||||
setWindowTitle("ArchitectureColoredPainting");
|
||||
|
||||
|
||||
resize(m_central_widget->size());
|
||||
//setCentralWidget(m_window);
|
||||
|
||||
//move(QGuiApplication::primaryScreen()->availableGeometry().center() - rect().center());
|
||||
|
||||
}
|
||||
|
@ -179,5 +78,3 @@ void MainWindow::closeEvent(QCloseEvent* event)
|
|||
if (result != QMessageBox::Yes)
|
||||
event->ignore();*/
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
#include <QtWidgets/QMainWindow>
|
||||
#include "ui_MainWindow.h"
|
||||
#include "ui_FramelessWindow.h"
|
||||
|
||||
#include <FramelessHelper/Widgets/framelessmainwindow.h>
|
||||
|
||||
|
@ -10,19 +9,6 @@ FRAMELESSHELPER_BEGIN_NAMESPACE
|
|||
class StandardTitleBar;
|
||||
FRAMELESSHELPER_END_NAMESPACE
|
||||
|
||||
|
||||
class FramelessWindow : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit FramelessWindow(QWidget* parent = nullptr);
|
||||
|
||||
~FramelessWindow();
|
||||
|
||||
Ui::FramelessWindow* ui;
|
||||
};
|
||||
|
||||
|
||||
class CentralWidget : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -46,10 +32,7 @@ public:
|
|||
private:
|
||||
FRAMELESSHELPER_PREPEND_NAMESPACE(StandardTitleBar)* m_titleBar = nullptr;
|
||||
Ui::MainWindowClass ui;
|
||||
CentralWidget* m_central_widget = nullptr;
|
||||
|
||||
|
||||
void closeEvent(QCloseEvent* event);
|
||||
|
||||
FramelessWindow* m_window;
|
||||
CentralWidget* m_central_widget;
|
||||
void closeEvent(QCloseEvent * event);
|
||||
};
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "NavigationBarWidget.h"
|
||||
#include <qtmaterialraisedbutton.h>
|
||||
#include <QVBoxLayout>
|
||||
#include <QDebug>
|
||||
|
||||
NavigationBarWidget::NavigationBarWidget(QWidget *parent)
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include <QWidget>
|
||||
#include <QButtonGroup>
|
||||
#include <qtmaterialtabs.h>
|
||||
#include "ui_NavigationBarWidget.h"
|
||||
|
||||
class NavigationBarWidget : public QWidget
|
||||
{
|
||||
|
|
|
@ -1,14 +1,16 @@
|
|||
#include "RendererWidget.h"
|
||||
#include "RendererGLWidget.h"
|
||||
using namespace Renderer;
|
||||
RendererWidget::RendererWidget(QWidget *parent)
|
||||
|
||||
Renderer::RendererWidget::RendererWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
ui.openButton->setHaloVisible(false);
|
||||
ui.openButton->setOverlayStyle(::Material::TintedOverlay);
|
||||
QObject::connect(ui.horizontalSlider, &QSlider::valueChanged,
|
||||
ui.openGLWidget, &RendererGLWidget::setMainLightPitch);
|
||||
ui.openGLWidget, &Renderer::RendererGLWidget::setMainLightPitch);
|
||||
QObject::connect(ui.horizontalSlider_2, &QSlider::valueChanged,
|
||||
ui.openGLWidget, &RendererGLWidget::setMainLightYaw);
|
||||
ui.openGLWidget, &Renderer::RendererGLWidget::setMainLightYaw);
|
||||
QObject::connect(ui.exposureSlider, &QSlider::valueChanged, [&](int value) {
|
||||
ui.openGLWidget->setExposure(value/100.f);
|
||||
});
|
||||
|
@ -17,13 +19,13 @@ RendererWidget::RendererWidget(QWidget *parent)
|
|||
ui.horizontalSlider_2->setValue(80);
|
||||
ui.exposureSlider->setValue(60);
|
||||
QObject::connect(ui.openButton, &QPushButton::clicked,
|
||||
ui.openGLWidget, &RendererGLWidget::setModel);
|
||||
ui.openGLWidget, &Renderer::RendererGLWidget::setModel);
|
||||
}
|
||||
|
||||
RendererWidget::~RendererWidget()
|
||||
Renderer::RendererWidget::~RendererWidget()
|
||||
{}
|
||||
|
||||
void RendererWidget::currentTabChanged(int index)
|
||||
void Renderer::RendererWidget::currentTabChanged(int index)
|
||||
{
|
||||
if (index == 1)
|
||||
{
|
||||
|
|
|
@ -12,14 +12,20 @@ namespace UnitTest
|
|||
{
|
||||
TEST_CLASS(ElementRendererStokeTypeTest)
|
||||
{
|
||||
private:
|
||||
char* argv[1];
|
||||
int argc;
|
||||
public:
|
||||
TEST_METHOD(TestBothSidesRound)
|
||||
ElementRendererStokeTypeTest() :argv{ (char*)"" }, argc(1) {}
|
||||
|
||||
TEST_METHOD_INITIALIZE(initialize)
|
||||
{
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||
char* argv[] = { (char*)"" };
|
||||
int argc = 1;
|
||||
}
|
||||
TEST_METHOD(TestBothSidesRound)
|
||||
{
|
||||
QApplication a(argc, argv);
|
||||
class StyleStrokeRadialGradient : public Renderer::ElementStyle
|
||||
{
|
||||
|
@ -41,11 +47,6 @@ namespace UnitTest
|
|||
}
|
||||
TEST_METHOD(TestBothSidesFlat)
|
||||
{
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||
char* argv[] = { (char*)"" };
|
||||
int argc = 1;
|
||||
QApplication a(argc, argv);
|
||||
class StyleStrokeRadialGradient : public Renderer::ElementStyle
|
||||
{
|
||||
|
@ -67,11 +68,6 @@ namespace UnitTest
|
|||
}
|
||||
TEST_METHOD(TestLeftSideRound)
|
||||
{
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||
char* argv[] = { (char*)"" };
|
||||
int argc = 1;
|
||||
QApplication a(argc, argv);
|
||||
class StyleStrokeRadialGradient : public Renderer::ElementStyle
|
||||
{
|
||||
|
@ -93,11 +89,6 @@ namespace UnitTest
|
|||
}
|
||||
TEST_METHOD(TestLeftSideFlat)
|
||||
{
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||
char* argv[] = { (char*)"" };
|
||||
int argc = 1;
|
||||
QApplication a(argc, argv);
|
||||
class StyleStrokeRadialGradient : public Renderer::ElementStyle
|
||||
{
|
||||
|
@ -121,14 +112,13 @@ namespace UnitTest
|
|||
|
||||
TEST_CLASS(ElementRendererStokeMaterialTest)
|
||||
{
|
||||
private:
|
||||
char* argv[1];
|
||||
int argc;
|
||||
public:
|
||||
ElementRendererStokeMaterialTest() :argv{ (char*)"" }, argc(1) {}
|
||||
TEST_METHOD(TestStrokePlain)
|
||||
{
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||
char* argv[] = { (char*)"" };
|
||||
int argc = 1;
|
||||
QApplication a(argc, argv);
|
||||
class StyleStrokePlain : public Renderer::ElementStyle
|
||||
{
|
||||
|
@ -145,11 +135,6 @@ namespace UnitTest
|
|||
}
|
||||
TEST_METHOD(TestStrokeRadialGradient1)
|
||||
{
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||
char* argv[] = { (char*)"" };
|
||||
int argc = 1;
|
||||
QApplication a(argc, argv);
|
||||
class StyleStrokeRadialGradient : public Renderer::ElementStyle
|
||||
{
|
||||
|
@ -171,11 +156,6 @@ namespace UnitTest
|
|||
}
|
||||
TEST_METHOD(TestStrokeRadialGradient2)
|
||||
{
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||
char* argv[] = { (char*)"" };
|
||||
int argc = 1;
|
||||
QApplication a(argc, argv);
|
||||
class StyleStrokeRadialGradient : public Renderer::ElementStyle
|
||||
{
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
#include "CppUnitTest.h"
|
||||
#include "PaintingTest.h"
|
||||
#include <QApplication>
|
||||
#include "Renderer/Painting/Painting.h"
|
||||
#include "Renderer/Painting/MaterialStyleStroke.h"
|
||||
|
||||
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
|
||||
using namespace Renderer;
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
TEST_CLASS(PaintingTest)
|
||||
{
|
||||
private:
|
||||
char* argv[1];
|
||||
int argc;
|
||||
public:
|
||||
PaintingTest() :argv{ (char*)"" }, argc(1) {}
|
||||
|
||||
TEST_METHOD_INITIALIZE(initialize)
|
||||
{
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||
}
|
||||
TEST_METHOD(TestBothSidesRound)
|
||||
{
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||
QApplication a(argc, argv);
|
||||
class StyleStrokeRadialGradient : public Renderer::ElementStyle
|
||||
{
|
||||
virtual std::vector<Renderer::BaseStyle> toBaseStyles() const override
|
||||
{
|
||||
std::map<float, Material> materialMap = {
|
||||
{0.20, Material{QColor(255,255,255)}},
|
||||
{0.60, Material{QColor(165,176,207)}},
|
||||
{1.00, Material{QColor(58,64,151)}}
|
||||
};
|
||||
return { BaseStyle(std::make_shared<TransformStyle>(),
|
||||
std::make_shared<MaterialStyleStroke>(60, StrokeType::kBothSides, StrokeEndType::kRound,
|
||||
std::make_shared<StrokeRadialGradient>(materialMap, false))) };
|
||||
}
|
||||
} style;
|
||||
TestPaintingGLWidget w(style);
|
||||
w.show();
|
||||
a.exec();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
#pragma once
|
||||
|
||||
#include <QOpenGLWidget>
|
||||
#include <QOpenGLFunctions_4_5_Core>
|
||||
#include "Renderer/Painting/ElementStyle.h"
|
||||
#include <ThirdPartyLib/qquick/qquicksvgparser_p.h>
|
||||
#include <util/SvgFileLoader.h>
|
||||
#include <util/PainterPathUtil.h>
|
||||
|
||||
namespace UnitTest
|
||||
{
|
||||
class TestPaintingGLWidget : public QOpenGLWidget, protected QOpenGLFunctions_4_5_Core
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
Renderer::ElementStyle& style;
|
||||
|
||||
public:
|
||||
TestPaintingGLWidget(Renderer::ElementStyle& style, QWidget* parent = nullptr)
|
||||
: QOpenGLWidget(parent), style(style) {};
|
||||
void initializeGL() override
|
||||
{
|
||||
initializeOpenGLFunctions();
|
||||
/*std::vector<std::pair<std::shared_ptr<Contour>, float>> contours;
|
||||
|
||||
QPainterPath painterPaths[3];
|
||||
QQuickSvgParser::parsePathDataFast("M100,100C-.5,100,0,100.5,0,0L40,.07C40,59.5,39.5,60,100,60Z",
|
||||
painterPaths[0]);
|
||||
if (!SvgFileLoader().loadSvgFile("../svg/2.svg", painterPaths[1]))
|
||||
qCritical() << "load error";
|
||||
QQuickSvgParser::parsePathDataFast("M377,459.61a11.26,11.26,0,0,1,11.27-11.27H696.12a11.27,11.27,0,0,0,11-8.62A359.84,359.84,0,0,0,708,280.56a11.26,11.26,0,0,0-11-8.73H388.27A11.26,11.26,0,0,1,377,260.57h0a11.26,11.26,0,0,1,11.27-11.26H683.71A11.32,11.32,0,0,0,694.28,234C649.8,113.69,542.57,23.85,412.3,4.12a11.22,11.22,0,0,0-12.76,11.17v158.9a11.26,11.26,0,0,0,11.26,11.27H583.12a11.32,11.32,0,0,0,9.26-17.75c-31.67-46.59-78.51-75.2-109.11-90.07a11.25,11.25,0,0,0-16.13,10.17V115.2a11.24,11.24,0,0,0,6.22,10.07l7.51,3.76a11.28,11.28,0,0,1,5,15.12h0a11.27,11.27,0,0,1-15.11,5l-20-10a11.27,11.27,0,0,1-6.22-10.07V54a11.27,11.27,0,0,1,14.62-10.75c5.11,1.59,125.66,40.35,172.24,149A11.27,11.27,0,0,1,621.11,208H388.27A11.26,11.26,0,0,1,377,196.73V11.36A11.32,11.32,0,0,0,365.89.08C363.34,0,360.79,0,358.22,0s-5.11,0-7.66.08a11.32,11.32,0,0,0-11.11,11.28V196.74A11.26,11.26,0,0,1,328.18,208H95.35A11.27,11.27,0,0,1,85,192.3c46.57-108.67,167.12-147.42,172.23-149A11.26,11.26,0,0,1,271.86,54v75.11a11.25,11.25,0,0,1-6.23,10.07l-20,10a11.27,11.27,0,0,1-15.11-5h0a11.26,11.26,0,0,1,5-15.11l7.52-3.76a11.27,11.27,0,0,0,6.22-10.07V87.82a11.25,11.25,0,0,0-16.14-10.16c-30.6,14.87-77.45,43.48-109.1,90.07a11.3,11.3,0,0,0,9.25,17.74H305.66a11.26,11.26,0,0,0,11.27-11.26V15.31A11.22,11.22,0,0,0,304.17,4.14C173.88,23.86,66.66,113.71,22.17,234a11.32,11.32,0,0,0,10.56,15.29H328.18a11.26,11.26,0,0,1,11.27,11.26v0a11.26,11.26,0,0,1-11.27,11.26H19.52a11.26,11.26,0,0,0-11,8.72,359.84,359.84,0,0,0,.83,159.16,11.26,11.26,0,0,0,11,8.61H328.18a11.26,11.26,0,0,1,11.27,11.27h0a11.26,11.26,0,0,1-11.27,11.26h-294a11.32,11.32,0,0,0-10.53,15.4C69,604.65,175.3,692.78,304.16,712.3a11.21,11.21,0,0,0,12.76-11.16V542.22A11.26,11.26,0,0,0,305.66,531h-166c-9.53,0-14.89,11.22-8.69,18.47,34.09,39.77,74.45,65.66,101.77,80.18a11.25,11.25,0,0,0,16.53-10V591a11.26,11.26,0,0,1,11.26-11.26h0A11.26,11.26,0,0,1,271.85,591v63.85A11.27,11.27,0,0,1,256.8,665.5c-4.45-1.59-109.58-40-171-139.9a11.27,11.27,0,0,1,9.59-17.17H328.18a11.26,11.26,0,0,1,11.27,11.26V705.08a11.32,11.32,0,0,0,11.11,11.28q3.82.07,7.66.08c2.57,0,5.12,0,7.67-.08A11.32,11.32,0,0,0,377,705.08V519.69a11.25,11.25,0,0,1,11.27-11.26H621.1a11.26,11.26,0,0,1,9.59,17.16c-61.46,99.87-166.59,138.3-171,139.9a11.27,11.27,0,0,1-15-10.61V591a11.26,11.26,0,0,1,11.26-11.26h0A11.26,11.26,0,0,1,467.14,591v28.6a11.25,11.25,0,0,0,16.53,10c27.33-14.53,67.68-40.42,101.77-80.19,6.2-7.23.85-18.46-8.69-18.46h-166a11.26,11.26,0,0,0-11.26,11.26V701.12a11.21,11.21,0,0,0,12.76,11.17c128.86-19.51,235.14-107.66,280.48-226a11.33,11.33,0,0,0-10.53-15.41h-294A11.25,11.25,0,0,1,377,459.61ZM35.27,399.53V316.9a11.26,11.26,0,0,1,11.27-11.26H669.92a11.25,11.25,0,0,1,11.26,11.26v82.63a11.25,11.25,0,0,1-11.26,11.26H46.54a11.27,11.27,0,0,1-11.27-11.26Z",
|
||||
painterPaths[2]);
|
||||
|
||||
for (auto& i : painterPaths)
|
||||
{
|
||||
auto [contour, ratio] = PainterPathUtil::toNormalizedLines(i);
|
||||
contours.emplace_back(std::make_shared<Contour>(contour), ratio);
|
||||
}
|
||||
|
||||
std::vector<std::shared_ptr<ElementStyle>> style = {
|
||||
std::make_shared<ElementStyleFillDemo>(),
|
||||
std::make_shared<ElementStyleStrokeDemo>(0.02),
|
||||
std::make_shared<ElementStyleStrokeRadialGradientDemo>(0.2)
|
||||
};
|
||||
|
||||
std::vector<std::shared_ptr<Element>> element = {
|
||||
std::make_shared<Element>(Element{ contours[0].first, style[0], contours[0].second}),
|
||||
std::make_shared<Element>(Element{ contours[1].first, style[2], contours[1].second}),
|
||||
std::make_shared<Element>(Element{ contours[2].first, style[0], contours[2].second}),
|
||||
};
|
||||
Painting painting;
|
||||
painting.addElement(*element[0], ElementTransform{ glm::vec2(-0.45,-0.45), glm::vec2(0.5,0.5) / 2.f, 0, glm::bvec2(false), 0 });
|
||||
painting.addElement(*element[1], ElementTransform{ glm::vec2(-0.45, 0.45), glm::vec2(0.5,0.5) / 2.f, 0, glm::bvec2(false), 0 });
|
||||
painting.addElement(*element[2], ElementTransform{ glm::vec2(0.50,-0.45), glm::vec2(0.6,0.7) / 2.f, 0, glm::bvec2(false), 0 });
|
||||
painting.generateBuffers(this);*/
|
||||
|
||||
//auto index = vtManager->createVirtualTexture(painting);
|
||||
};
|
||||
void paintGL() override
|
||||
{
|
||||
glClearColor(219 / 255., 78 / 255., 32 / 255., 1.0);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
};
|
||||
void resizeGL(int w, int h) override {};
|
||||
};
|
||||
}
|
|
@ -65,11 +65,11 @@
|
|||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<LanguageStandard>stdcpp20</LanguageStandard>
|
||||
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;$(SolutionDIr)ArchitectureColoredPainting;$(SolutionDIr)ArchitectureColoredPainting\include;$(SolutionDIr)ArchitectureColoredPainting\src;$(SolutionDir)ArchitectureColoredPainting\src\Editor\RightBar;$(SolutionDir)ArchitectureColoredPainting\src\Editor\;$(SolutionDIr)ArchitectureColoredPainting\x64\Debug\uic;$(SolutionDir)FramelessHelper\include;$(SolutionDir)FramelessHelper\qmake\inc\core;$(SolutionDir)FramelessHelper\include\FramelessHelper\Core;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>$(VCInstallDir)UnitTest\include;$(SolutionDIr)ArchitectureColoredPainting;$(SolutionDIr)ArchitectureColoredPainting\include;$(SolutionDIr)ArchitectureColoredPainting\src;$(SolutionDir)ArchitectureColoredPainting\src\Editor\RightBar;$(SolutionDir)ArchitectureColoredPainting\src\Editor\;$(SolutionDIr)ArchitectureColoredPainting\x64\Debug\uic;$(SolutionDir)FramelessHelper\include;$(SolutionDir)FramelessHelper\qmake\inc\core;$(SolutionDir)FramelessHelper\include\FramelessHelper\Core;$(SolutionDir)qt-material-widgets\components;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>FRAMELESSHELPER_WIDGETS_STATIC;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>$(SolutionDIr)ArchitectureColoredPainting\x64\Debug\*.obj;$(SolutionDIr)FramelessHelper\qmake\FramelessHelperCore\debug\FramelessHelperCore.lib;$(SolutionDIr)FramelessHelper\qmake\FramelessHelperWidgets\debug\FramelessHelperWidgets.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>$(SolutionDIr)ArchitectureColoredPainting\x64\Debug\*.obj;$(SolutionDIr)FramelessHelper\qmake\FramelessHelperCore\debug\FramelessHelperCore.lib;$(SolutionDIr)FramelessHelper\qmake\FramelessHelperWidgets\debug\FramelessHelperWidgets.lib;$(SolutionDIr)qt-material-widgets\components\debug\components.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
@ -111,6 +111,12 @@
|
|||
<DynamicSource Condition="'$(Configuration)|$(Platform)'=='Release|x64'">input</DynamicSource>
|
||||
<QtMocFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Filename).moc</QtMocFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PaintingTest.cpp">
|
||||
<DynamicSource Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">input</DynamicSource>
|
||||
<QtMocFileName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(Filename).moc</QtMocFileName>
|
||||
<DynamicSource Condition="'$(Configuration)|$(Platform)'=='Release|x64'">input</DynamicSource>
|
||||
<QtMocFileName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(Filename).moc</QtMocFileName>
|
||||
</ClCompile>
|
||||
<ClCompile Include="UnitTest.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -125,6 +131,9 @@
|
|||
<ItemGroup>
|
||||
<QtMoc Include="ElementRendererTest.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<QtMoc Include="PaintingTest.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
|
||||
<Import Project="$(QtMsBuild)\qt.targets" />
|
||||
|
|
|
@ -37,10 +37,16 @@
|
|||
<QtMoc Include="ElementRendererTest.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
<QtMoc Include="PaintingTest.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</QtMoc>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="ElementRendererTest.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="PaintingTest.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
Loading…
Reference in New Issue