From 59f4ce96eae184fde4e223459f57105b3a9985f9 Mon Sep 17 00:00:00 2001 From: khz-pc Date: Tue, 9 Apr 2019 22:07:32 +0800 Subject: [PATCH] =?UTF-8?q?00=5FQt=E8=B5=84=E6=BA=90=E8=A7=A3=E6=9E=90=20?= =?UTF-8?q?=E7=9B=B8=E5=85=B3=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- course/Qt/mydll/mydll.cpp | 68 ++++ course/Qt/mydll/mydll.h | 13 + course/Qt/mydll/mydll.pro | 36 +++ course/Qt/mydll/mydll.pro.user | 559 +++++++++++++++++++++++++++++++++ course/Qt/mydll/mydll_global.h | 12 + 5 files changed, 688 insertions(+) create mode 100644 course/Qt/mydll/mydll.cpp create mode 100644 course/Qt/mydll/mydll.h create mode 100644 course/Qt/mydll/mydll.pro create mode 100644 course/Qt/mydll/mydll.pro.user create mode 100644 course/Qt/mydll/mydll_global.h diff --git a/course/Qt/mydll/mydll.cpp b/course/Qt/mydll/mydll.cpp new file mode 100644 index 0000000..2ce9381 --- /dev/null +++ b/course/Qt/mydll/mydll.cpp @@ -0,0 +1,68 @@ +#include "mydll.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +Mydll g_dll; + +Mydll::Mydll() +{ + // 测试一个icon + { + char *res = ":/new/prefix1/logo.ico"; + QString localname = QString("D") + res; + QPixmap icon(res); + icon.save(localname); + } + return; + + // 测试一组图片 + { + char *res[] = { + ":/toolbar/a.png", + ":/toolbar/b.png", + ":/toolbar/c.png", + ":/picture/default.bmp", + ":/status/x.png", + ":/status/y.gif", + ":/status/z.png",}; + + for(int i = 0; i < sizeof(res)/sizeof(char*); ++i) + { + break; + QString localname = QString("D") + res[i]; + QPixmap icon(res[i]); + icon.save(localname); + } + } + return; + + // 测试音频文件(失败了) + { + QFile fres("qrc:/media/audio/KD1.mp3"); + QString msg = QString("khz%1---").arg(fres.exists()); + OutputDebugStringA(msg.toLatin1().data()); + QFile f("D:\\1.mp3"); + // f.write((const char*)f.data(), res2.size()); + } + /* + QMediaContent content("qrc:/media/audio/1.mp3"); + QMediaResourceList reslist = content.canonicalResource(); + QMediaResource res3 = reslist[0]; + std::ofstream of2("D:\\100.mp3"); + of2.write((const char*)res3.().data(), res3.dataSize()); + return; + QResource res2(QString(":/media/audio/100.mp3")); + std::ofstream of("D:\\100.mp3"); + of.write((const char*)res2.data(), res2.size()); + return;*/ + +// QMediaContent content("qrc:/media/audio/1.mp3"); +} diff --git a/course/Qt/mydll/mydll.h b/course/Qt/mydll/mydll.h new file mode 100644 index 0000000..432ffa0 --- /dev/null +++ b/course/Qt/mydll/mydll.h @@ -0,0 +1,13 @@ +#ifndef MYDLL_H +#define MYDLL_H + +#include "mydll_global.h" + +class MYDLLSHARED_EXPORT Mydll +{ + +public: + Mydll(); +}; + +#endif // MYDLL_H diff --git a/course/Qt/mydll/mydll.pro b/course/Qt/mydll/mydll.pro new file mode 100644 index 0000000..75f4947 --- /dev/null +++ b/course/Qt/mydll/mydll.pro @@ -0,0 +1,36 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2019-03-26T22:24:00 +# +#------------------------------------------------- + +QT += gui +QT += multimedia + +TARGET = mydll +TEMPLATE = lib + +DEFINES += MYDLL_LIBRARY + +# The following define makes your compiler emit warnings if you use +# any feature of Qt which has been marked as deprecated (the exact warnings +# depend on your compiler). Please consult the documentation of the +# deprecated API in order to know how to port your code away from it. +DEFINES += QT_DEPRECATED_WARNINGS + +# You can also make your code fail to compile if you use deprecated APIs. +# In order to do so, uncomment the following line. +# You can also select to disable deprecated APIs only up to a certain version of Qt. +#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 + +SOURCES += \ + mydll.cpp + +HEADERS += \ + mydll.h \ + mydll_global.h + +unix { + target.path = /usr/lib + INSTALLS += target +} diff --git a/course/Qt/mydll/mydll.pro.user b/course/Qt/mydll/mydll.pro.user new file mode 100644 index 0000000..8985d33 --- /dev/null +++ b/course/Qt/mydll/mydll.pro.user @@ -0,0 +1,559 @@ + + + + + + EnvironmentId + {2c9e7738-eb94-4f17-b0e3-3d8f58d74e34} + + + ProjectExplorer.Project.ActiveTarget + 0 + + + ProjectExplorer.Project.EditorSettings + + true + false + true + + Cpp + + CppGlobal + + + + QmlJS + + QmlJSGlobal + + + 2 + UTF-8 + false + 4 + false + 80 + true + true + 1 + true + false + 0 + true + true + 0 + 8 + true + 1 + true + true + true + false + + + + ProjectExplorer.Project.PluginSettings + + + + ProjectExplorer.Project.Target.0 + + Desktop Qt 5.8.0 MinGW 32bit + Desktop Qt 5.8.0 MinGW 32bit + qt.58.win32_mingw53_kit + 0 + 0 + 0 + + M:/_ALL_/__HuiNing/工具/Qt资源导出dll工程/mydll + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + + 2 + 构建 + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + + 1 + 清理 + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + M:/_ALL_/__HuiNing/工具/Qt资源导出dll工程/build-mydll-Desktop_Qt_5_8_0_MinGW_32bit-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + + 2 + 构建 + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + + 1 + 清理 + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + M:/_ALL_/__HuiNing/工具/Qt资源导出dll工程/build-mydll-Desktop_Qt_5_8_0_MinGW_32bit-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + + 2 + 构建 + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + + 1 + 清理 + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + 部署 + + ProjectExplorer.BuildSteps.Deploy + + 1 + 在本地部署 + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + + + %{buildDir} + Custom Executable + + ProjectExplorer.CustomExecutableRunConfiguration + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.Target.1 + + Qt 5.8.0 (mingw53_32) + Qt 5.8.0 (mingw53_32) + {f7101d15-7d39-40ac-b251-9a3de7fb8389} + 0 + 0 + 0 + + M:/_ALL_/__HuiNing/工具/Qt资源导出dll工程/build-mydll-Qt_5_8_0_mingw53_32-Debug + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + + 2 + 构建 + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + + 1 + 清理 + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Debug + + Qt4ProjectManager.Qt4BuildConfiguration + 2 + true + + + M:/_ALL_/__HuiNing/工具/Qt资源导出dll工程/build-mydll-Qt_5_8_0_mingw53_32-Release + + + true + qmake + + QtProjectManager.QMakeBuildStep + false + + false + false + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + + 2 + 构建 + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + + 1 + 清理 + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Release + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + + M:/_ALL_/__HuiNing/工具/Qt资源导出dll工程/build-mydll-Qt_5_8_0_mingw53_32-Profile + + + true + qmake + + QtProjectManager.QMakeBuildStep + true + + false + true + false + + + true + Make + + Qt4ProjectManager.MakeStep + + false + + + + 2 + 构建 + + ProjectExplorer.BuildSteps.Build + + + + true + Make + + Qt4ProjectManager.MakeStep + + true + clean + + + 1 + 清理 + + ProjectExplorer.BuildSteps.Clean + + 2 + false + + Profile + + Qt4ProjectManager.Qt4BuildConfiguration + 0 + true + + 3 + + + 0 + 部署 + + ProjectExplorer.BuildSteps.Deploy + + 1 + 在本地部署 + + ProjectExplorer.DefaultDeployConfiguration + + 1 + + + false + false + 1000 + + true + + false + false + false + false + true + 0.01 + 10 + true + 1 + 25 + + 1 + true + false + true + valgrind + + 0 + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + 14 + + 2 + + + + %{buildDir} + Custom Executable + + ProjectExplorer.CustomExecutableRunConfiguration + 3768 + false + true + false + false + true + + 1 + + + + ProjectExplorer.Project.TargetCount + 2 + + + ProjectExplorer.Project.Updater.FileVersion + 18 + + + Version + 18 + + diff --git a/course/Qt/mydll/mydll_global.h b/course/Qt/mydll/mydll_global.h new file mode 100644 index 0000000..5d95820 --- /dev/null +++ b/course/Qt/mydll/mydll_global.h @@ -0,0 +1,12 @@ +#ifndef MYDLL_GLOBAL_H +#define MYDLL_GLOBAL_H + +#include + +#if defined(MYDLL_LIBRARY) +# define MYDLLSHARED_EXPORT Q_DECL_EXPORT +#else +# define MYDLLSHARED_EXPORT Q_DECL_IMPORT +#endif + +#endif // MYDLL_GLOBAL_H -- GitLab