diff --git a/.clang-format b/.clang-format index 005ff205..376fb0a8 100644 --- a/.clang-format +++ b/.clang-format @@ -94,9 +94,6 @@ CommentPragmas: '^ IWYU pragma:' # 固定命名空间注释 FixNamespaceComments: true -# 对齐连续的尾随的注释 -AlignTrailingComments: true - # 允许短的函数放在同一行: None, InlineOnly(定义在类中), Empty(空函数), Inline(定义在类中,空函数), All AllowShortFunctionsOnASingleLine: Empty diff --git a/.gitignore b/.gitignore index b6957c61..ddf40826 100644 --- a/.gitignore +++ b/.gitignore @@ -10,10 +10,12 @@ bin *.stash *.cbt debug +release *.ipch *qmlcache.qrc build bin .vc .vscode -.vs \ No newline at end of file +.vs +**/GeneratedFiles/** \ No newline at end of file diff --git a/3rdparty/TaoCommon/src/TaoCommon/Common/PropertyHelper.h b/3rdparty/TaoCommon/src/TaoCommon/Common/PropertyHelper.h index 5dfadcb6..1e837997 100644 --- a/3rdparty/TaoCommon/src/TaoCommon/Common/PropertyHelper.h +++ b/3rdparty/TaoCommon/src/TaoCommon/Common/PropertyHelper.h @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include #include @@ -132,6 +132,16 @@ class AppInfo : public QObject */ +// 可读可写 属性。属性set函数 提升为 slot ,可被 invok / qml 调用 +#define AUTO_PROPERTY_V2(T, NAME, InitValue) \ +private: \ + Q_PROPERTY(T NAME READ NAME WRITE set_##NAME NOTIFY NAME##Changed) \ +public: \ + PROP_GET(T, NAME); \ + Q_SLOT PROP_SET(T, NAME); \ + \ +private: \ + PROP_MEM(T, NAME, InitValue) //**********************************QObject 属性 二进制兼容版, 头文件声明 与 源文件定义 分离********************************** diff --git a/3rdparty/TaoCommon/src/TaoCommon/QuickModel/QuickListItemBase.h b/3rdparty/TaoCommon/src/TaoCommon/QuickModel/QuickListItemBase.h index cba7ffc5..a333698e 100644 --- a/3rdparty/TaoCommon/src/TaoCommon/QuickModel/QuickListItemBase.h +++ b/3rdparty/TaoCommon/src/TaoCommon/QuickModel/QuickListItemBase.h @@ -6,9 +6,14 @@ class TAO_API QuickListItemBase : public QObject { Q_OBJECT - AUTO_PROPERTY(bool, isChecked, false) - AUTO_PROPERTY(bool, isSelected, false) - AUTO_PROPERTY(bool, isAlternate, false) + AUTO_PROPERTY_V2(bool, isChecked, false) + AUTO_PROPERTY_V2(bool, isSelected, false) + AUTO_PROPERTY_V2(bool, isAlternate, false) +signals: + void isCheckedChanged(bool); + void isSelectedChanged(bool); + void isAlternateChanged(bool); + public: explicit QuickListItemBase(QObject* parent = nullptr); virtual ~QuickListItemBase() override; diff --git a/3rdparty/TaoCommon/src/TaoCommon/QuickModel/QuickListModel.h b/3rdparty/TaoCommon/src/TaoCommon/QuickModel/QuickListModel.h index a7a72cee..9d52943c 100644 --- a/3rdparty/TaoCommon/src/TaoCommon/QuickModel/QuickListModel.h +++ b/3rdparty/TaoCommon/src/TaoCommon/QuickModel/QuickListModel.h @@ -8,16 +8,27 @@ class TAO_API QuickListModel : public QuickModelBase { +private: Q_OBJECT Q_PROPERTY(bool allChecked READ allChecked WRITE setAllChecked NOTIFY allCheckedChanged) - AUTO_PROPERTY(int, visibledCount, 0) - AUTO_PROPERTY(int, selectedCount, 0) - AUTO_PROPERTY(int, checkedCount, 0) - - AUTO_PROPERTY(QStringList, headerRoles, {}) - AUTO_PROPERTY(Qt::SortOrder, sortOrder, Qt::AscendingOrder) - AUTO_PROPERTY(QString, sortRole, {}) - AUTO_PROPERTY(QStringList, noSortRoles, {}) + + AUTO_PROPERTY_V2(int, visibledCount, 0) + AUTO_PROPERTY_V2(int, selectedCount, 0) + AUTO_PROPERTY_V2(int, checkedCount, 0) + + AUTO_PROPERTY_V2(QStringList, headerRoles, {}) + AUTO_PROPERTY_V2(Qt::SortOrder, sortOrder, Qt::AscendingOrder) + AUTO_PROPERTY_V2(QString, sortRole, {}) + AUTO_PROPERTY_V2(QStringList, noSortRoles, {}) +signals: + void visibledCountChanged(int); + void selectedCountChanged(int); + void checkedCountChanged(int); + void headerRolesChanged(const QStringList&); + void sortOrderChanged(Qt::SortOrder); + void sortRoleChanged(const QString&); + void noSortRolesChanged(const QStringList&); + public: using Super = QuickModelBase; explicit QuickListModel(QObject* parent = nullptr); diff --git a/3rdparty/TaoCommon/src/TaoCommon/QuickModel/QuickModelBase.hpp b/3rdparty/TaoCommon/src/TaoCommon/QuickModel/QuickModelBase.hpp index e39a3bfb..aada48cb 100644 --- a/3rdparty/TaoCommon/src/TaoCommon/QuickModel/QuickModelBase.hpp +++ b/3rdparty/TaoCommon/src/TaoCommon/QuickModel/QuickModelBase.hpp @@ -6,6 +6,7 @@ template class QuickModelBase : public QAbstractListModel { + public: using Super = QAbstractListModel; explicit QuickModelBase(QObject* parent = nullptr); diff --git a/3rdparty/TaoCommon/src/TaoCommon/Trans/Trans.cpp b/3rdparty/TaoCommon/src/TaoCommon/Trans/Trans.cpp index 93c8d127..32c6a35a 100644 --- a/3rdparty/TaoCommon/src/TaoCommon/Trans/Trans.cpp +++ b/3rdparty/TaoCommon/src/TaoCommon/Trans/Trans.cpp @@ -6,8 +6,10 @@ #include #include #include -const static auto cEnglisthStr = u8"English"; -const static auto cChineseStr = u8"简体中文"; + +const static QString cEnglisthStr = QStringLiteral("English"); +const static QString cChineseStr = QStringLiteral("简体中文"); + Trans::Trans(QObject* parent) : QTranslator(parent) { diff --git a/TaoQuick.sln b/TaoQuick.sln new file mode 100644 index 00000000..ac7d3f8c --- /dev/null +++ b/TaoQuick.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35431.28 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TaoQuickShow", "examples\TaoQuickShow\TaoQuickShow.vcxproj", "{459D668B-0F88-4B38-9C16-E28F89505358}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|x64 = Debug|x64 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {459D668B-0F88-4B38-9C16-E28F89505358}.Debug|x64.ActiveCfg = Debug|x64 + {459D668B-0F88-4B38-9C16-E28F89505358}.Debug|x64.Build.0 = Debug|x64 + {459D668B-0F88-4B38-9C16-E28F89505358}.Release|x64.ActiveCfg = Release|x64 + {459D668B-0F88-4B38-9C16-E28F89505358}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {DC052BAA-5D0E-46CB-A268-F382FB176B69} + EndGlobalSection +EndGlobal diff --git a/examples/TaoQuickShow/Src/AppInfo.cpp b/examples/TaoQuickShow/Src/AppInfo.cpp index 3aeeca3a..08c38e5a 100644 --- a/examples/TaoQuickShow/Src/AppInfo.cpp +++ b/examples/TaoQuickShow/Src/AppInfo.cpp @@ -1,5 +1,6 @@ #include "AppInfo.h" #include "Ver-u8.h" +#include "taoVersionInfo.h" #include #include AppInfo::AppInfo(QObject* parent) diff --git a/examples/TaoQuickShow/Src/DeviceAddTable/DeviceAddItem.h b/examples/TaoQuickShow/Src/DeviceAddTable/DeviceAddItem.h index 9d1a104d..76fb0013 100644 --- a/examples/TaoQuickShow/Src/DeviceAddTable/DeviceAddItem.h +++ b/examples/TaoQuickShow/Src/DeviceAddTable/DeviceAddItem.h @@ -7,10 +7,15 @@ class DeviceAddItem : public QuickListItemBase { Q_OBJECT - AUTO_PROPERTY(QString, name, "") - AUTO_PROPERTY(QString, address, "") - AUTO_PROPERTY(QString, modelString, "") - AUTO_PROPERTY(bool, online, false) + AUTO_PROPERTY_V2(QString, name, "") + AUTO_PROPERTY_V2(QString, address, "") + AUTO_PROPERTY_V2(QString, modelString, "") + AUTO_PROPERTY_V2(bool, online, false) +signals: + void nameChanged(const QString&); + void addressChanged(const QString&); + void modelStringChanged(const QString&); + void onlineChanged(bool); public: explicit DeviceAddItem(QObject* parent = nullptr); diff --git a/examples/TaoQuickShow/Src/main.cpp b/examples/TaoQuickShow/Src/main.cpp index aefa81a6..c22406d2 100644 --- a/examples/TaoQuickShow/Src/main.cpp +++ b/examples/TaoQuickShow/Src/main.cpp @@ -1,3 +1,4 @@ + #include "AppInfo.h" #include "DeviceAddTable/DeviceAddModel.h" #include "Frameless/TaoFrameLessView.h" @@ -126,7 +127,11 @@ int main(int argc, char** argv) // qml call 'Qt.quit()' will emit engine::quit, here should call qApp->quit QObject::connect(view.engine(), &QQmlEngine::quit, qApp, &QCoreApplication::quit); // qml clear content before quit - QObject::connect(qApp, &QGuiApplication::aboutToQuit, qApp, [&view]() { view.setSource({}); }); + QObject::connect(qApp, &QGuiApplication::aboutToQuit, qApp, [&view]() + { + view.setSource({}); + qInstallMessageHandler(nullptr); + }); view.setSource(url); view.moveToScreenCenter(); diff --git a/examples/TaoQuickShow/TaoQuickShow.vcxproj b/examples/TaoQuickShow/TaoQuickShow.vcxproj new file mode 100644 index 00000000..04e531b4 --- /dev/null +++ b/examples/TaoQuickShow/TaoQuickShow.vcxproj @@ -0,0 +1,200 @@ + + + + + Debug + x64 + + + Release + x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + output + + + + + + + + + + + + + + + + + output + true + false + + + + + + + + + + + + + + output + + + + + + + {459D668B-0F88-4B38-9C16-E28F89505358} + QtVS_v304 + 10.0.19041.0 + $(MSBuildProjectDirectory)\QtMsBuild + + + + Application + v142 + true + Unicode + + + Application + v142 + false + true + Unicode + + + + + + + 5.15.12_msvc2019_64 + quick + debug + true + + + 5.15.12_msvc2019_64 + quick + release + + + + + + + + + + + + + + + + + $(SolutionDir)3rdparty\TaoCommon\src\TaoCommon;$(SolutionDir);$(IncludePath) + + + $(SolutionDir)3rdparty\TaoCommon\src\TaoCommon;$(SolutionDir);$(IncludePath) + + + + Default + TaoCommon_NO_LIB;TaoQuickShowPath="qrc:/";TaoQuickImportPath="qrc:/";%(PreprocessorDefinitions) + /utf-8 %(AdditionalOptions) + + + + + Default + TaoCommon_NO_LIB;TaoQuickShowPath="qrc:/";TaoQuickImportPath="qrc:/";%(PreprocessorDefinitions) + /utf-8 %(AdditionalOptions) + + + + + true + Level3 + true + true + + + Windows + true + + + Moc'ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName) + moc_%(Filename).cpp + + + Uic'ing %(Identity)... + .\GeneratedFiles + ui_%(Filename).h + + + + + true + Level3 + true + true + true + true + + + Windows + false + true + true + + + Moc'ing %(Identity)... + .\GeneratedFiles\$(ConfigurationName) + moc_%(Filename).cpp + + + Uic'ing %(Identity)... + .\GeneratedFiles + ui_%(Filename).h + + + + + + + + + \ No newline at end of file diff --git a/examples/TaoQuickShow/TaoQuickShow.vcxproj.filters b/examples/TaoQuickShow/TaoQuickShow.vcxproj.filters new file mode 100644 index 00000000..5952cc63 --- /dev/null +++ b/examples/TaoQuickShow/TaoQuickShow.vcxproj.filters @@ -0,0 +1,196 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + qml;cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + qrc;rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {639EADAA-A684-42e4-A9AD-28FC9BCB8F7C} + ts + + + {0780f67f-1677-41e7-a3fd-38e8c9b0218b} + + + {2e55065f-d815-466c-8d37-d14cd7977af3} + + + {c6a242b6-b744-4887-8c32-f90124eb9748} + + + {4c8b6cca-d44b-4fd1-b1ac-4df5da432066} + + + {c8da1b71-eb0a-4b33-ac71-b48a36df99db} + + + {d7fa3a1f-ae61-40c4-a5f9-48d267c880d6} + + + {a670327f-344e-44d9-aca4-69b4069f6fd7} + + + {038ed288-0f7f-4954-a9bd-92e6e3a8cd4c} + + + {d99a6fb6-65e0-4523-b1da-44a3cf1baa52} + + + {66d20328-4363-489c-9e78-0187bd5b9796} + + + {be6c7c5e-a8cd-4a06-b23a-56023751c219} + + + {23e94e10-78b9-4d83-a4e4-26dd2941ebea} + + + {d49c24fe-0f88-409b-9aee-958d402d102e} + + + + + Resource Files + + + Resource Files + + + Resource Files + + + TaoQuick + + + + + Source Files + + + Source Files + + + Source Files\DeviceAddTable + + + Source Files\DeviceAddTable + + + TaoCommon\Frameless + + + TaoCommon\Logger + + + TaoCommon\QuickModel + + + TaoCommon\QuickModel + + + TaoCommon\QuickTool + + + TaoCommon\QuickTree\Model + + + TaoCommon\Thread + + + TaoCommon\Trans + + + + + Source Files + + + Source Files\DeviceAddTable + + + Source Files\DeviceAddTable + + + TaoCommon\Frameless + + + TaoCommon\QuickModel + + + TaoCommon\QuickTool + + + TaoCommon\QuickTree\Model + + + TaoCommon\QuickTree\Model + + + TaoCommon\Thread + + + TaoCommon\Thread + + + TaoCommon\Trans + + + TaoCommon\QuickModel + + + + + TaoCommon + + + TaoCommon\Common + + + TaoCommon\Common + + + TaoCommon\Common + + + TaoCommon\Common + + + TaoCommon\Common + + + TaoCommon\Common + + + TaoCommon\Common + + + TaoCommon\Logger + + + TaoCommon\Logger + + + TaoCommon\Thread + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + TaoCommon\QuickModel + + + \ No newline at end of file diff --git a/taoVersionInfo.h b/taoVersionInfo.h new file mode 100644 index 00000000..48770812 --- /dev/null +++ b/taoVersionInfo.h @@ -0,0 +1,12 @@ +#ifndef TAO_VERSION_INFO_H +#define TAO_VERSION_INFO_H + +#define TaoREVISIONSTR "rev" +#define TaoVer "1.2.0" +#define TaoMAJ 1 +#define TaoMIN 2 +#define TaoPAT 0 +#define TaoDATETIME "0" +#define CXX_COMPILER_ID "vc143" + +#endif //TAO_VERSION_INFO_H