cotton_double/main.cpp
2025-01-16 15:20:39 +08:00

39 lines
1.1 KiB
C++

#include "widget.h"
#include "licesing.h"
#include <QApplication>
#include <QDebug>
#include "globals.h"
#include "license_dialog.h"
// 全局变量存储原始的消息处理器
QtMessageHandler originalHandler = nullptr;
// 自定义消息处理器
void customMessageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg)
{
// 过滤掉特定的警告信息
if (msg.contains("QSocketNotifier: Socket notifiers cannot be enabled or disabled from another thread")) {
return; // 不做任何处理,相当于抑制该消息
}
// 其他消息交给原始处理器
if (originalHandler) {
originalHandler(type, context, msg);
}
}
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
// 安装自定义消息处理器,保存原始处理器
originalHandler = qInstallMessageHandler(customMessageHandler);
Widget w;
// 设置窗口标志以隐藏标题栏和边框,并确保窗口是顶级窗口
w.setWindowFlags(Qt::Window | Qt::FramelessWindowHint /*| Qt::WindowStaysOnTopHint*/);
// 显示全屏
w.showFullScreen();
// w.show();
return a.exec();
}