SL100_FactoryTestTool/FactoryTestTool/SourceCode/main.cpp

40 lines
1.5 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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