“设计”按钮在 QML 项目的 Qt Creator 中呈灰色

发布于 2024-12-20 22:57:52 字数 796 浏览 3 评论 0原文

我在 Kubuntu 11 系统上尝试我的第一个 Qt Quick 项目。由于这是 Kubuntu,我只是使用它附带的 Qt 运行,到目前为止它运行良好。

我要求 Qt Creator 从 Qt Quick 创建示例“Hello World”项目。但设计按钮和运行按钮都是灰色的。

起初,当我进入“运行设置”下的“项目”菜单时,它显示Qt版本:[无效的Qt版本]。按“管理 Qt 版本”按钮会弹出一个树形控件,如下所示:

v -- Auto-detected
|     |
|     +---Qt in PATH /usr/bin/qmake-qt4
|
+--- Manual

在对话框底部显示“Found Qt version 4.7.2, using mkspec linux-g++ (Desktop)”

我发现我可以通过手动选择 从应用程序存储库安装 QmlViewer。您可能认为它会说更像“未找到 Qml Viewer,请安装它”之类的内容,但是......哦,好吧。现在它显示Qt Version: [Qt in PATH]

这样问题就解决了,Qml 应用程序就可以运行了。但“设计”按钮仍然是灰色的。 Qt Designer 作为应用程序安装,其插件显示在“关于插件...”列表中。当我单击表单文件时,设计按钮在普通(非 Qt-Quick)项目中启用,但不适用于 .qml 文件。

I'm on a Kubuntu 11 system and trying out my first Qt Quick project. As this is Kubuntu I'm just running with the Qt that came with it, which has worked fine so far.

I asked Qt Creator to create the sample "Hello World" project from Qt Quick. But the design button was grayed out, as were the run buttons.

At first when I went into the Projects menu under "Run Settings" it said Qt version: [Invalid Qt Version]. Pushing the "Manage Qt versions" button brings up a tree control that looks like this:

v -- Auto-detected
|     |
|     +---Qt in PATH /usr/bin/qmake-qt4
|
+--- Manual

At the bottom of the dialog it says "Found Qt version 4.7.2, using mkspec linux-g++ (Desktop)"

I found out that I could get the "Invalid Qt version" message to go away by manually choosing to install QmlViewer from the app repositories. You'd think it would say something more like "Qml Viewer not found, please install it" but...oh well. Now it says Qt Version: [Qt in PATH].

So that's fixed, and the Qml app runs. But the "Design" button is still grayed out. Qt Designer is installed as an application, and its plugin shows in the "About Plugins..." list. The design button is enabled in ordinary (non-Qt-Quick) projects when I click on a form file, just not for .qml files.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

ぶ宁プ宁ぶ 2024-12-27 22:57:53

在 QtCreator 中,转到帮助 ->关于插件->选择“QT 快速”。
重新启动 QtCreator,然后选择 ui.qml 文件。现在应该可以了

in the QtCreator, go to Help -> About plugins -> Select "QT Quick".
Restart QtCreator and then select the ui.qml files. It should work now

旧城空念 2024-12-27 22:57:53

就我而言,它没有显示,因为我打开了 cpp 文件。当我双击 .ui 文件时,设计按钮变为活动状态。

In my case it wasn't showing up because I had my cpp file open. When I double clicked on the .ui file, the design button became active.

沙沙粒小 2024-12-27 22:57:53

写问题的时候就解决了。

长话短说:这似乎是通过 ubuntu 存储库安装 Qt Creator 的一个已知问题,而不是使用诺基亚的 Qt SDK 安装程序:

http://qt.nokia.com/downloads

(该安装程序似乎负责确保安装正确的 SDK 元素,而 Linux 软件包存储库滞后)

另一种选择似乎是从源代码构建 Qt。但是卸载我通过 KPackageKit 获得的 Qt Creator 并使用诺基亚的安装程序则涉及较少,并且在这种情况下对我有用。

Solved it while writing the question.

To make a long story short: this appears to be a known issue in general with installing Qt Creator through the ubuntu repositories as opposed to using the Qt SDK Installer from Nokia:

http://qt.nokia.com/downloads

(That installer seems to do the work of making sure the proper SDK elements are installed, while the linux package repositories lag in getting things right.)

Another option seems to be building Qt from sources. But uninstalling the Qt Creator I got through KPackageKit and instead using the installer from Nokia was less involved, and worked for me in this case.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文