提交 34fa1601 编写于 作者: mahuifa's avatar mahuifa

Merge branch 'Dev'

...@@ -39,7 +39,7 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin ...@@ -39,7 +39,7 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target !isEmpty(target.path): INSTALLS += target
# 定义程序版本号 # 定义程序版本号
VERSION = 1.0.0 VERSION = 1.0.1
DEFINES += APP_VERSION=\\\"$$VERSION\\\" DEFINES += APP_VERSION=\\\"$$VERSION\\\"
contains(QT_ARCH, i386){ # 使用32位编译器 contains(QT_ARCH, i386){ # 使用32位编译器
......
...@@ -14,6 +14,11 @@ LogSaveTxt::~LogSaveTxt() ...@@ -14,6 +14,11 @@ LogSaveTxt::~LogSaveTxt()
} }
void LogSaveTxt::initLog()
{
LogSaveTxt::getInstance();
}
LogSaveBase *LogSaveTxt::getInstance() LogSaveBase *LogSaveTxt::getInstance()
{ {
if(nullptr == m_logSave) if(nullptr == m_logSave)
......
...@@ -28,6 +28,7 @@ public: ...@@ -28,6 +28,7 @@ public:
public: public:
static void initLog(); // 初始化日志保存功能
static LogSaveBase* getInstance(); // 获取单例对象 static LogSaveBase* getInstance(); // 获取单例对象
void setFileType(FileType type); void setFileType(FileType type);
FileType fileType(){return m_type;} FileType fileType(){return m_type;}
......
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
LogWidgetBase::LogWidgetBase(QWidget *parent) : QWidget(parent) LogWidgetBase::LogWidgetBase(QWidget *parent) : QWidget(parent)
{ {
LogSaveTxt::getInstance(); // 创建日志存储对象 LogSaveTxt::initLog(); // 初始化日志保存功能
connect(LogInput::getInstance(), &LogInput::logData, this, &LogWidgetBase::on_logData, Qt::QueuedConnection); connect(LogInput::getInstance(), &LogInput::logData, this, &LogWidgetBase::on_logData, Qt::QueuedConnection);
} }
#include "widget.h" #include "widget.h"
#include <QApplication> #include <QApplication>
#include "QLog/loginput.h" #include "logsavetxt.h"
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
QApplication a(argc, argv); QApplication a(argc, argv);
LogInput::getInstance(); LogSaveTxt::initLog(); // 初始化日志保存功能,如果想保存程序启动的所有日志就加上这一行,如果通过提升为LogWidgetText则在这个控件初始化之前的日志不会保存
Widget w; Widget w;
w.show(); w.show();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册