从 KDE Frameworks 5 和 Qt Creator 开始 [英] Starting with KDE Frameworks 5 and Qt Creator

查看:88
本文介绍了从 KDE Frameworks 5 和 Qt Creator 开始的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的系统中安装了新的 QtCreator 和 Qt 5.8.据我所知,我的 PC 上现在有 2 个 Qt 工具链:一个在 ~/Qt/5.8(默认路径)中,一个在 usr/lib/x86_64-linux-gnu/qt5 中/bin KDE 将其存储用于自己的目的./usr/lib/x86_64-linux-gnu/qt5/bin 中的版本是 5.7.
好的,如果我在 Qt Creator 中创建了一个虚拟项目,那么它将允许我只选择 Qt 5.8 Kit.如果我这样做,我将在我想要链接的任何 KDE 框架模块上得到 Project ERROR: Unknown module(s) in QT: KF5DBusAddons.
(我通过 .pro 文件中的 QT += KF5DBusAddons 链接它们)
似乎是因为 Qt 5.8 不知道 /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/ 中的 KDE 模块,因为它查看了 ~/Qt/5.8/gcc_64/mkspecs/modules/ 代替.并且没有 KDE 模块.不建议将它们作为 Qt Online Installer 工具的选项.

I've installed fresh QtCreator and Qt 5.8 to my system. As I understand there are 2 Qt toolchains right now on my PC: One in ~/Qt/5.8 (default path) and one is in usr/lib/x86_64-linux-gnu/qt5/bin where KDE stores it for own purposes. The one in /usr/lib/x86_64-linux-gnu/qt5/bin is version 5.7.
Ok, If I create a dummy project in Qt Creator then it'll allow me to choose only Qt 5.8 Kit. And if I do so I'll get Project ERROR: Unknown module(s) in QT: KF5DBusAddons on any KDE Frameworks module I want to link.
(I'm linking them by QT += KF5DBusAddons in .pro file)
It seems that's because Qt 5.8 don't know about KDE modules in /usr/lib/x86_64-linux-gnu/qt5/mkspecs/modules/ because it looks into ~/Qt/5.8/gcc_64/mkspecs/modules/ instead. And there are no KDE modules. They are not suggested as an option in Qt Online Installer tool.

好的,所以我需要从 /usr/lib/x86_64-linux-gnu/ 添加 Qt5.7 或在 Qt 5.8 之上安装 KDE Frameworks 5.我已经尝试了第一个并且遇到了配置问题.它仍然看不到 /usr/lib/x86_64-linux-gnu/ 中的模块.

Fine, so I need either add a Qt5.7 from /usr/lib/x86_64-linux-gnu/ or install KDE Frameworks 5 on top of Qt 5.8. I've tried the first one and run into configuration problems. It still cann't see modules in /usr/lib/x86_64-linux-gnu/.

我的问题是:是否有关于如何开始使用 KDE 框架和 Qt Creator 的工作教程.我可以坚持使用 qmake 工具链而不是 cmake 文件吗?或者关于如何将系统 Qt 库作为套件添加到 QtCreator 中的工作解释?

My question is: Is there a working tutorial on how to start with KDE Framework and Qt Creator. Can I stick with qmake toolchain and not cmake files? Or working explanation on how to add System Qt libraries as a Kit into QtCreator?

附言我正在尝试使用 /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64/qmake.conf 而我的 qmake 结果命令行是 qmake/home/user1/dev/kdbustest/kdbustest.pro -spec/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64/CONFIG+=debug &&/usr/bin/make qmake_all

P.S. I'm trying to use /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64/qmake.conf And my qmake result command line is qmake /home/user1/dev/kdbustest/kdbustest.pro -spec /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64/ CONFIG+=debug && /usr/bin/make qmake_all

推荐答案

Qt creator 对构建中使用的 qt 版本有自己的配置.

Qt creator has its own configuration for qt versions used in builds.

配置在 tools >选项 >构建并运行 >套件

确保您选择的套件(例如桌面)具有正确的 Qt 版本集.

Make sure the kit you have selected (e.g. Desktop) has the correct Qt version set.

如果下拉列表中没有您想要的 qt 版本,您可以在 Qt 版本选项卡中添加它.

If the qt version you want isn't in the dropdown, you can add it in the Qt Versions tab.

还要检查您是否选择了正确的工具包来构建您的项目(请参阅构建配置按钮 - 运行/绿色播放按钮上方)

Also check you have the right kit selected to build your project (see the build configuration button - above the run/green play button)

mkspec 应自动设置为使用系统 qt 版本和模块,但您可以通过将 Qt mkspec(在 tools > options > build and run > Kits 中)设置为/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64/

The mkspec should be automatically set to use the system qt version and modules, but you can make sure by setting Qt mkspec (in tools > options > build and run > Kits) to /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64/

完成所有这些之后,您可以通过在运行 build > 时查看编译编译输出窗格来验证是否正在运行正确的命令.运行 qmake.

After all this, you can verify the correct command is being run by looking at the compile compile output pane when running build > Run qmake.

这篇关于从 KDE Frameworks 5 和 Qt Creator 开始的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆