图片资源等来自于互联网。 本代码仓库,仅供学习,若被他人用于商业用途 与本人无关! 请遵守许可证!
- A plug-in-developed desktop application framework that can be used to quickly develop desktop applications;qt-creator/src/libs/extensionsystem at master · qt-creator/qt-creator (github.com);
- CooperatevcpkgUse it;
- 同时支持cmakeandqmakeCompile;
- Supports native Apple Silicon compilation;
- supportactionsCompile, package, publish;
Crash reporting procedure;
-
cmake: Encapsulated CMake utility function;
- utils: Practical functions;
-
docs: Document description and pictures;
-
examples: Sample code;
-
packaging: Packaging and publishing;
-
src: Source code;
-
3rdparty: Third-party library;
- qtlockedfile: Qt file lock;
- qtsingleapplication: Qt single instance;
-
aggregate:polymerization;
-
apps:app;
- app:Qt-App;
- crashreport:CrashReport;
-
core: Plugins are inherited from this;
-
dump: Crash capture function;
-
extensionsystem: Plugin system, the code comes from Qt-Creator, and some modifications have been made;
-
gui: Encapsulated interface components;
-
plugins: Plugin;
- aboutplugin:About plugins;
- coreplugin: Core plug-ins, main interface, menu, toolbar, status bar, settings, plug-in manager, etc.;
- guiplugin: GUI plug-in, some GUI components customized based on QSS style;
- hashplugin: hash plug-in, hash algorithm provided by QT;
- helloplugin: Hello plug-in, used for testing plug-in development;
- systeminfoplugin: System information plug-in;
-
resource: Pictures and QSS files;
-
utils: Tool function encapsulation;
-
-
translations: Translate the file;
-
MacOS, cmake generated bundle, not generated under .app/Contents/ folder
PkgInfo
document;- app/CMakeLists, using this CMakeLists.txt can generate bundles on MacOS, and the icons can be displayed normally, but there is no PkgInfo file;
- How to generate a PkgInfo file in cmake?
- Using WireShark
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/PkgInfo PROPERTIES MACOSX_PACKAGE_LOCATION .)
Similarly, copy it to the bundle;
- Using WireShark
- qmake will generate PkgInfo file by default, you only need to specify it
TARGET=app
orCONFIG+=bundle
Just do it;
-
Under Unix systems, it is necessary to use static libraries as much as possible to avoid the dependency problem of dynamic libraries;
- There are several modules in this project that are dynamic libraries because they are plugins and require dynamic loading;
- Then you need to package these dynamic libraries, then load them at runtime, and you also need to rpath
"-Wl,-rpath,\'\$$ORIGIN\':\'\$$ORIGIN/lib\':'\$$ORIGIN/../lib'")
, set it, otherwise the dynamic library will not be found; - Or use install_name_tool(macos) and patchelf/chrpath(linux) to modify the dependency path of the dynamic library, which is very troublesome;
- Also consider that these libraries can be shared, so don't re-package them;
- You can see for detailsworkflows;
-
MacOS,vcpkgCompiling third-party library issues;
- becausevcpkgat presentOnly support for individual compilation of x64-osx and arm64-osx;
- In usecmakeWhen specifying
CMAKE_OSX_ARCHITECTURES=x86_64
orCMAKE_OSX_ARCHITECTURES=arm64
; - In useqmakeWhen specifying
QMAKE_APPLE_DEVICE_ARCHS=x86_64
orQMAKE_APPLE_DEVICE_ARCHS=arm64
;
-
International real-time translation. The translation settings are currently changed and the program needs to be restarted before it can take effect;
- Update the translation command
```bash cmake --build build --target Qt-App_lupdate ```
-
I'm too lazy to change the code;
-
Specific reference: QT practical tips (update when you think of it), core code;
void Widget::changeEvent(QEvent *e) { QWidget::changeEvent(e); switch (e->type()) { case QEvent::LanguageChange: comboBox->setItemText(0, tr("Hello")); label->setText(tr("Hello")); // 代码添加的文字 ui->retranslateUi(this); // 有UI文件情况下 break; default: break; } }