Qt Creator和Qt Designer都是很好的开源项目,利于学习提升。
一、官方源码下载
1、官方github源码
https://github/qt-creator/qt-creator Qt Creator源码
https://github/qt-creator/qt-creator/tree/master/src/plugins/designer Qt Creator的设计师插件
https://github/qt/qtbase Qt核心类源码
https://github/qt/qttools Qt工具类源码
https://github/qt/qttools/tree/dev/src/designer Qt设计师的源码
https://github/qt/qttools/tree/dev/src/windeployqt 依赖库工具源码
2、官方正式发行网站【推荐这里下载】
qt-creator-opensource-src-4.12.4.zip,解压缩qt-creator-opensource-src-4.12.4.zip,里面有README.md,有详细的编译说明。
Index of /archive/qtcreator/4.12/4.12.4
Index of /archive/qtcreator/4.13/4.13.3
qttools-everywhere-src-5.12.9.zip,里面有Qt设计师的源码。
Index of /official_releases/qt/5.12/5.12.9/submodules
Index of /official_releases/qt/5.12/5.12.12/submodules
二、笔者电脑的环境
1、Windows
Win7+Qt 5.12.9+Qt Creator 4.12+MSVC 2017 64bit+Python 3.7+ActivePerl-5.28 x64
2、MacOS-10.15-Catalina
MacOS 10.15.4+Qt 5.12.9+Qt Creator 4.12+Clang 11.0 x64+Python 3.7+Xcode 11.4
Mac终端命令sw_vers可以查看Mac OS版本
Mac终端命令clang --version可以查看clang版本
注意事项:
qtcreator v4.14.x和qtcreator v4.15.x版本,必须要Qt 5.14以上版本才能编译!!!
三、源码编译
Qt Creator IDE分别打开源码文件夹的qtcreator.pro和qttools.pro文件
qt-creator-opensource-src-4.12.4
qttools-everywhere-src-5.12.9
1、Windows
qt-creator-opensource-src直接编译即可,成功通过。
qttools-everywhere-src有少部分项目不支持debug编译,会报错,因为官网提供的Qt5Bootstrap.lib没有debug版本;
此外如果电脑没有安装vulkan-sdk,也会报错,无法打开包括文件: “vulkan/vulkan.h”
error: dependent 'F:\Qt\Qt5.12.9\5.12.9\msvc2017_64\lib\Qt5Bootstrapd.lib' does not exist.
F:\Qt\Qt5.12.9\5.12.9\msvc2017_64\include\QtGui\qvulkaninstance.h:55: error: C1083: 无法打开包括文件: “vulkan/vulkan.h”: No such file or directory
解决办法:
把\qttools-everywhere-src-5.12.9\src\src.pro去掉相应的子项目即可
macdeployqt
qdoc
qtdiag
windeployqt
winrtrunner
src.pro文件,去掉以上模块,加注释"#":
#qtConfig(qdoc): qtConfig(thread): SUBDIRS += qdoc
!android|android_app: SUBDIRS += qtpaths
macos {
# SUBDIRS += macdeployqt
}
qtHaveModule(dbus): SUBDIRS += qdbus
#win32|winrt:SUBDIRS += windeployqt
#winrt:SUBDIRS += winrtrunner
#qtHaveModule(gui):!wasm:!android:!uikit:!qnx:!winrt: SUBDIRS += qtdiag
或者更彻底一点,把其他项目全部去掉,仅留下designer,
qttools-everywhere-src-5.12.9\qttools.pro文件修改为:
TEMPLATE = subdirs
CONFIG += ordered
SUBDIRS += \
src \
qttools-everywhere-src-5.12.9\src\src.pro文件修改为:
TEMPLATE = subdirs
SUBDIRS = designer
2、macOS
qt-creator-opensource-src直接编译即可,成功通过。
qttools-everywhere-src直接编译即可,成功通过。
注意事项
qt-creator-4.12.x新版本引入了开源项目advanceddockingsystem
开源项目:
https://github/githubuser0xFFFF/Qt-Advanced-Docking-Systemhttps://github/githubuser0xFFFF/Qt-Advanced-Docking-System
在qtcreator的源码路径是:
qt-creator-opensource-src-4.12.4\src\libs\advanceddockingsystem
编译之前,需要把源文件和头文件的编码修改为utf8+bom
附录1
build-qtcreator-Desktop_Qt_5_12_9_MSVC2017_64bit-Debug\src\app\app_version.h
#pragma once
namespace Core {
namespace Constants {
#define STRINGIFY_INTERNAL(x) #x
#define STRINGIFY(x) STRINGIFY_INTERNAL(x)
const char IDE_DISPLAY_NAME[] = "Qt Creator";
const char IDE_ID[] = "qtcreator";
const char IDE_CASED_ID[] = "QtCreator";
#define IDE_VERSION 4.12.4
#define IDE_VERSION_STR STRINGIFY(IDE_VERSION)
#define IDE_VERSION_DISPLAY_DEF 4.12.4
#define IDE_VERSION_MAJOR 4
#define IDE_VERSION_MINOR 12
#define IDE_VERSION_RELEASE 4
const char * const IDE_VERSION_LONG = IDE_VERSION_STR;
const char * const IDE_VERSION_DISPLAY = STRINGIFY(IDE_VERSION_DISPLAY_DEF);
const char * const IDE_AUTHOR = "The Qt Company Ltd";
const char * const IDE_YEAR = "2020";
#ifdef IDE_REVISION
const char * const IDE_REVISION_STR = STRINGIFY(IDE_REVISION);
#else
const char * const IDE_REVISION_STR = "";
#endif
// changes the path where the settings are saved to
#ifdef IDE_SETTINGSVARIANT
const char * const IDE_SETTINGSVARIANT_STR = STRINGIFY(IDE_SETTINGSVARIANT);
#else
const char * const IDE_SETTINGSVARIANT_STR = "QtProject";
#endif
#ifdef IDE_COPY_SETTINGS_FROM_VARIANT
const char * const IDE_COPY_SETTINGS_FROM_VARIANT_STR = STRINGIFY(IDE_COPY_SETTINGS_FROM_VARIANT);
#else
const char * const IDE_COPY_SETTINGS_FROM_VARIANT_STR = "";
#endif
#undef IDE_VERSION_DISPLAY_DEF
#undef IDE_VERSION
#undef IDE_VERSION_STR
#undef STRINGIFY
#undef STRINGIFY_INTERNAL
} // Constants
} // Core
附录2
欢迎访问我的另一篇博客使用Qt Creator IDE+MSVC2015 32bit编译器组合,自行编译Qt Creator源码4.8.2版本https://blog.csdn/libaineu2004/article/details/89394618
引申阅读
编写Qt Designer自定义控件(一)——如何创建并使用Qt自定义控件
编写Qt Designer自定义控件(二)——编写自定义控件界面
编写Qt Designer自定义控件(三)——给自定义控件添加属性
编写Qt Designer自定义控件(四)——使用自定义控件
Qt Creator 源码学习笔记01,初识QTC - 知乎阅读本文大概需要 4 分钟 Qt Creator 是一款开源的轻量级 IDE,整个架构代码全部使用 C++/Qt 开发而成,非常适合用来学习C++和Qt 知识,这也是我们更加深入学习Qt最好的方式,学习了解官方人员是如何开发一款软件…https://zhuanlan.zhihu/p/434089535
更多推荐
在Windows和macOS平台,自主编译Qt Creator和Qt Designer设计师源码
发布评论