2024-08-01 01:17:17 +00:00
|
|
|
|
#include "./Widget/MainWidget.h"
|
|
|
|
|
#include <QApplication>
|
2025-02-14 03:06:28 +00:00
|
|
|
|
#include <QItemSelection>
|
|
|
|
|
#include <QItemSelectionModel>
|
2024-08-06 12:32:02 +00:00
|
|
|
|
#include <windows.h>
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <QDebug>
|
2024-08-01 01:17:17 +00:00
|
|
|
|
|
2024-08-26 10:33:55 +00:00
|
|
|
|
//通过设置项目的子系统来避免生成控制台窗口。这种方法根本不会创建控制台窗口:
|
|
|
|
|
//
|
|
|
|
|
//右键点击你的项目,选择“属性”。
|
|
|
|
|
//在“配置属性”下,展开“链接器”,然后选择“系统”。
|
|
|
|
|
//将“子系统”设置为“Windows(/ SUBSYSTEM)”而不是“控制台(/ SUBSYSTEM)”。
|
|
|
|
|
//这种方法不需要任何额外的代码,且最为简洁。如果你已经在代码中使用了WinMain而不是main函数,这个设置就是默认的。
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
// 关闭控制台窗口的函数
|
|
|
|
|
void closeConsole() {
|
|
|
|
|
HWND hwnd = GetConsoleWindow();
|
|
|
|
|
ShowWindow(hwnd, SW_HIDE);
|
|
|
|
|
}
|
|
|
|
|
|
2024-08-01 01:17:17 +00:00
|
|
|
|
int main(int argc, char* argv[]) {
|
2024-08-26 10:33:55 +00:00
|
|
|
|
//closeConsole(); // 调用函数关闭控制台窗口
|
|
|
|
|
//FreeConsole(); // 关闭控制台窗口
|
2024-08-06 12:32:02 +00:00
|
|
|
|
QApplication app(argc, argv);
|
2025-02-14 03:06:28 +00:00
|
|
|
|
|
|
|
|
|
// **注册 QItemSelection 和 SelectionFlags 以支持 QueuedConnection**
|
|
|
|
|
qRegisterMetaType<QItemSelection>("QItemSelection");
|
|
|
|
|
qRegisterMetaType<QItemSelectionModel::SelectionFlags>("QItemSelectionModel::SelectionFlags");
|
|
|
|
|
|
2024-09-02 02:22:41 +00:00
|
|
|
|
qDebug() << "Current working directory:" << QDir::currentPath();
|
2024-09-03 07:58:23 +00:00
|
|
|
|
//QIcon appIcon("./app_icon.ico");
|
|
|
|
|
//app.setWindowIcon(appIcon);
|
2024-08-06 12:32:02 +00:00
|
|
|
|
|
2024-08-01 01:17:17 +00:00
|
|
|
|
MainWidget w;
|
|
|
|
|
w.show();
|
2024-08-06 12:32:02 +00:00
|
|
|
|
return app.exec();
|
2024-08-01 01:17:17 +00:00
|
|
|
|
}
|