qDebug等输出显示来源
parent
f0ab4115c3
commit
ff848b1443
|
@ -37,15 +37,15 @@ std::vector<glm::vec2> generatePathBuffer(const QPainterPath& path)
|
||||||
switch (element.type)
|
switch (element.type)
|
||||||
{
|
{
|
||||||
case QPainterPath::MoveToElement:
|
case QPainterPath::MoveToElement:
|
||||||
qDebug() << "MoveToElement";
|
//qDebug() << "MoveToElement";
|
||||||
qDebug() << element;
|
//qDebug() << element;
|
||||||
pathBuffer.push_back(glm::vec2(std::numeric_limits<float>::infinity()));
|
pathBuffer.push_back(glm::vec2(std::numeric_limits<float>::infinity()));
|
||||||
pathBuffer.push_back(glm::vec2(element.x, element.y));
|
pathBuffer.push_back(glm::vec2(element.x, element.y));
|
||||||
break;
|
break;
|
||||||
case QPainterPath::LineToElement:
|
case QPainterPath::LineToElement:
|
||||||
{
|
{
|
||||||
qDebug() << "LineToElement";
|
//qDebug() << "LineToElement";
|
||||||
qDebug() << element;
|
//qDebug() << element;
|
||||||
glm::vec2 end = glm::vec2(element.x, element.y);
|
glm::vec2 end = glm::vec2(element.x, element.y);
|
||||||
glm::vec2 mid = (pathBuffer.back() + end) / 2.f;
|
glm::vec2 mid = (pathBuffer.back() + end) / 2.f;
|
||||||
pathBuffer.push_back(mid);
|
pathBuffer.push_back(mid);
|
||||||
|
@ -55,14 +55,14 @@ std::vector<glm::vec2> generatePathBuffer(const QPainterPath& path)
|
||||||
}
|
}
|
||||||
case QPainterPath::CurveToElement:
|
case QPainterPath::CurveToElement:
|
||||||
{
|
{
|
||||||
qDebug() << "CurveToElement";
|
//qDebug() << "CurveToElement";
|
||||||
qDebug() << element;
|
//qDebug() << element;
|
||||||
glm::vec2 p1 = glm::vec2(element.x, element.y);
|
glm::vec2 p1 = glm::vec2(element.x, element.y);
|
||||||
element = path.elementAt(++i);
|
element = path.elementAt(++i);
|
||||||
qDebug() << element;
|
//qDebug() << element;
|
||||||
glm::vec2 p2 = glm::vec2(element.x, element.y);
|
glm::vec2 p2 = glm::vec2(element.x, element.y);
|
||||||
element = path.elementAt(++i);
|
element = path.elementAt(++i);
|
||||||
qDebug() << element;
|
//qDebug() << element;
|
||||||
glm::vec2 p3 = glm::vec2(element.x, element.y);
|
glm::vec2 p3 = glm::vec2(element.x, element.y);
|
||||||
if (p3 != pathBuffer.back())
|
if (p3 != pathBuffer.back())
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
#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 <format>
|
||||||
|
#include "consoleapi2.h"
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
@ -10,8 +13,38 @@ extern "C"
|
||||||
|
|
||||||
FRAMELESSHELPER_USE_NAMESPACE
|
FRAMELESSHELPER_USE_NAMESPACE
|
||||||
|
|
||||||
|
void messageHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case QtInfoMsg:
|
||||||
|
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY);
|
||||||
|
break;
|
||||||
|
case QtDebugMsg:
|
||||||
|
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
|
||||||
|
break;
|
||||||
|
case QtWarningMsg:
|
||||||
|
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN);
|
||||||
|
break;
|
||||||
|
case QtCriticalMsg:
|
||||||
|
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_BLUE);
|
||||||
|
break;
|
||||||
|
case QtFatalMsg:
|
||||||
|
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED);
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
std::cout << std::format("{}({},{}) {}\n",
|
||||||
|
QString(context.file).splitRef("\\").back().toLocal8Bit().data(),
|
||||||
|
context.line,
|
||||||
|
QString(context.function).splitRef("(").first().split(" ").back().split(":").back().toLocal8Bit().data(),
|
||||||
|
msg.toStdString());
|
||||||
|
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE);
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
|
qInstallMessageHandler(messageHandler);
|
||||||
//FramelessHelper::Widgets::initialize();
|
//FramelessHelper::Widgets::initialize();
|
||||||
FramelessHelper::Core::initialize();
|
FramelessHelper::Core::initialize();
|
||||||
//QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
//QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||||
|
|
Loading…
Reference in New Issue