修复了项目无法正常打开的BUG

This commit is contained in:
Art_Sakura 2025-07-24 04:36:59 +08:00
parent 0430307f4b
commit a1785277f3
13 changed files with 17 additions and 44 deletions

View File

@ -4,6 +4,3 @@ SUBDIRS += \
QGobangClient \
QGobangServer \
QGobangTool
QGobangClient.depends = QGobangTool
QGobangServer.depends = QGobangTool

View File

@ -30,6 +30,6 @@ Widget *CUiManager::getWidget()
CUiManager::CUiManager()
{
//记得初始化成nullptr
// 记得初始化成nullptr
m_pWidget = nullptr;
}

Binary file not shown.

View File

@ -2,6 +2,7 @@ QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
DESTDIR = $$PWD
OBJECTS_DIR = $$PWD/../build/$$TARGET/obj
MOC_DIR = $$PWD/../build/$$TARGET/moc
RCC_DIR = $$PWD/../build/$$TARGET/rcc
@ -22,6 +23,6 @@ HEADERS += \
FORMS += \
Ui\widget.ui
#引用QGobangTool库文件
# 引用QGobangTool库文件
INCLUDEPATH += ../QGobangTool/include
LIBS += -L$$OUT_PWD/../QGobangTool/lib -lQGobangTool

View File

@ -10,8 +10,8 @@
#include <QWidget>
//记得加命名空间 添加命名空间后 UI文件也得加
//你也可以将UI的命名空间声明到外面, 这样就可以不用加命名空间了, 当然不推荐
// 记得加命名空间 添加命名空间后 UI文件也得加
// 你也可以将UI的命名空间声明到外面, 这样就可以不用加命名空间了, 当然不推荐
namespace NS_QGobangClient
{

View File

@ -1,5 +1,7 @@
#include <QApplication>
#include <QDebug>
#include "Ui/widget.h"
#include "CUiManager.h"
@ -9,7 +11,7 @@ int main(int argc, char *argv[])
{
QApplication a(argc, argv);
//单例设计模式下, 引用比较过长, 长远的来看, 利大于弊
// 单例设计模式下, 引用比较过长, 长远的来看, 利大于弊
Widget *w = CUiManager::getInstance()->getWidget();
w->show();

View File

@ -10,6 +10,7 @@
***************************************************************/
namespace NS_QGobangServer
{
class CServerManager
{
@ -24,4 +25,6 @@ private:
};
}
#endif // CSERVERMANAGER_H

Binary file not shown.

View File

@ -12,9 +12,10 @@ SOURCES += \
CServerManager.cpp \
main.cpp
#引用QGobangTool库文件
INCLUDEPATH += ../QGobangTool/include
LIBS += -L$$OUT_PWD/../QGobangTool/lib -lQGobangTool
HEADERS += \
CServerManager.h
# 引用QGobangTool库文件
INCLUDEPATH += ../QGobangTool/include
LIBS += -L$$OUT_PWD/../QGobangTool/lib -lQGobangTool

View File

@ -4,16 +4,5 @@ int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
// Set up code that uses the Qt event loop here.
// Call a.quit() or a.exit() to quit the application.
// A not very useful example would be including
// #include <QTimer>
// near the top of the file and calling
// QTimer::singleShot(5000, &a, &QCoreApplication::quit);
// which quits the application after 5 seconds.
// If you do not need a running Qt event loop, remove the call
// to a.exec() or use the Non-Qt Plain C++ Application template.
return a.exec();
}

View File

@ -14,8 +14,7 @@ CONFIG += c++17 cmdline
CONFIG -= debug_and_release debug_and_release_target
SOURCES += \
QGobangRule.cpp \
main.cpp
QGobangRule.cpp
HEADERS += \
QGobangRule.h

View File

@ -1,19 +0,0 @@
#include <QCoreApplication>
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
// Set up code that uses the Qt event loop here.
// Call a.quit() or a.exit() to quit the application.
// A not very useful example would be including
// #include <QTimer>
// near the top of the file and calling
// QTimer::singleShot(5000, &a, &QCoreApplication::quit);
// which quits the application after 5 seconds.
// If you do not need a running Qt event loop, remove the call
// to a.exec() or use the Non-Qt Plain C++ Application template.
return a.exec();
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 MiB

After

Width:  |  Height:  |  Size: 171 KiB