添加了修改
parent
abe1ee02c1
commit
ab402955cd
|
@ -29,7 +29,7 @@ EditorWidget::EditorWidget(QWidget *parent) : QWidget(parent)
|
||||||
QJsonObject source = jsonDoc.object();
|
QJsonObject source = jsonDoc.object();
|
||||||
elementManager = new ElementManager(source,previewWindow->getRenderer());
|
elementManager = new ElementManager(source,previewWindow->getRenderer());
|
||||||
layerManager = new LayerManager(source, elementManager);
|
layerManager = new LayerManager(source, elementManager);
|
||||||
previewWindow->initialize(layerManager);
|
previewWindow->initialize(layerManager,QSize(jsonDoc.object().value("width").toDouble(),jsonDoc.object().value("height").toDouble()));
|
||||||
if (layerManager->getRoot() != nullptr)
|
if (layerManager->getRoot() != nullptr)
|
||||||
{
|
{
|
||||||
treeWidget->addTopLevelItem(layerManager->getRoot()->qTreeItem);
|
treeWidget->addTopLevelItem(layerManager->getRoot()->qTreeItem);
|
||||||
|
|
|
@ -46,7 +46,6 @@ PixelPath GroupElement::getPaintObject() const
|
||||||
PixelPath SimpleElement::getPaintObject(std::vector<Renderer::ElementStyleStrokeDemo> styles) const {
|
PixelPath SimpleElement::getPaintObject(std::vector<Renderer::ElementStyleStrokeDemo> styles) const {
|
||||||
PixelPath result;
|
PixelPath result;
|
||||||
Renderer::ElementStyleStrokeDemo demo(2);
|
Renderer::ElementStyleStrokeDemo demo(2);
|
||||||
qDebug() << (renderer == nullptr) << "------------";
|
|
||||||
auto [img, mov] = renderer->drawElement(painterPath, demo, 1.0, false);
|
auto [img, mov] = renderer->drawElement(painterPath, demo, 1.0, false);
|
||||||
//qDebug() << img << " ------";
|
//qDebug() << img << " ------";
|
||||||
result.addImage(img, mov);
|
result.addImage(img, mov);
|
||||||
|
|
|
@ -21,9 +21,15 @@ QRectF PixelPath::getBoundingRect() const
|
||||||
{
|
{
|
||||||
return boundingRect;
|
return boundingRect;
|
||||||
}
|
}
|
||||||
|
#include <QDebug>
|
||||||
QPixmap PixelPath::getPixmap() const
|
QPixmap PixelPath::getPixmap() const
|
||||||
{
|
{
|
||||||
|
auto k = pixmap;
|
||||||
|
QPainter pt(&k);
|
||||||
|
qDebug() << this->boundingRect;
|
||||||
|
//pt.fillRect(this->boundingRect, Qt::red);
|
||||||
|
//pt.fillRect(QRectF(1013.35 - 1000, 768.327 - 700,58.0887,41.5352), Qt::blue);
|
||||||
|
return k;
|
||||||
return pixmap;
|
return pixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@ private:
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
int w,h;
|
int w,h;
|
||||||
public:
|
public:
|
||||||
PixelPath(int w=1280, int h=720);
|
PixelPath(int w=2400, int h= 2400);
|
||||||
PixelPath(QPainterPath painterPath,int w = 1280, int h = 720);
|
PixelPath(QPainterPath painterPath,int w = 2400, int h = 2400);
|
||||||
~PixelPath() = default;
|
~PixelPath() = default;
|
||||||
QRectF getBoundingRect() const;
|
QRectF getBoundingRect() const;
|
||||||
QPixmap getPixmap() const;
|
QPixmap getPixmap() const;
|
||||||
|
|
|
@ -12,8 +12,9 @@ PreviewWindow::PreviewWindow(QWidget *parent) : QOpenGLWidget(parent)
|
||||||
layerManager = nullptr;
|
layerManager = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PreviewWindow::initialize(LayerManager *layerManager)
|
void PreviewWindow::initialize(LayerManager *layerManager,QSize windowSize)
|
||||||
{
|
{
|
||||||
|
this->setFixedSize(windowSize);
|
||||||
this->layerManager = layerManager;
|
this->layerManager = layerManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ class PreviewWindow : public QOpenGLWidget, protected QOpenGLFunctions
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PreviewWindow(QWidget *parent = nullptr);
|
PreviewWindow(QWidget *parent = nullptr);
|
||||||
void initialize(LayerManager *layerManager);
|
void initialize(LayerManager *layerManager, QSize windowSize = QSize(1920, 1080));
|
||||||
void show();
|
void show();
|
||||||
void initializeGL() override;
|
void initializeGL() override;
|
||||||
void paintGL() override;
|
void paintGL() override;
|
||||||
|
|
|
@ -44,27 +44,27 @@ void InfoDisplayWidget::generateLayerForm()
|
||||||
QLineEdit *scaleX = new QLineEdit(QString::number(this->displayLayer->property.scale.x()), this);
|
QLineEdit *scaleX = new QLineEdit(QString::number(this->displayLayer->property.scale.x()), this);
|
||||||
QLineEdit *scaleY = new QLineEdit(QString::number(this->displayLayer->property.scale.y()), this);
|
QLineEdit *scaleY = new QLineEdit(QString::number(this->displayLayer->property.scale.y()), this);
|
||||||
name->setDisabled(true);
|
name->setDisabled(true);
|
||||||
rotation->setValidator(new QIntValidator(-1000, 1000, 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 requireRefreshPreview();
|
emit requireRefreshPreview();
|
||||||
});
|
});
|
||||||
offsetX->setValidator(new QIntValidator(-1000, 1000, 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 requireRefreshPreview();
|
emit requireRefreshPreview();
|
||||||
});
|
});
|
||||||
offsetY->setValidator(new QIntValidator(-1000, 1000, 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 requireRefreshPreview();
|
emit requireRefreshPreview();
|
||||||
});
|
});
|
||||||
scaleX->setValidator(new QDoubleValidator(0.01, 100, 4, this));
|
scaleX->setValidator(new QDoubleValidator(0.001, 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 requireRefreshPreview();
|
emit requireRefreshPreview();
|
||||||
});
|
});
|
||||||
scaleY->setValidator(new QDoubleValidator(0.01, 100, 4, this));
|
scaleY->setValidator(new QDoubleValidator(0.001, 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 requireRefreshPreview();
|
emit requireRefreshPreview();
|
||||||
|
|
|
@ -14,6 +14,8 @@ namespace UnitTest
|
||||||
public:
|
public:
|
||||||
TEST_METHOD(TestBothSidesRound)
|
TEST_METHOD(TestBothSidesRound)
|
||||||
{
|
{
|
||||||
|
Logger::WriteMessage("In Class1");
|
||||||
|
Assert::AreEqual(1 ,2);
|
||||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||||
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
|
||||||
|
|
143
data.json
143
data.json
|
@ -1,109 +1,38 @@
|
||||||
{
|
{
|
||||||
"height": 1080,
|
"height": 1080,
|
||||||
"width": 1080,
|
"width": 1920,
|
||||||
"elements": [
|
"elements": [
|
||||||
{
|
{
|
||||||
"name": "ababa",
|
"name": "ababa",
|
||||||
"type": "svg-file",
|
"type": "svg-file",
|
||||||
"data": {
|
"data": {
|
||||||
"include": "./svg/2.svg"
|
"include": "./svg/12(1).svg"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "ababa-group",
|
"name": "ababa-group",
|
||||||
"type": "group",
|
"type": "group",
|
||||||
"data": {
|
"data": {
|
||||||
"reference-layer": "0.0"
|
"reference-layer": "0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"root-layer": {
|
"root-layer": {
|
||||||
"name": "root",
|
"name": "root",
|
||||||
"transform": {
|
"transform": {
|
||||||
"offset": {
|
"offset": {
|
||||||
"x": 0,
|
"x": 0,
|
||||||
"y": 0
|
"y": 0
|
||||||
},
|
},
|
||||||
"scale": {
|
"scale": {
|
||||||
"x": 1.0,
|
"x": 0.5,
|
||||||
"y": 1.0
|
"y": 0.5
|
||||||
},
|
},
|
||||||
"rotation": 0.0
|
"rotation": 0.0
|
||||||
},
|
},
|
||||||
"effects": [],
|
"effects": [],
|
||||||
"is-folder": true,
|
"is-folder": false,
|
||||||
"referenced-by": null,
|
"element": 0
|
||||||
"children": [
|
}
|
||||||
{
|
|
||||||
"name": "GroupFolderExample",
|
}
|
||||||
"transform": {
|
|
||||||
"offset": {
|
|
||||||
"x": 50,
|
|
||||||
"y": 50
|
|
||||||
},
|
|
||||||
"scale": {
|
|
||||||
"x": 1.0,
|
|
||||||
"y": 1.0
|
|
||||||
},
|
|
||||||
"rotation": 0.0
|
|
||||||
},
|
|
||||||
"effects": [],
|
|
||||||
"is-folder": true,
|
|
||||||
"referenced-by": 1,
|
|
||||||
"children": [
|
|
||||||
{
|
|
||||||
"name": "Leaf1",
|
|
||||||
"transform": {
|
|
||||||
"offset": {
|
|
||||||
"x": 0,
|
|
||||||
"y": 0
|
|
||||||
},
|
|
||||||
"scale": {
|
|
||||||
"x": 1.0,
|
|
||||||
"y": 1.0
|
|
||||||
},
|
|
||||||
"rotation": 0.0
|
|
||||||
},
|
|
||||||
"effects": [],
|
|
||||||
"is-folder": false,
|
|
||||||
"element": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Leaf2",
|
|
||||||
"transform": {
|
|
||||||
"offset": {
|
|
||||||
"x": 150,
|
|
||||||
"y": 0
|
|
||||||
},
|
|
||||||
"scale": {
|
|
||||||
"x": 1.5,
|
|
||||||
"y": 1.5
|
|
||||||
},
|
|
||||||
"rotation": 0.0
|
|
||||||
},
|
|
||||||
"effects": [],
|
|
||||||
"is-folder": false,
|
|
||||||
"element": 0
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "ReferencingGroupLayer",
|
|
||||||
"transform": {
|
|
||||||
"offset": {
|
|
||||||
"x": 100,
|
|
||||||
"y": 0
|
|
||||||
},
|
|
||||||
"scale": {
|
|
||||||
"x": 1,
|
|
||||||
"y": 1
|
|
||||||
},
|
|
||||||
"rotation": 45
|
|
||||||
},
|
|
||||||
"effects": [],
|
|
||||||
"is-folder": false,
|
|
||||||
"element": 1
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 8.7 KiB |
|
@ -0,0 +1,7 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 822.45 644.74">
|
||||||
|
<defs>
|
||||||
|
<style>.cls-1,.cls-2{fill:none;stroke-miterlimit:10;}.cls-1{stroke:#af5c4c;}.cls-2{stroke:#aa7226;}</style>
|
||||||
|
</defs>
|
||||||
|
|
||||||
|
<path id="红_右下_4" class="cls-1" d="M1026,772.51a6.67,6.67,0,0,0,4.09,2c3.83.29,7-3.67,8.17-6.64,2.25-5.95-1.81-13.64-7.15-17.36-7.86-5.46-17.88-1.94-22-.51-15.17,5.33-21.35,19.5-22,20.94-7.29,17.46,1.77,33.53,3.07,35.74,8.87,15.14,24.68,19.24,33.19,21.45,5.56,1.44,26,6.75,46.47-4.6,26.86-14.9,30.35-45.55,30.64-48.51" transform="translate(-946.07 -186.44)"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 583 B |
Loading…
Reference in New Issue