Compare commits
8 Commits
64c4646783
...
e7825a0665
Author | SHA1 | Date |
---|---|---|
ArgonarioD | e7825a0665 | |
ArgonarioD | 93db81503a | |
ArgonarioD | 412e2eec5e | |
wuyize | b6e79ee6de | |
karlis | b3bbf6c1be | |
karlis | 8bf6835c23 | |
karlis | 3904ff0b61 | |
ArgonarioD | 587c09115a |
|
@ -202,6 +202,7 @@
|
||||||
<QtMoc Include="src\Editor\EditorWidgetComponent\ColorPicker.h" />
|
<QtMoc Include="src\Editor\EditorWidgetComponent\ColorPicker.h" />
|
||||||
<QtMoc Include="src\Editor\RightBar\EditorSettingWidget.h" />
|
<QtMoc Include="src\Editor\RightBar\EditorSettingWidget.h" />
|
||||||
<QtMoc Include="src\Editor\EditorWidgetComponent\FillStyleWidget.h" />
|
<QtMoc Include="src\Editor\EditorWidgetComponent\FillStyleWidget.h" />
|
||||||
|
<ClInclude Include="src\ColorHelper.hpp" />
|
||||||
<ClInclude Include="src\Editor\LayerWrapper.h" />
|
<ClInclude Include="src\Editor\LayerWrapper.h" />
|
||||||
<ClInclude Include="src\Editor\util\EncodeUtil.hpp" />
|
<ClInclude Include="src\Editor\util\EncodeUtil.hpp" />
|
||||||
<ClInclude Include="src\Editor\util\JsonUtil.hpp" />
|
<ClInclude Include="src\Editor\util\JsonUtil.hpp" />
|
||||||
|
|
|
@ -519,6 +519,9 @@
|
||||||
<ClInclude Include="src\Editor\LayerWrapper.h">
|
<ClInclude Include="src\Editor\LayerWrapper.h">
|
||||||
<Filter>Header Files\Editor\Layer</Filter>
|
<Filter>Header Files\Editor\Layer</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="src\ColorHelper.hpp">
|
||||||
|
<Filter>Header Files</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<QtRcc Include="res\MainWindow.qrc">
|
<QtRcc Include="res\MainWindow.qrc">
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
#pragma once
|
||||||
|
#include <lib/qtmaterialstyle.h>
|
||||||
|
#include <lib/qtmaterialtheme.h>
|
||||||
|
#include <QColorDialog>
|
||||||
|
|
||||||
|
class ColorHelper
|
||||||
|
{
|
||||||
|
QtMaterialTheme theme;
|
||||||
|
QColor primary1;
|
||||||
|
public:
|
||||||
|
|
||||||
|
void setPrimary1(const QColor& color)
|
||||||
|
{
|
||||||
|
theme.setColor("primary1", color);
|
||||||
|
primary1 = color;
|
||||||
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] QColor getPrimary1() const
|
||||||
|
{
|
||||||
|
return primary1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ColorHelper()
|
||||||
|
{
|
||||||
|
setPrimary1(QColor::fromRgb(0, 90, 158));
|
||||||
|
QtMaterialStyle::instance().setTheme(&theme);
|
||||||
|
}
|
||||||
|
|
||||||
|
static ColorHelper& instance()
|
||||||
|
{
|
||||||
|
static ColorHelper instance;
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
static QColor execColorDialog(
|
||||||
|
const QColor& initial = instance().getPrimary1(),
|
||||||
|
QWidget* parent = nullptr,
|
||||||
|
const QString& title = ""
|
||||||
|
) {
|
||||||
|
auto dialog = QColorDialog(initial, parent);
|
||||||
|
if (!title.isEmpty())
|
||||||
|
{
|
||||||
|
dialog.setWindowTitle(title);
|
||||||
|
}
|
||||||
|
dialog.adjustSize();
|
||||||
|
dialog.exec();
|
||||||
|
return dialog.selectedColor();
|
||||||
|
}
|
||||||
|
};
|
|
@ -1,5 +1,6 @@
|
||||||
#include "ColorPicker.h"
|
#include "ColorPicker.h"
|
||||||
#include <QColorDialog>
|
#include <QColorDialog>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
QString getStyleSheet(const QColor& color)
|
QString getStyleSheet(const QColor& color)
|
||||||
{
|
{
|
||||||
|
@ -26,9 +27,8 @@ QColor ColorPicker::getColor() const
|
||||||
|
|
||||||
void ColorPicker::onClicked()
|
void ColorPicker::onClicked()
|
||||||
{
|
{
|
||||||
QColorDialog dialog(this->color, this);
|
//const QColor newColor = QColorDialog::getColor(this->color, this);
|
||||||
dialog.exec();
|
const QColor newColor = ColorHelper::execColorDialog(this->color, this);
|
||||||
QColor newColor = dialog.selectedColor();
|
|
||||||
if (newColor.isValid() && this->color != newColor)
|
if (newColor.isValid() && this->color != newColor)
|
||||||
{
|
{
|
||||||
this->color = newColor;
|
this->color = newColor;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include "../ColorHelper.hpp"
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
class ColorPicker : public QPushButton
|
class ColorPicker : public QPushButton
|
||||||
{
|
{
|
||||||
|
@ -6,7 +7,7 @@ class ColorPicker : public QPushButton
|
||||||
private:
|
private:
|
||||||
QColor color;
|
QColor color;
|
||||||
public:
|
public:
|
||||||
ColorPicker(const QColor& color = QColor::fromRgb(0, 0, 0), QWidget* parent = nullptr);
|
ColorPicker(const QColor& color = ColorHelper::instance().getPrimary1(), QWidget* parent = nullptr);
|
||||||
QColor getColor() const;
|
QColor getColor() const;
|
||||||
public slots:
|
public slots:
|
||||||
void onClicked();
|
void onClicked();
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <qtmaterialtextfield.h>
|
#include <qtmaterialtextfield.h>
|
||||||
|
|
||||||
FillStyleWidget::FillStyleWidget(std::shared_ptr<Renderer::MaterialStyleFill> fill, QWidget* parent)
|
FillStyleWidget::FillStyleWidget(std::shared_ptr<MaterialStyleFill> fill, QWidget* parent)
|
||||||
: QWidget(parent), fill(fill)
|
: QWidget(parent), fill(fill)
|
||||||
{
|
{
|
||||||
auto* layout = new QGridLayout(this);
|
auto* layout = new QGridLayout(this);
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
#include "LayerStyleDialog.h"
|
#include "LayerStyleDialog.h"
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
|
|
||||||
LayerStyleDialog::LayerStyleDialog(
|
LayerStyleDialog::LayerStyleDialog(
|
||||||
LayerStyleContainer& styles,
|
LayerStyleContainer& styles,
|
||||||
std::shared_ptr<LayerStyle> existedStyle,
|
const std::shared_ptr<LayerStyle>& existedStyle,
|
||||||
QWidget* parent
|
QWidget* parent
|
||||||
) : QDialog(parent), styles(&styles)
|
) : QDialog(parent), styles(&styles)
|
||||||
{
|
{
|
||||||
auto* dialogLayout = new QVBoxLayout(this);
|
dialogLayout = new QGridLayout;
|
||||||
dialogLayout->setAlignment(Qt::AlignmentFlag::AlignHCenter);
|
dialogLayout->setAlignment(Qt::AlignmentFlag::AlignHCenter);
|
||||||
this->setLayout(dialogLayout);
|
this->setLayout(dialogLayout);
|
||||||
|
|
||||||
|
@ -18,11 +17,9 @@ LayerStyleDialog::LayerStyleDialog(
|
||||||
{
|
{
|
||||||
this->modifyingStyle = existedStyle->clone();
|
this->modifyingStyle = existedStyle->clone();
|
||||||
|
|
||||||
this->styleContainer = nullptr;
|
|
||||||
this->styleWidget = modifyingStyle->getInputWidget();
|
this->styleWidget = modifyingStyle->getInputWidget();
|
||||||
this->styleWidget->setParent(this);
|
this->styleWidget->setParent(this);
|
||||||
dialogLayout->addWidget(styleWidget);
|
dialogLayout->addWidget(styleWidget, 1, 0);
|
||||||
// do something
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -34,13 +31,12 @@ LayerStyleDialog::LayerStyleDialog(
|
||||||
typeSelector->addItems(unusedStyleNames);
|
typeSelector->addItems(unusedStyleNames);
|
||||||
this->modifyingStyle = std::move(styles.makeUnusedStyle(unusedStyleNames[0]));
|
this->modifyingStyle = std::move(styles.makeUnusedStyle(unusedStyleNames[0]));
|
||||||
|
|
||||||
dialogLayout->addWidget(typeSelector);
|
dialogLayout->addWidget(typeSelector, 0, 0);
|
||||||
this->styleContainer = new QGridLayout(this);
|
|
||||||
dialogLayout->addLayout(styleContainer);
|
|
||||||
|
|
||||||
this->styleWidget = this->modifyingStyle->getInputWidget();
|
this->styleWidget = this->modifyingStyle->getInputWidget();
|
||||||
this->styleWidget->setParent(this);
|
this->styleWidget->setParent(this);
|
||||||
this->styleContainer->addWidget(styleWidget);
|
this->dialogLayout->addWidget(styleWidget, 1, 0);
|
||||||
connect(typeSelector, &QComboBox::currentTextChanged,
|
connect(typeSelector, &QComboBox::currentTextChanged,
|
||||||
this, &LayerStyleDialog::onStyleTypeSelectorChanged);
|
this, &LayerStyleDialog::onStyleTypeSelectorChanged);
|
||||||
}
|
}
|
||||||
|
@ -48,7 +44,8 @@ LayerStyleDialog::LayerStyleDialog(
|
||||||
auto* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
|
auto* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
|
||||||
connect(buttonBox, &QDialogButtonBox::accepted, this, &LayerStyleDialog::accept);
|
connect(buttonBox, &QDialogButtonBox::accepted, this, &LayerStyleDialog::accept);
|
||||||
connect(buttonBox, &QDialogButtonBox::rejected, this, &LayerStyleDialog::reject);
|
connect(buttonBox, &QDialogButtonBox::rejected, this, &LayerStyleDialog::reject);
|
||||||
dialogLayout->addWidget(buttonBox);
|
dialogLayout->addWidget(buttonBox, 2, 0);
|
||||||
|
this->adjustSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerStyleDialog::accept()
|
void LayerStyleDialog::accept()
|
||||||
|
@ -61,14 +58,14 @@ void LayerStyleDialog::onStyleTypeSelectorChanged(const QString& current)
|
||||||
{
|
{
|
||||||
if (this->styleWidget)
|
if (this->styleWidget)
|
||||||
{
|
{
|
||||||
this->styleContainer->removeWidget(this->styleWidget);
|
this->dialogLayout->removeWidget(this->styleWidget);
|
||||||
this->styleWidget->setParent(nullptr);
|
this->styleWidget->setParent(nullptr);
|
||||||
delete styleWidget;
|
delete styleWidget;
|
||||||
}
|
}
|
||||||
this->modifyingStyle = std::move(styles->makeUnusedStyle(current));
|
this->modifyingStyle = std::move(styles->makeUnusedStyle(current));
|
||||||
this->styleWidget = this->modifyingStyle->getInputWidget();
|
this->styleWidget = this->modifyingStyle->getInputWidget();
|
||||||
this->styleWidget->setParent(this);
|
this->styleWidget->setParent(this);
|
||||||
this->styleContainer->addWidget(styleWidget, 0, 0, 1, 1);
|
this->dialogLayout->addWidget(styleWidget, 1, 0);
|
||||||
this->styleWidget->adjustSize();
|
this->styleWidget->adjustSize();
|
||||||
this->adjustSize();
|
this->adjustSize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,13 +8,13 @@ class LayerStyleDialog : public QDialog
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
private:
|
private:
|
||||||
QWidget* styleWidget;
|
QWidget* styleWidget;
|
||||||
QGridLayout* styleContainer;
|
QGridLayout* dialogLayout;
|
||||||
LayerStyleContainer* styles;
|
LayerStyleContainer* styles;
|
||||||
std::unique_ptr<LayerStyle> modifyingStyle;
|
std::unique_ptr<LayerStyle> modifyingStyle;
|
||||||
public:
|
public:
|
||||||
LayerStyleDialog(
|
LayerStyleDialog(
|
||||||
LayerStyleContainer& styles,
|
LayerStyleContainer& styles,
|
||||||
std::shared_ptr<LayerStyle> existedStyle = nullptr,
|
const std::shared_ptr<LayerStyle>& existedStyle = nullptr,
|
||||||
QWidget* parent = nullptr
|
QWidget* parent = nullptr
|
||||||
);
|
);
|
||||||
std::shared_ptr<LayerStyle> layerStyle;
|
std::shared_ptr<LayerStyle> layerStyle;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
#include "StrokeStyleWidget.h"
|
#include "StrokeStyleWidget.h"
|
||||||
#include "ColorPicker.h"
|
#include "ColorPicker.h"
|
||||||
|
#include "../ColorHelper.hpp"
|
||||||
#include <qtmaterialraisedbutton.h>
|
#include <qtmaterialraisedbutton.h>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <lib/qtmaterialstyle.h>
|
|
||||||
|
|
||||||
constexpr int COLUMN_WIDTH = 0;
|
constexpr int COLUMN_WIDTH = 0;
|
||||||
constexpr int COLUMN_COLOR = 1;
|
constexpr int COLUMN_COLOR = 1;
|
||||||
|
@ -105,8 +105,8 @@ void StrokeStyleWidget::initTable(std::shared_ptr<Renderer::StrokeRadialGradient
|
||||||
row++;
|
row++;
|
||||||
}
|
}
|
||||||
// ÐÂÔö°´Å¥
|
// ÐÂÔö°´Å¥
|
||||||
QtMaterialRaisedButton* addButton = new QtMaterialRaisedButton("+", strokeTable);
|
auto* addButton = new QtMaterialRaisedButton("+", strokeTable);
|
||||||
addButton->setBackgroundColor(QtMaterialStyle::instance().themeColor("primary1"));
|
addButton->setBackgroundColor(ColorHelper::instance().getPrimary1());
|
||||||
strokeTable->setSpan(row, 0, 1, 5);
|
strokeTable->setSpan(row, 0, 1, 5);
|
||||||
strokeTable->setCellWidget(row, 0, addButton);
|
strokeTable->setCellWidget(row, 0, addButton);
|
||||||
strokeTable->setMinimumHeight(strokeTable->rowHeight(row) * 5);
|
strokeTable->setMinimumHeight(strokeTable->rowHeight(row) * 5);
|
||||||
|
@ -114,18 +114,18 @@ void StrokeStyleWidget::initTable(std::shared_ptr<Renderer::StrokeRadialGradient
|
||||||
addButton->setFixedHeight(strokeTable->rowHeight(row));
|
addButton->setFixedHeight(strokeTable->rowHeight(row));
|
||||||
connect(addButton, &QtMaterialRaisedButton::clicked, [this]() {
|
connect(addButton, &QtMaterialRaisedButton::clicked, [this]() {
|
||||||
handlingRowInsert = true;
|
handlingRowInsert = true;
|
||||||
auto materialMap = &(radialStroke(this->stroke)->materialMap);
|
auto materialMap = &radialStroke(this->stroke)->materialMap;
|
||||||
float newWidth = 0;
|
float newWidth;
|
||||||
if (materialMap->size() == 0)
|
if (materialMap->empty())
|
||||||
{
|
{
|
||||||
newWidth = 0.1;
|
newWidth = 0.1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto lastPair = materialMap->rbegin();
|
const auto lastPair = materialMap->rbegin();
|
||||||
newWidth = lastPair->first + 0.01;
|
newWidth = lastPair->first + 0.01;
|
||||||
}
|
}
|
||||||
Renderer::Material newMaterial(QColor::fromRgb(0, 0, 0));
|
const Renderer::Material newMaterial(ColorHelper::instance().getPrimary1());
|
||||||
(*materialMap)[newWidth] = newMaterial;
|
(*materialMap)[newWidth] = newMaterial;
|
||||||
int newRow = this->strokeTable->rowCount() - 1;
|
int newRow = this->strokeTable->rowCount() - 1;
|
||||||
this->strokeTable->insertRow(newRow);
|
this->strokeTable->insertRow(newRow);
|
||||||
|
@ -143,7 +143,7 @@ void StrokeStyleWidget::setTableRow(int row, float width, Renderer::Material& ma
|
||||||
widthItem->setData(Qt::EditRole, width);
|
widthItem->setData(Qt::EditRole, width);
|
||||||
strokeTable->setItem(row, COLUMN_WIDTH, widthItem);
|
strokeTable->setItem(row, COLUMN_WIDTH, widthItem);
|
||||||
|
|
||||||
QColor* colorPtr = &(material.color);
|
QColor* colorPtr = &material.color;
|
||||||
auto* colorItem = new QTableWidgetItem;
|
auto* colorItem = new QTableWidgetItem;
|
||||||
colorItem->setData(Qt::DisplayRole, *colorPtr);
|
colorItem->setData(Qt::DisplayRole, *colorPtr);
|
||||||
strokeTable->setItem(row, COLUMN_COLOR, colorItem);
|
strokeTable->setItem(row, COLUMN_COLOR, colorItem);
|
||||||
|
@ -163,7 +163,7 @@ void StrokeStyleWidget::setTableRow(int row, float width, Renderer::Material& ma
|
||||||
strokeTable->setItem(row, COLUMN_ROUGHNESS, roughnessItem);
|
strokeTable->setItem(row, COLUMN_ROUGHNESS, roughnessItem);
|
||||||
|
|
||||||
auto* removeButton = new QtMaterialRaisedButton("-", strokeTable);
|
auto* removeButton = new QtMaterialRaisedButton("-", strokeTable);
|
||||||
removeButton->setBackgroundColor(QtMaterialStyle::instance().themeColor("primary1"));
|
removeButton->setBackgroundColor(ColorHelper::instance().getPrimary1());
|
||||||
removeButton->setFixedSize(20, 20);
|
removeButton->setFixedSize(20, 20);
|
||||||
strokeTable->setCellWidget(row, COLUMN_OPERATIONS, removeButton);
|
strokeTable->setCellWidget(row, COLUMN_OPERATIONS, removeButton);
|
||||||
connect(removeButton, &QtMaterialRaisedButton::clicked, [this, row]() {
|
connect(removeButton, &QtMaterialRaisedButton::clicked, [this, row]() {
|
||||||
|
|
|
@ -23,8 +23,8 @@ private:
|
||||||
void setTableRow(int row, float width, Renderer::Material& material);
|
void setTableRow(int row, float width, Renderer::Material& material);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
StrokeStyleWidget(std::shared_ptr<Renderer::MaterialStyleStroke> stroke, QWidget* parent = nullptr);
|
StrokeStyleWidget(std::shared_ptr<MaterialStyleStroke> stroke, QWidget* parent = nullptr);
|
||||||
std::shared_ptr<Renderer::MaterialStyleStroke> stroke;
|
std::shared_ptr<MaterialStyleStroke> stroke;
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void onCurrentItemChanged(QTableWidgetItem* current, QTableWidgetItem* previous);
|
void onCurrentItemChanged(QTableWidgetItem* current, QTableWidgetItem* previous);
|
||||||
|
|
|
@ -19,6 +19,15 @@ EditorWidgetItem::EditorWidgetItem(QString filePath,QWidget *parent) : QWidget(p
|
||||||
elementInfoDisplayWidget->enableEdit();
|
elementInfoDisplayWidget->enableEdit();
|
||||||
qDebug() << layerInfoDisplayWidget;
|
qDebug() << layerInfoDisplayWidget;
|
||||||
qDebug() << elementInfoDisplayWidget;
|
qDebug() << elementInfoDisplayWidget;
|
||||||
|
auto centralRefresh = [this]() {
|
||||||
|
layerInfoDisplayWidget->refresh();
|
||||||
|
elementInfoDisplayWidget->refresh();
|
||||||
|
treeWidget->refresh();
|
||||||
|
previewWindow->refresh();
|
||||||
|
};
|
||||||
|
connect(layerInfoDisplayWidget, &InfoDisplayWidget::triggerCentralRefresh, centralRefresh);
|
||||||
|
connect(elementInfoDisplayWidget, &ElementPoolWidget::triggerCentralRefresh, centralRefresh);
|
||||||
|
connect(treeWidget, &LayerTreeWidget::triggerCentralRefresh, centralRefresh);
|
||||||
connect(editorSettingWidget, &EditorSettingWidget::backgroundColorChanged, this, &EditorWidgetItem::handleBackgroundColorChange);
|
connect(editorSettingWidget, &EditorSettingWidget::backgroundColorChanged, this, &EditorWidgetItem::handleBackgroundColorChange);
|
||||||
connect(editorSettingWidget, &EditorSettingWidget::projectNameChanged, this, &EditorWidgetItem::handleProjectNameChange);
|
connect(editorSettingWidget, &EditorSettingWidget::projectNameChanged, this, &EditorWidgetItem::handleProjectNameChange);
|
||||||
connect(previewWindow, &PreviewWindow::refreshElementPreviewByIndex, elementInfoDisplayWidget, &ElementPoolWidget::refreshPictureByIndex);
|
connect(previewWindow, &PreviewWindow::refreshElementPreviewByIndex, elementInfoDisplayWidget, &ElementPoolWidget::refreshPictureByIndex);
|
||||||
|
|
|
@ -67,7 +67,6 @@ void ElementPoolWidget::setElementManager(ElementManager* element)
|
||||||
|
|
||||||
void ElementPoolWidget::refresh() {
|
void ElementPoolWidget::refresh() {
|
||||||
this->setElementList(this->elementManager->elements);
|
this->setElementList(this->elementManager->elements);
|
||||||
emit refreshLayerTree();
|
|
||||||
// update();
|
// update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -113,13 +112,14 @@ void ElementPoolWidget::popMenu(const QPoint& pos)
|
||||||
if (bOk && !sName.isEmpty())
|
if (bOk && !sName.isEmpty())
|
||||||
{
|
{
|
||||||
currentElement->name = sName;
|
currentElement->name = sName;
|
||||||
refresh();
|
emit triggerCentralRefresh();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
menu->addAction(QString::fromLocal8Bit("ɾ³ý"), this, [this, currentElement]() {
|
menu->addAction(QString::fromLocal8Bit("ɾ³ý"), this, [this, currentElement]() {
|
||||||
this->elementManager->removeElement(currentElement);
|
this->elementManager->removeElement(currentElement);
|
||||||
refresh();
|
emit triggerCentralRefresh();
|
||||||
});
|
});
|
||||||
|
menu->actions().last()->setDisabled(currentElement->referencedCount > 0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -129,7 +129,7 @@ void ElementPoolWidget::popMenu(const QPoint& pos)
|
||||||
QString fileName = fileInfo.fileName();
|
QString fileName = fileInfo.fileName();
|
||||||
qDebug() << fileName << " " << filePath;
|
qDebug() << fileName << " " << filePath;
|
||||||
this->elementManager->createSimpleElement(fileName, filePath);
|
this->elementManager->createSimpleElement(fileName, filePath);
|
||||||
refresh();
|
emit triggerCentralRefresh();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
menu->popup(mapToGlobal(pos));
|
menu->popup(mapToGlobal(pos));
|
||||||
|
|
|
@ -26,6 +26,7 @@ public:
|
||||||
signals:
|
signals:
|
||||||
void elementSelected(GraphicElement* element);
|
void elementSelected(GraphicElement* element);
|
||||||
void refreshLayerTree();
|
void refreshLayerTree();
|
||||||
|
void triggerCentralRefresh();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
int pictureItemClicked(QListWidgetItem* item);
|
int pictureItemClicked(QListWidgetItem* item);
|
||||||
|
|
|
@ -20,6 +20,7 @@ class ComposedPainterPath;
|
||||||
class GraphicElement
|
class GraphicElement
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
size_t referencedCount = 0;
|
||||||
Renderer::ElementRenderer *renderer;
|
Renderer::ElementRenderer *renderer;
|
||||||
QString name = "";
|
QString name = "";
|
||||||
int index;
|
int index;
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "./EditorWidgetComponent/StrokeStyleWidget.h"
|
#include "./EditorWidgetComponent/StrokeStyleWidget.h"
|
||||||
#include "./EditorWidgetComponent/FillStyleWidget.h"
|
#include "./EditorWidgetComponent/FillStyleWidget.h"
|
||||||
#include "./util/EncodeUtil.hpp"
|
#include "./util/EncodeUtil.hpp"
|
||||||
|
#include "../ColorHelper.hpp"
|
||||||
#include <qtmaterialcheckbox.h>
|
#include <qtmaterialcheckbox.h>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
@ -206,11 +207,11 @@ bool LayerStyleContainer::dropStyle(const QString& styleName)
|
||||||
|
|
||||||
float LayerStyleContainer::boundingBoxAffectValue() const {
|
float LayerStyleContainer::boundingBoxAffectValue() const {
|
||||||
float maxLineWidth = 0;
|
float maxLineWidth = 0;
|
||||||
const auto strokeStyle = styles.at(StrokeElementLayerStyle::displayName());
|
const auto strokeStyle = styles.find(StrokeElementLayerStyle::displayName());
|
||||||
if (strokeStyle != nullptr)
|
if (strokeStyle != styles.end())
|
||||||
{
|
{
|
||||||
if (const auto strokeElementLayerStyle =
|
if (const auto strokeElementLayerStyle =
|
||||||
std::dynamic_pointer_cast<StrokeElementLayerStyle>(strokeStyle);
|
std::dynamic_pointer_cast<StrokeElementLayerStyle>(strokeStyle->second);
|
||||||
strokeElementLayerStyle != nullptr)
|
strokeElementLayerStyle != nullptr)
|
||||||
{
|
{
|
||||||
const auto& leftStyleStroke = strokeElementLayerStyle->strokePair.first;
|
const auto& leftStyleStroke = strokeElementLayerStyle->strokePair.first;
|
||||||
|
@ -334,7 +335,7 @@ FillElementLayerStyle::FillElementLayerStyle(const PMaterialStyleFill& fillMater
|
||||||
if (!fillMaterialStyle)
|
if (!fillMaterialStyle)
|
||||||
{
|
{
|
||||||
this->fillMaterialStyle = std::make_shared<MaterialStyleFill>(
|
this->fillMaterialStyle = std::make_shared<MaterialStyleFill>(
|
||||||
std::make_shared<Renderer::FillPlain>(Renderer::Material(QColor::fromRgb(0, 0, 0)))
|
std::make_shared<Renderer::FillPlain>(ColorHelper::instance().getPrimary1())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,6 +79,14 @@ LeafLayerWrapper::LeafLayerWrapper(QJsonObject json, ElementManager* elementMana
|
||||||
styles(LayerStyleContainer::fromJson(wrappedElement->isClosed(), json.value("styles").toArray()))
|
styles(LayerStyleContainer::fromJson(wrappedElement->isClosed(), json.value("styles").toArray()))
|
||||||
{
|
{
|
||||||
qDebug() << json.value("name").toString() << " " << this;
|
qDebug() << json.value("name").toString() << " " << this;
|
||||||
|
if(wrappedElement != nullptr)
|
||||||
|
wrappedElement->referencedCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
LeafLayerWrapper::~LeafLayerWrapper()
|
||||||
|
{
|
||||||
|
if (wrappedElement != nullptr)
|
||||||
|
wrappedElement->referencedCount--;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerWrapper::SimpleProperty::apply(PixelPath&cache)
|
void LayerWrapper::SimpleProperty::apply(PixelPath&cache)
|
||||||
|
@ -368,4 +376,56 @@ void FolderLayerWrapper::refreshTreeItem()
|
||||||
this->qTreeWidgetItem->setText(1, "<< " + ele->name);
|
this->qTreeWidgetItem->setText(1, "<< " + ele->name);
|
||||||
this->qTreeWidgetItem->setTextColor(1, Qt::darkGreen);
|
this->qTreeWidgetItem->setTextColor(1, Qt::darkGreen);
|
||||||
}
|
}
|
||||||
|
if (this->referencedCount() > 0)
|
||||||
|
{
|
||||||
|
this->qTreeWidgetItem->setToolTip(0,QString::fromLocal8Bit("子树被引用计数:") + QString::number(this->referencedCount(true)) + "\n"
|
||||||
|
+ QString::fromLocal8Bit("当前节点被引用计数:") + QString::number(this->getReferencedBy() != -1));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->qTreeWidgetItem->setToolTip(0, "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t LayerWrapper::referencedCount(bool excludeSelf) const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
size_t FolderLayerWrapper::referencedCount(bool excludeSelf) const
|
||||||
|
{
|
||||||
|
size_t count = 0;
|
||||||
|
for (auto& child : children)
|
||||||
|
count += child->referencedCount();
|
||||||
|
if (!excludeSelf && this->getReferencedBy() != -1)
|
||||||
|
count++;
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LayerWrapper::deleteable(bool excludeSubTree) const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FolderLayerWrapper::deleteable(bool excludeSubTree) const
|
||||||
|
{
|
||||||
|
if (excludeSubTree)
|
||||||
|
return this->getReferencedBy() == -1;
|
||||||
|
else
|
||||||
|
return this->referencedCount() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LayerWrapper::referencingGroupElement() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LeafLayerWrapper::referencingGroupElement() const
|
||||||
|
{
|
||||||
|
return typeid(*wrappedElement) == typeid(GroupElement);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LayerWrapper::canApplyStyles() const
|
||||||
|
{
|
||||||
|
return typeid(*this) == typeid(LeafLayerWrapper) && !referencingGroupElement();
|
||||||
}
|
}
|
|
@ -71,6 +71,10 @@ class LayerWrapper
|
||||||
virtual void collectUpReachable(std::set<LayerWrapper*>& reachable);
|
virtual void collectUpReachable(std::set<LayerWrapper*>& reachable);
|
||||||
virtual void collectDownReachable(std::set<LayerWrapper*>& reachable);
|
virtual void collectDownReachable(std::set<LayerWrapper*>& reachable);
|
||||||
virtual void refreshTreeItem();
|
virtual void refreshTreeItem();
|
||||||
|
virtual size_t referencedCount(bool excludeSelf = false) const;
|
||||||
|
virtual bool deleteable(bool excludeSubTree = false) const;
|
||||||
|
virtual bool referencingGroupElement() const;
|
||||||
|
bool canApplyStyles() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FolderLayerWrapper : public LayerWrapper
|
class FolderLayerWrapper : public LayerWrapper
|
||||||
|
@ -96,6 +100,8 @@ class FolderLayerWrapper : public LayerWrapper
|
||||||
void paint(QPainter* painter, QTransform transform = QTransform(), bool ignoreSelected = false) override;
|
void paint(QPainter* painter, QTransform transform = QTransform(), bool ignoreSelected = false) override;
|
||||||
void collectDownReachable(std::set<LayerWrapper*>& reachable) override;
|
void collectDownReachable(std::set<LayerWrapper*>& reachable) override;
|
||||||
void refreshTreeItem() override;
|
void refreshTreeItem() override;
|
||||||
|
size_t referencedCount(bool excludeSelf = false) const override;
|
||||||
|
bool deleteable(bool excludeSubTree = false) const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class LeafLayerWrapper : public LayerWrapper
|
class LeafLayerWrapper : public LayerWrapper
|
||||||
|
@ -105,7 +111,7 @@ class LeafLayerWrapper : public LayerWrapper
|
||||||
LayerStyleContainer styles;
|
LayerStyleContainer styles;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
~LeafLayerWrapper() = default;
|
~LeafLayerWrapper();
|
||||||
void refresh(LayerWrapper* layer = nullptr) override;
|
void refresh(LayerWrapper* layer = nullptr) override;
|
||||||
LeafLayerWrapper(QJsonObject json, ElementManager *elementManager, FolderLayerWrapper*parent);
|
LeafLayerWrapper(QJsonObject json, ElementManager *elementManager, FolderLayerWrapper*parent);
|
||||||
QJsonObject toJson() const override;
|
QJsonObject toJson() const override;
|
||||||
|
@ -113,6 +119,7 @@ class LeafLayerWrapper : public LayerWrapper
|
||||||
void collectDownReachable(std::set<LayerWrapper*>& reachable) override;
|
void collectDownReachable(std::set<LayerWrapper*>& reachable) override;
|
||||||
QTreeWidgetItem* getQTreeItem() override;
|
QTreeWidgetItem* getQTreeItem() override;
|
||||||
void refreshTreeItem() override;
|
void refreshTreeItem() override;
|
||||||
|
bool referencingGroupElement() const override;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(LayerWrapper *)
|
Q_DECLARE_METATYPE(LayerWrapper *)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#include "EditorSettingWidget.h"
|
#include "EditorSettingWidget.h"
|
||||||
|
#include "../ColorHelper.hpp"
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QColorDialog>
|
|
||||||
#include <QInputDialog>
|
#include <QInputDialog>
|
||||||
|
|
||||||
EditorSettingWidget::EditorSettingWidget(QWidget* parent)
|
EditorSettingWidget::EditorSettingWidget(QWidget* parent)
|
||||||
|
@ -8,7 +8,7 @@ EditorSettingWidget::EditorSettingWidget(QWidget* parent)
|
||||||
{
|
{
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
connect(ui.backgroundColorButton, &QPushButton::clicked, this, [this]() {
|
connect(ui.backgroundColorButton, &QPushButton::clicked, this, [this]() {
|
||||||
QColor color = QColorDialog::getColor(Qt::white, this, QString::fromLocal8Bit("Ñ¡Ôñ±³¾°ÑÕÉ«"));
|
QColor color = ColorHelper::execColorDialog(Qt::white, this, QString::fromLocal8Bit("Ñ¡Ôñ±³¾°ÑÕÉ«"));
|
||||||
if (color.isValid())
|
if (color.isValid())
|
||||||
{
|
{
|
||||||
emit backgroundColorChanged(color);
|
emit backgroundColorChanged(color);
|
||||||
|
|
|
@ -45,32 +45,27 @@ void InfoDisplayWidget::generateLayerForm()
|
||||||
rotation->setValidator(new QIntValidator(-10000, 10000, this));
|
rotation->setValidator(new QIntValidator(-10000, 10000, this));
|
||||||
connect(rotation, &QLineEdit::textChanged, [=](QString content) {
|
connect(rotation, &QLineEdit::textChanged, [=](QString content) {
|
||||||
this->displayLayer->property.rotation = content.toDouble();
|
this->displayLayer->property.rotation = content.toDouble();
|
||||||
emit requireRefreshElementWidget();
|
emit triggerCentralRefresh();
|
||||||
emit requireRefreshPreview();
|
|
||||||
});
|
});
|
||||||
offsetX->setValidator(new QIntValidator(-10000, 10000, this));
|
offsetX->setValidator(new QIntValidator(-10000, 10000, this));
|
||||||
connect(offsetX, &QLineEdit::textChanged, [=](QString content) {
|
connect(offsetX, &QLineEdit::textChanged, [=](QString content) {
|
||||||
this->displayLayer->property.offset = {content.toDouble(), this->displayLayer->property.offset.y()};
|
this->displayLayer->property.offset = {content.toDouble(), this->displayLayer->property.offset.y()};
|
||||||
emit requireRefreshElementWidget();
|
emit triggerCentralRefresh();
|
||||||
emit requireRefreshPreview();
|
|
||||||
});
|
});
|
||||||
offsetY->setValidator(new QIntValidator(-10000, 10000, this));
|
offsetY->setValidator(new QIntValidator(-10000, 10000, this));
|
||||||
connect(offsetY, &QLineEdit::textChanged, [=](QString content) {
|
connect(offsetY, &QLineEdit::textChanged, [=](QString content) {
|
||||||
this->displayLayer->property.offset = {this->displayLayer->property.offset.x(), content.toDouble()};
|
this->displayLayer->property.offset = {this->displayLayer->property.offset.x(), content.toDouble()};
|
||||||
emit requireRefreshElementWidget();
|
emit triggerCentralRefresh();
|
||||||
emit requireRefreshPreview();
|
|
||||||
});
|
});
|
||||||
scaleX->setValidator(new QDoubleValidator(-1000, 1000, 4, this));
|
scaleX->setValidator(new QDoubleValidator(-1000, 1000, 4, this));
|
||||||
connect(scaleX, &QLineEdit::textChanged, [=](QString content) {
|
connect(scaleX, &QLineEdit::textChanged, [=](QString content) {
|
||||||
this->displayLayer->property.scale = {content.toDouble(), this->displayLayer->property.scale.y()};
|
this->displayLayer->property.scale = {content.toDouble(), this->displayLayer->property.scale.y()};
|
||||||
emit requireRefreshElementWidget();
|
emit triggerCentralRefresh();
|
||||||
emit requireRefreshPreview();
|
|
||||||
});
|
});
|
||||||
scaleY->setValidator(new QDoubleValidator(-1000, 1000, 4, this));
|
scaleY->setValidator(new QDoubleValidator(-1000, 1000, 4, this));
|
||||||
connect(scaleY, &QLineEdit::textChanged, [=](QString content) {
|
connect(scaleY, &QLineEdit::textChanged, [=](QString content) {
|
||||||
this->displayLayer->property.scale = {this->displayLayer->property.scale.x(), content.toDouble()};
|
this->displayLayer->property.scale = {this->displayLayer->property.scale.x(), content.toDouble()};
|
||||||
emit requireRefreshElementWidget();
|
emit triggerCentralRefresh();
|
||||||
emit requireRefreshPreview();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
layout->addRow("layer name:", name);
|
layout->addRow("layer name:", name);
|
||||||
|
@ -108,10 +103,7 @@ void InfoDisplayWidget::generateLayerForm()
|
||||||
{
|
{
|
||||||
leafP->styles.useStyle(dialog->layerStyle);
|
leafP->styles.useStyle(dialog->layerStyle);
|
||||||
leafP->styles.computeNewHash();
|
leafP->styles.computeNewHash();
|
||||||
|
emit triggerCentralRefresh();
|
||||||
emit requireRefreshPreview();
|
|
||||||
emit requireSelfRefresh();
|
|
||||||
emit requireRefreshElementWidget();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -153,10 +145,7 @@ void InfoDisplayWidget::generateLayerForm()
|
||||||
{
|
{
|
||||||
styleIterator->second = dialog->layerStyle;
|
styleIterator->second = dialog->layerStyle;
|
||||||
styles->computeNewHash();
|
styles->computeNewHash();
|
||||||
|
emit triggerCentralRefresh();
|
||||||
emit requireRefreshPreview();
|
|
||||||
emit requireSelfRefresh();
|
|
||||||
emit requireRefreshElementWidget();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -165,10 +154,7 @@ void InfoDisplayWidget::generateLayerForm()
|
||||||
{
|
{
|
||||||
styles->dropStyle(styleIterator->first);
|
styles->dropStyle(styleIterator->first);
|
||||||
styles->computeNewHash();
|
styles->computeNewHash();
|
||||||
|
emit triggerCentralRefresh();
|
||||||
emit requireRefreshPreview();
|
|
||||||
emit requireSelfRefresh();
|
|
||||||
emit requireRefreshElementWidget();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
QWidget* styleDisplayWidget = styleIterator->second->getListDisplayWidget();
|
QWidget* styleDisplayWidget = styleIterator->second->getListDisplayWidget();
|
||||||
|
@ -194,3 +180,9 @@ void InfoDisplayWidget::triggerSelfRefresh()
|
||||||
if (this->displayLayer != nullptr)
|
if (this->displayLayer != nullptr)
|
||||||
this->generateLayerForm();
|
this->generateLayerForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InfoDisplayWidget::refresh()
|
||||||
|
{
|
||||||
|
if (this->displayLayer != nullptr)
|
||||||
|
this->generateLayerForm();
|
||||||
|
}
|
|
@ -16,11 +16,13 @@ class InfoDisplayWidget : public QWidget
|
||||||
public:
|
public:
|
||||||
void setLayer(LayerWrapper *layer);
|
void setLayer(LayerWrapper *layer);
|
||||||
void generateLayerForm();
|
void generateLayerForm();
|
||||||
|
void refresh();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void triggerSelfRefresh();
|
void triggerSelfRefresh();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
void triggerCentralRefresh();
|
||||||
void requireRefreshPreview();
|
void requireRefreshPreview();
|
||||||
void requireSelfRefresh();
|
void requireSelfRefresh();
|
||||||
void requireRefreshElementWidget();
|
void requireRefreshElementWidget();
|
||||||
|
|
|
@ -24,7 +24,7 @@ LayerTreeWidget::LayerTreeWidget(QWidget *parent)
|
||||||
else {
|
else {
|
||||||
emit displayLayerChange(nullptr);
|
emit displayLayerChange(nullptr);
|
||||||
}
|
}
|
||||||
emit requireRefreshPreview();
|
emit triggerCentralRefresh();
|
||||||
});
|
});
|
||||||
// connect(this, &QTreeWidget::itemDoubleClicked, this, &LayerTreeWidget::onItemDoubleClicked);
|
// connect(this, &QTreeWidget::itemDoubleClicked, this, &LayerTreeWidget::onItemDoubleClicked);
|
||||||
}
|
}
|
||||||
|
@ -62,9 +62,7 @@ void LayerTreeWidget::popMenu(const QPoint &pos)
|
||||||
folderLayer->addChild(std::shared_ptr<LayerWrapper>(newLayer));
|
folderLayer->addChild(std::shared_ptr<LayerWrapper>(newLayer));
|
||||||
folderLayer->qTreeWidgetItem->addChild(newLayer->getQTreeItem());
|
folderLayer->qTreeWidgetItem->addChild(newLayer->getQTreeItem());
|
||||||
qDebug() << jsonObj<<"----------------------";
|
qDebug() << jsonObj<<"----------------------";
|
||||||
this->refresh();
|
emit triggerCentralRefresh();
|
||||||
emit requireRefreshPreview();
|
|
||||||
emit requireRefreshElementWidget();
|
|
||||||
});
|
});
|
||||||
dialog->exec();
|
dialog->exec();
|
||||||
});
|
});
|
||||||
|
@ -74,20 +72,20 @@ void LayerTreeWidget::popMenu(const QPoint &pos)
|
||||||
auto layer = this->selectedItem->data(0, Qt::UserRole).value<LayerWrapper*>();
|
auto layer = this->selectedItem->data(0, Qt::UserRole).value<LayerWrapper*>();
|
||||||
layer->del();
|
layer->del();
|
||||||
layer->getParent()->removeChild(layer);
|
layer->getParent()->removeChild(layer);
|
||||||
this->refresh();
|
emit triggerCentralRefresh();
|
||||||
emit requireRefreshPreview();
|
|
||||||
emit requireRefreshElementWidget();
|
|
||||||
});
|
});
|
||||||
|
menu.actions().last()->setEnabled(layer->deleteable());
|
||||||
menu.addAction(QString::fromLocal8Bit("重命名"), this, &LayerTreeWidget::onRenameEvent);
|
menu.addAction(QString::fromLocal8Bit("重命名"), this, &LayerTreeWidget::onRenameEvent);
|
||||||
if(typeid(*layer) == typeid(FolderLayerWrapper))
|
if(typeid(*layer) == typeid(FolderLayerWrapper))
|
||||||
|
{
|
||||||
menu.addAction(QString::fromLocal8Bit("删除(保留子节点)"), this, [this]() {
|
menu.addAction(QString::fromLocal8Bit("删除(保留子节点)"), this, [this]() {
|
||||||
auto layer = this->selectedItem->data(0, Qt::UserRole).value<LayerWrapper*>();
|
auto layer = this->selectedItem->data(0, Qt::UserRole).value<LayerWrapper*>();
|
||||||
layer->delSelf();
|
layer->delSelf();
|
||||||
layer->getParent()->removeChild(layer);
|
layer->getParent()->removeChild(layer);
|
||||||
this->refresh();
|
emit triggerCentralRefresh();
|
||||||
emit requireRefreshPreview();
|
|
||||||
emit requireRefreshElementWidget();
|
|
||||||
});
|
});
|
||||||
|
menu.actions().last()->setEnabled(layer->deleteable(true));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (typeid(*layer) == typeid(FolderLayerWrapper) && ((FolderLayerWrapper*)layer)->getReferencedBy() == -1) {
|
if (typeid(*layer) == typeid(FolderLayerWrapper) && ((FolderLayerWrapper*)layer)->getReferencedBy() == -1) {
|
||||||
menu.addAction(QString::fromLocal8Bit("创建组合元素"), this, [this]() {
|
menu.addAction(QString::fromLocal8Bit("创建组合元素"), this, [this]() {
|
||||||
|
@ -99,7 +97,7 @@ void LayerTreeWidget::popMenu(const QPoint &pos)
|
||||||
"", &ok);
|
"", &ok);
|
||||||
if (ok && !name.isEmpty()) {
|
if (ok && !name.isEmpty()) {
|
||||||
elementManager->createGroupElement(name, layer);
|
elementManager->createGroupElement(name, layer);
|
||||||
emit requireRefreshElementWidget();
|
emit triggerCentralRefresh();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,6 +21,7 @@ class LayerTreeWidget : public QTreeWidget
|
||||||
// void onItemDoubleClicked(QTreeWidgetItem *item, int column = 0);
|
// void onItemDoubleClicked(QTreeWidgetItem *item, int column = 0);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
void triggerCentralRefresh();
|
||||||
void displayLayerChange(LayerWrapper *);
|
void displayLayerChange(LayerWrapper *);
|
||||||
void requireRefreshPreview();
|
void requireRefreshPreview();
|
||||||
void requireRefreshElementWidget();
|
void requireRefreshElementWidget();
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
using Renderer::Painting;
|
using Renderer::Painting;
|
||||||
using Renderer::Element;
|
using Renderer::BaseElement;
|
||||||
using Renderer::ElementTransform;
|
using Renderer::ElementTransform;
|
||||||
using glm::bvec2;
|
using glm::bvec2;
|
||||||
using std::max;
|
using std::max;
|
||||||
|
@ -17,161 +17,124 @@ using std::queue;
|
||||||
const double PaintingUtil::pi = acos(-1);
|
const double PaintingUtil::pi = acos(-1);
|
||||||
|
|
||||||
struct LayerNode {
|
struct LayerNode {
|
||||||
LayerWrapper* nowLayer;
|
LayerWrapper* nowLayer;
|
||||||
QTransform transfrom;
|
QTransform transfrom;
|
||||||
bvec2 flip;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
QJsonObject PaintingUtil::readJsonFile(QString jsonFilePath) {
|
QJsonObject PaintingUtil::readJsonFile(QString jsonFilePath) {
|
||||||
QFile jsonFile(jsonFilePath);
|
QFile jsonFile(jsonFilePath);
|
||||||
jsonFile.open(QFile::ReadOnly);
|
qDebug() << jsonFilePath;
|
||||||
QByteArray fileContent = jsonFile.readAll().trimmed();
|
jsonFile.open(QFile::ReadOnly);
|
||||||
jsonFile.close();
|
QByteArray fileContent = jsonFile.readAll().trimmed();
|
||||||
QJsonParseError jError;
|
jsonFile.close();
|
||||||
QJsonDocument jsonDoc(QJsonDocument::fromJson(fileContent, &jError));
|
QJsonParseError jError;
|
||||||
return jsonDoc.object();
|
QJsonDocument jsonDoc(QJsonDocument::fromJson(fileContent, &jError));
|
||||||
|
return jsonDoc.object();
|
||||||
}
|
}
|
||||||
|
|
||||||
Painting PaintingUtil::transfromToPainting(QString jsonFilePath) {
|
Painting PaintingUtil::transfromToPainting(QString jsonFilePath) {
|
||||||
Painting painting;
|
Painting painting;
|
||||||
glm::bvec2 flip(0, 0);
|
glm::bvec2 flip(0, 0);
|
||||||
QJsonObject jsonObj = readJsonFile(jsonFilePath);
|
QJsonObject jsonObj = readJsonFile(jsonFilePath);
|
||||||
qDebug() << jsonObj;
|
qDebug() << jsonObj;
|
||||||
shared_ptr<ElementManager> elementManager = make_shared<ElementManager>(jsonObj, Renderer::ElementRenderer::instance());
|
shared_ptr<ElementManager> elementManager = make_shared<ElementManager>(jsonObj, Renderer::ElementRenderer::instance());
|
||||||
shared_ptr<LayerManager> layerManager = make_shared<LayerManager>(jsonObj, elementManager.get());
|
shared_ptr<LayerManager> layerManager = make_shared<LayerManager>(jsonObj, elementManager.get());
|
||||||
//qDebug() << elementManager->toJson();
|
//qDebug() << elementManager->toJson();
|
||||||
//qDebug() << layerManager->toJson();
|
//qDebug() << layerManager->toJson();
|
||||||
//qDebug() << ((SimpleElement*)((LeafLayerWrapper*)((FolderLayerWrapper*)((FolderLayerWrapper*)layerManager->getRoot())->children[0].get())->children[0].get())->wrappedElement)->painterPath;
|
//qDebug() << ((SimpleElement*)((LeafLayerWrapper*)((FolderLayerWrapper*)((FolderLayerWrapper*)layerManager->getRoot())->children[0].get())->children[0].get())->wrappedElement)->painterPath;
|
||||||
//qDebug() << ((LeafLayerWrapper*)((FolderLayerWrapper*)((FolderLayerWrapper*)layerManager->getRoot())->children[0].get())->children[0].get())->getCache().painterPath;
|
//qDebug() << ((LeafLayerWrapper*)((FolderLayerWrapper*)((FolderLayerWrapper*)layerManager->getRoot())->children[0].get())->children[0].get())->getCache().painterPath;
|
||||||
queue<LayerNode> layerQueue;
|
//qDebug() << elementManager->toJson();
|
||||||
LayerWrapper* root = layerManager->getRoot();
|
//qDebug() << layerManager->toJson();
|
||||||
root->getCache();
|
//qDebug() << ((SimpleElement*)((LeafLayerWrapper*)((FolderLayerWrapper*)((FolderLayerWrapper*)layerManager->getRoot())->children[0].get())->children[0].get())->wrappedElement)->painterPath;
|
||||||
layerQueue.push({ root, root->property.transform, flip });
|
//qDebug() << ((LeafLayerWrapper*)((FolderLayerWrapper*)((FolderLayerWrapper*)layerManager->getRoot())->children[0].get())->children[0].get())->getCache().painterPath;
|
||||||
while (!layerQueue.empty()) {
|
queue<LayerNode> layerQueue;
|
||||||
auto layerNode = layerQueue.front();
|
LayerWrapper* root = layerManager->getRoot();
|
||||||
layerQueue.pop();
|
root->getCache();
|
||||||
FolderLayerWrapper* nowLayer = handleLayerWrapper(layerNode.nowLayer, layerNode.transfrom, layerNode.flip, painting);
|
//double maxLineWidth = getMaxLineWidth(root);
|
||||||
if (nowLayer != nullptr) {
|
layerQueue.push({ root, root->property.transform });
|
||||||
for (auto sonLayer : nowLayer->children) {
|
while (!layerQueue.empty()) {
|
||||||
layerQueue.push({ sonLayer.get(), layerNode.transfrom, layerNode.flip});
|
auto layerNode = layerQueue.front();
|
||||||
}
|
layerQueue.pop();
|
||||||
}
|
FolderLayerWrapper* nowLayer = handleLayerWrapper(layerNode.nowLayer, layerNode.transfrom, painting);
|
||||||
}
|
if (nowLayer != nullptr) {
|
||||||
|
for (auto sonLayer : nowLayer->children) {
|
||||||
|
layerQueue.push({ sonLayer.get(), layerNode.transfrom });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return painting;
|
return painting;
|
||||||
}
|
}
|
||||||
|
|
||||||
FolderLayerWrapper* PaintingUtil::handleLayerWrapper(LayerWrapper* nowLayer, QTransform& transform, bvec2& flip, Painting& painting) {
|
FolderLayerWrapper* PaintingUtil::handleLayerWrapper(LayerWrapper* nowLayer, QTransform& transform, Painting& painting) {
|
||||||
LeafLayerWrapper* leafLayer = dynamic_cast<LeafLayerWrapper*>(nowLayer);
|
LeafLayerWrapper* leafLayer = dynamic_cast<LeafLayerWrapper*>(nowLayer);
|
||||||
flip ^= bvec2(nowLayer->property.flipHorizontally, nowLayer->property.flipVertically);
|
|
||||||
|
|
||||||
transform = nowLayer->property.transform * transform;
|
transform = nowLayer->property.transform * transform;
|
||||||
|
|
||||||
if (leafLayer != nullptr) {
|
if (leafLayer != nullptr) {
|
||||||
|
|
||||||
GroupElement* wrapperElement = dynamic_cast<GroupElement*>(leafLayer->wrappedElement);
|
GroupElement* wrapperElement = dynamic_cast<GroupElement*>(leafLayer->wrappedElement);
|
||||||
if (wrapperElement != nullptr) {
|
if (wrapperElement != nullptr) {
|
||||||
transform = wrapperElement->sourceLayer->property.transform * transform;
|
transform = wrapperElement->sourceLayer->property.transform * transform;
|
||||||
return wrapperElement->sourceLayer;
|
return wrapperElement->sourceLayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
PixelPath pixelPath = nowLayer->getCache();
|
PixelPath pixelPath = nowLayer->getCache();
|
||||||
QPainterPath painterPath = pixelPath.getPainterPath();
|
QPainterPath painterPath = pixelPath.getPainterPath();
|
||||||
QRectF bound = painterPath.boundingRect();
|
QRectF bound = painterPath.boundingRect();
|
||||||
//qDebug() << leafLayer<<"------" << painterPath;
|
//qDebug() << leafLayer<<"------" << painterPath;
|
||||||
//qDebug() << transform;
|
//qDebug() << transform;
|
||||||
Element element;
|
// transform to initial painterPath
|
||||||
ElementTransform elementTrans;
|
// transfrom to -1£¬ 1
|
||||||
element.ratio = bound.width() / bound.height();
|
QTransform trans;
|
||||||
// transform to initial painterPath
|
double maxLen = std::max(bound.width(), bound.height());
|
||||||
// transfrom to -1£¬ 1
|
qDebug() << maxLen << bound;
|
||||||
QTransform trans;
|
trans.scale(1 / maxLen, 1 / maxLen);
|
||||||
trans.scale(1 / bound.width(), 1 / bound.height());
|
trans.translate(-bound.center().x(), -bound.center().y());
|
||||||
trans.translate(-bound.center().x(), -bound.center().y());
|
|
||||||
|
|
||||||
qDebug() << trans.map(painterPath);
|
painterPath = trans.map(painterPath);
|
||||||
element.contour = std::make_shared<vector<vector<Renderer::Point> >>(PainterPathUtil::transformToLines(trans.map(painterPath)));
|
shared_ptr<vector<vector<Renderer::Point> >> contour = std::make_shared<vector<vector<Renderer::Point> >>(PainterPathUtil::transformToLines(painterPath));
|
||||||
QSize screenSize = QSize(1024, 1024);
|
QSize screenSize = QSize(1024, 1024);
|
||||||
element.style = std::make_shared<Renderer::ElementStyleStrokeDemo>(0.06);
|
|
||||||
|
|
||||||
|
ElementTransform elementTransform;
|
||||||
|
transform = trans.inverted() * transform * QTransform::fromScale(2. / screenSize.width(), 2. / screenSize.height()) * QTransform::fromTranslate(-1, -1) * QTransform::fromScale(1, -1);
|
||||||
|
|
||||||
painterPath = transform.map(painterPath);
|
auto baseStyles = leafLayer->styles.toBaseStyles();
|
||||||
qDebug() << painterPath;
|
Renderer::BaseElement element;
|
||||||
bound = painterPath.boundingRect();
|
element.contour = contour;
|
||||||
qDebug() << bound;
|
for (auto baseStyle : baseStyles) {
|
||||||
|
double lineWidth = 0;
|
||||||
|
if (baseStyle.material->type() == Renderer::MaterialStyleType::kStroke) {
|
||||||
|
auto material = dynamic_cast<MaterialStyleStroke*>(baseStyle.material.get());
|
||||||
|
material->halfWidth = material->halfWidth / maxLen;
|
||||||
|
lineWidth = material->halfWidth;
|
||||||
|
qDebug() << material->halfWidth;
|
||||||
|
}
|
||||||
|
QRectF rect = painterPath.boundingRect();
|
||||||
|
rect.setX(-lineWidth + rect.x());
|
||||||
|
rect.setY(-lineWidth + rect.y());
|
||||||
|
rect.setWidth(lineWidth * 2 + rect.width());
|
||||||
|
rect.setHeight(lineWidth * 2 + rect.height());
|
||||||
|
QPainterPath path;
|
||||||
|
path.addRect(rect);
|
||||||
|
rect = transform.map(path).boundingRect();
|
||||||
|
elementTransform.bound = glm::vec4(rect.x(), rect.y(), rect.x() + rect.width(), rect.y() + rect.height());
|
||||||
|
qDebug() << elementTransform.bound.x << elementTransform.bound.y << elementTransform.bound.z << elementTransform.bound.z;
|
||||||
|
transform = transform.inverted();
|
||||||
|
elementTransform.transform = glm::mat3x2(
|
||||||
|
transform.m11(), transform.m12(), transform.m21(),
|
||||||
|
transform.m22(), transform.m31(), transform.m32()
|
||||||
|
);
|
||||||
|
qDebug() << transform;
|
||||||
|
elementTransform.zIndex = 0;
|
||||||
|
|
||||||
// TODO ¸ÄÓþØÕó
|
element.style = baseStyle.material;
|
||||||
|
painting.addElement(element, elementTransform);
|
||||||
|
}
|
||||||
|
|
||||||
/* elementTrans.center = glm::vec2(
|
return nullptr;
|
||||||
(2 * bound.center().x() - screenSize.width()) / screenSize.width(),
|
}
|
||||||
(2 * bound.center().y() - screenSize.height()) / screenSize.height()
|
|
||||||
);
|
|
||||||
qDebug() << elementTrans.center.x << elementTrans.center.y;
|
|
||||||
decomposeTransform(transform, elementTrans.rotation, elementTrans.scale);
|
|
||||||
elementTrans.scale = glm::vec2(
|
|
||||||
bound.width() * 2 / screenSize.width(),
|
|
||||||
bound.height() * 2 / screenSize.height()
|
|
||||||
);
|
|
||||||
elementTrans.flip = glm::bvec2(
|
|
||||||
nowLayer->property.flipHorizontally,
|
|
||||||
nowLayer->property.flipVertically
|
|
||||||
);
|
|
||||||
qDebug() << elementTrans.scale.x << elementTrans.scale.y;
|
|
||||||
painting.addElement(element, elementTrans);*/
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
FolderLayerWrapper* folderLayer = dynamic_cast<FolderLayerWrapper*>(nowLayer);
|
FolderLayerWrapper* folderLayer = dynamic_cast<FolderLayerWrapper*>(nowLayer);
|
||||||
return folderLayer;
|
return folderLayer;
|
||||||
}
|
|
||||||
void PaintingUtil::decomposeTransform(QTransform trans, float& angle, glm::vec2& scale) {
|
|
||||||
//qDebug() << trans;
|
|
||||||
trans.setMatrix(
|
|
||||||
trans.m11(), trans.m12(), trans.m13(),
|
|
||||||
trans.m21(), trans.m22(), trans.m23(),
|
|
||||||
0, 0, 1);
|
|
||||||
//qDebug() << trans.dx() << trans.dy();
|
|
||||||
int count = 0;
|
|
||||||
double norm = 0, n = 0;
|
|
||||||
QTransform R = trans, Rit, Rnext;
|
|
||||||
do {
|
|
||||||
++count;
|
|
||||||
Rit = R.transposed().inverted();
|
|
||||||
Rnext.setMatrix(
|
|
||||||
(R.m11() + Rit.m11()) / 2,
|
|
||||||
(R.m12() + Rit.m12()) / 2,
|
|
||||||
(R.m13() + Rit.m13()) / 2,
|
|
||||||
(R.m21() + Rit.m21()) / 2,
|
|
||||||
(R.m22() + Rit.m22()) / 2,
|
|
||||||
(R.m23() + Rit.m23()) / 2,
|
|
||||||
(R.m31() + Rit.m31()) / 2,
|
|
||||||
(R.m32() + Rit.m32()) / 2,
|
|
||||||
(R.m33() + Rit.m33()) / 2
|
|
||||||
);
|
|
||||||
norm = 0;
|
|
||||||
norm = max(norm,
|
|
||||||
fabs(R.m11() - Rnext.m11())
|
|
||||||
+ fabs(R.m12() - Rnext.m12())
|
|
||||||
+ fabs(R.m13() - Rnext.m13()));
|
|
||||||
norm = max(norm,
|
|
||||||
fabs(R.m21() - Rnext.m21())
|
|
||||||
+ fabs(R.m22() - Rnext.m22())
|
|
||||||
+ fabs(R.m23() - Rnext.m23()));
|
|
||||||
norm = max(norm,
|
|
||||||
fabs(R.m31() - Rnext.m31())
|
|
||||||
+ fabs(R.m32() - Rnext.m32())
|
|
||||||
+ fabs(R.m33() - Rnext.m33()));
|
|
||||||
R = Rnext;
|
|
||||||
} while (count < 100 && norm > 0.0001);
|
|
||||||
double cosValue = max(-1.0, min(R.m11(), 1.0));
|
|
||||||
double sinValue = max(-1.0, min(R.m12(), 1.0));
|
|
||||||
angle = acos(cosValue) * 180 / pi;
|
|
||||||
if (sinValue < 0) {
|
|
||||||
angle = 360 - angle;
|
|
||||||
}
|
|
||||||
qDebug() << angle;
|
|
||||||
//R = R.inverted() * trans;
|
|
||||||
//scale = glm::vec2(R.m11(), R.m22());
|
|
||||||
//qDebug() << scale.x << scale.y;
|
|
||||||
return;
|
|
||||||
}
|
}
|
|
@ -7,10 +7,9 @@ class PaintingUtil
|
||||||
private:
|
private:
|
||||||
static const double pi;
|
static const double pi;
|
||||||
static QJsonObject readJsonFile(QString jsonFilePath);
|
static QJsonObject readJsonFile(QString jsonFilePath);
|
||||||
static FolderLayerWrapper* handleLayerWrapper(LayerWrapper* nowLayer, QTransform& transform, glm::bvec2& flip, Renderer::Painting& painting);
|
static FolderLayerWrapper* handleLayerWrapper(LayerWrapper* nowLayer, QTransform& transform, Renderer::Painting& painting);
|
||||||
|
//static double getMaxLineWidth(LayerWrapper* root);
|
||||||
public:
|
public:
|
||||||
static Renderer::Painting transfromToPainting(QString jsonFilePath);
|
static Renderer::Painting transfromToPainting(QString jsonFilePath);
|
||||||
static void decomposeTransform(QTransform trans, float& angle, glm::vec2& scale);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,3 +22,8 @@ void ::FluentMenu::paintEvent(QPaintEvent* event)
|
||||||
}
|
}
|
||||||
QMenu::paintEvent(event);
|
QMenu::paintEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QAction* FluentMenu::exec(const QPoint& pos, QAction* at)
|
||||||
|
{
|
||||||
|
return QMenu::exec(parentWidget()->mapToGlobal(parentWidget()->mapFromGlobal(pos) + QPoint(-shadowRadius, -shadowRadius)), at);
|
||||||
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ class FluentMenu : public QMenu
|
||||||
public:
|
public:
|
||||||
explicit FluentMenu(QWidget* parent = nullptr);
|
explicit FluentMenu(QWidget* parent = nullptr);
|
||||||
void paintEvent(QPaintEvent* event) override;
|
void paintEvent(QPaintEvent* event) override;
|
||||||
|
QAction* exec(const QPoint& pos, QAction* at = nullptr);
|
||||||
int shadowRadius = 16;
|
int shadowRadius = 16;
|
||||||
int borderRadius = 6;
|
int borderRadius = 6;
|
||||||
int itemBorderRadius = 4;
|
int itemBorderRadius = 4;
|
||||||
|
|
|
@ -244,8 +244,9 @@ GLuint Renderer::Model::loadPainting(std::string path)
|
||||||
return iter->second;
|
return iter->second;
|
||||||
|
|
||||||
Painting painting;
|
Painting painting;
|
||||||
|
path = "../test.json";
|
||||||
if (auto file = QFileInfo(QString(path.c_str())); file.isFile())
|
if (auto file = QFileInfo(QString(path.c_str())); file.isFile())
|
||||||
painting = PaintingUtil::transfromToPainting(file.path());
|
painting = PaintingUtil::transfromToPainting(file.filePath());
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qDebug() << path.c_str() << "Not Found, Using Default Painting";
|
qDebug() << path.c_str() << "Not Found, Using Default Painting";
|
||||||
|
|
|
@ -20,12 +20,12 @@ QVector4D BvhTree::Union(QVector4D a, QVector4D b) {
|
||||||
|
|
||||||
QVector4D BvhTree::merge(BvhPtr lp, BvhPtr rp) {
|
QVector4D BvhTree::merge(BvhPtr lp, BvhPtr rp) {
|
||||||
QVector4D a = lp->bound, b = rp->bound;
|
QVector4D a = lp->bound, b = rp->bound;
|
||||||
if (lp->isLeaf) {
|
/*if (lp->isLeaf) {
|
||||||
a = BvhTreeData::boundWithRotation(a, lp->getRightSon());
|
a = BvhTreeData::boundWithRotation(a, lp->getRightSon());
|
||||||
}
|
}
|
||||||
if (rp->isLeaf) {
|
if (rp->isLeaf) {
|
||||||
b = BvhTreeData::boundWithRotation(b, rp->getRightSon());
|
b = BvhTreeData::boundWithRotation(b, rp->getRightSon());
|
||||||
}
|
}*/
|
||||||
return Union(a, b);
|
return Union(a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ Renderer::RendererWidget::RendererWidget(QWidget* parent)
|
||||||
ui.openButton->setChecked(false);
|
ui.openButton->setChecked(false);
|
||||||
});
|
});
|
||||||
QObject::connect(ui.openButton, &QPushButton::clicked, [&, menu]() {
|
QObject::connect(ui.openButton, &QPushButton::clicked, [&, menu]() {
|
||||||
menu->exec(ui.openButton->mapToGlobal(QPoint(-menu->shadowRadius, ui.openButton->height() - menu->shadowRadius)));
|
menu->exec(ui.openButton->mapToGlobal(QPoint(0, ui.openButton->height())));
|
||||||
});
|
});
|
||||||
|
|
||||||
QObject::connect(ui.horizontalSlider, &QSlider::valueChanged,
|
QObject::connect(ui.horizontalSlider, &QSlider::valueChanged,
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
#include "ColorHelper.hpp"
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QtWidgets/QApplication>
|
#include <QtWidgets/QApplication>
|
||||||
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <format>
|
#include <format>
|
||||||
#include "consoleapi2.h"
|
#include "consoleapi2.h"
|
||||||
#include <lib/qtmaterialstyle.h>
|
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
@ -51,9 +51,7 @@ int main(int argc, char* argv[])
|
||||||
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
Q_INIT_RESOURCE(resources);
|
Q_INIT_RESOURCE(resources);
|
||||||
QtMaterialTheme theme;
|
ColorHelper::instance();
|
||||||
theme.setColor("primary1", QColor(0, 90, 158));
|
|
||||||
QtMaterialStyle::instance().setTheme(&theme);
|
|
||||||
//FramelessHelper::Core::setApplicationOSThemeAware();
|
//FramelessHelper::Core::setApplicationOSThemeAware();
|
||||||
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur);
|
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur);
|
||||||
//FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
|
//FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
|
||||||
|
|
|
@ -0,0 +1,131 @@
|
||||||
|
{
|
||||||
|
"background-color": "#ffffff",
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"include": "../svg/2.svg"
|
||||||
|
},
|
||||||
|
"name": "ababa",
|
||||||
|
"type": "svg-file"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"reference-layer": "0.0"
|
||||||
|
},
|
||||||
|
"name": "ababa-group",
|
||||||
|
"type": "group"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"data": {
|
||||||
|
"include": "../svg/0.svg"
|
||||||
|
},
|
||||||
|
"name": "ababa2",
|
||||||
|
"type": "svg-file"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"height": 1080,
|
||||||
|
"project-name": "样例1",
|
||||||
|
"root-layer": {
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"children": [
|
||||||
|
{
|
||||||
|
"element": 0,
|
||||||
|
"is-folder": false,
|
||||||
|
"name": "Leaf1",
|
||||||
|
"styles": [
|
||||||
|
{
|
||||||
|
"enableEachSideIndependent": false,
|
||||||
|
"left": "AAAAQAEAIZwAf///qqr//w==",
|
||||||
|
"right": "AADgQAAACJw=",
|
||||||
|
"type": "stroke"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"transform": {
|
||||||
|
"offset": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"rotation": 0,
|
||||||
|
"scale": {
|
||||||
|
"x": 1,
|
||||||
|
"y": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"element": 0,
|
||||||
|
"is-folder": false,
|
||||||
|
"name": "Leaf2",
|
||||||
|
"styles": [
|
||||||
|
{
|
||||||
|
"enableEachSideIndependent": false,
|
||||||
|
"left": "AAAAQAEAIZwAf////1UA/w==",
|
||||||
|
"right": "AADgQAAACJw=",
|
||||||
|
"type": "stroke"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"transform": {
|
||||||
|
"offset": {
|
||||||
|
"x": 150,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"rotation": 0,
|
||||||
|
"scale": {
|
||||||
|
"x": 1.5,
|
||||||
|
"y": 1.5
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is-folder": true,
|
||||||
|
"name": "GroupFolderExample",
|
||||||
|
"referenced-by": 1,
|
||||||
|
"transform": {
|
||||||
|
"offset": {
|
||||||
|
"x": 50,
|
||||||
|
"y": 50
|
||||||
|
},
|
||||||
|
"rotation": 0,
|
||||||
|
"scale": {
|
||||||
|
"x": 1,
|
||||||
|
"y": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"element": 1,
|
||||||
|
"is-folder": false,
|
||||||
|
"name": "ReferencingGroupLayer",
|
||||||
|
"styles": [
|
||||||
|
],
|
||||||
|
"transform": {
|
||||||
|
"offset": {
|
||||||
|
"x": 100,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"rotation": 45,
|
||||||
|
"scale": {
|
||||||
|
"x": 1,
|
||||||
|
"y": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"is-folder": true,
|
||||||
|
"name": "root",
|
||||||
|
"referenced-by": null,
|
||||||
|
"transform": {
|
||||||
|
"offset": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"rotation": 0,
|
||||||
|
"scale": {
|
||||||
|
"x": 1,
|
||||||
|
"y": 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"width": 1080
|
||||||
|
}
|
Loading…
Reference in New Issue