FIX: qt-material-widgets资源未加载

dev-LayerStyle
wuyize 2023-03-16 19:29:38 +08:00
parent 6d554ab265
commit 4ff5406acc
5 changed files with 9 additions and 6 deletions

View File

@ -15,7 +15,7 @@ vector<vector<Point>> PainterPathUtil::transformToLines(const QPainterPath& pai
for (int elementIndex = 0; elementIndex < painterPath.elementCount(); elementIndex++) {
auto element = painterPath.elementAt(elementIndex);
point = element;
qDebug() << element;
//qDebug() << element;
if (element.isMoveTo()) {
if (line.size() >= 2) {
lines.push_back(line);
@ -43,7 +43,7 @@ vector<vector<Point>> PainterPathUtil::transformToLines(const QPainterPath& pai
return lines;
}
QPainterPath PainterPathUtil::monotonization(QPainterPath& painterPath) {
QPainterPath PainterPathUtil::monotonization(const QPainterPath& painterPath) {
QPainterPath resPath;
vector<vector<Point> > lines = transformToLines(painterPath);
vector<shared_ptr<Line>> linePtrVector;

View File

@ -7,7 +7,7 @@ class PainterPathUtil
{
public:
static std::vector<std::vector<Renderer::Point>> transformToLines(const QPainterPath& painterPath);
static QPainterPath monotonization(QPainterPath& painterPath);
static QPainterPath monotonization(const QPainterPath& painterPath);
static std::pair<QPainterPath, float> normalized(const QPainterPath& path, float width = 0);
static std::pair<std::vector<std::vector<Renderer::Point>>, float> toNormalizedLines(const QPainterPath& path, float width = 0);
};

View File

@ -59,7 +59,7 @@ std::vector<GLfloat> Renderer::StrokeRadialGradient::encoded() const
v.y = pair.first;
result.push_back(glm::uintBitsToFloat(glm::packUnorm2x16(v)));
result.push_back(glm::uintBitsToFloat(glm::packUnorm4x8(color)));
qDebug() << pair.first;
//qDebug() << pair.first;
}
return result;
}

View File

@ -10,6 +10,7 @@
#include "../Painting/Element.h"
#include "../Painting/Painting.h"
#include "../Painting/MaterialStyleStroke.h"
#include <util/PainterPathUtil.h>
using namespace Renderer;
std::vector<glm::vec2> generatePathBuffer(const QPainterPath& path)
@ -78,7 +79,7 @@ std::vector<GLfloat> generateStyleBuffer(const std::vector<BaseStyle>& styles)
auto encoded = style.material->encoded();
styleBuffer.insert(styleBuffer.end(), encoded.begin(), encoded.end());
qDebug() << "style size" << styleBuffer.size();
//qDebug() << "style size" << styleBuffer.size();
}
return styleBuffer;
}
@ -199,7 +200,8 @@ std::pair<QImage, QPointF> Renderer::ElementRenderer::drawElement(const QPainter
std::unique_lock<std::mutex> lock(drawMutex);
draw.wait(lock, [&] {return drawFinished; });
drawFinished = false;
this->path = &path;
QPainterPath monotonized = PainterPathUtil::monotonization(path);
this->path = &monotonized;
this->style = &style;
this->pixelRatio = pixelRatio;
needDraw = true;

View File

@ -49,6 +49,7 @@ int main(int argc, char* argv[])
//QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
QApplication a(argc, argv);
Q_INIT_RESOURCE(resources);
//FramelessHelper::Core::setApplicationOSThemeAware();
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur);
//FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);