c++ - Qt:即使包含“Q3DScatter”也无法识别
问题描述
我想在我的主窗口中显示一个 3DScatter 图。
在我的mainwindow.h 中,我已经包含#include <Q3DScatter>
,但是当进入MainWindow 类3DScatter scatterGraph;
的public:部分时,我收到以下错误消息:
error: unknown type name 'Q3DScatter'
这是我已经检查过的内容:
- 在 Qt 维护工具中,已经安装了“Qt 数据可视化”模块
- 没有错误
#include <Q3DScatter>
- 当转到工具 -> 定位并输入“Q3DScatter”时,它会同时找到
Q3DScatter
和q3dscatter.h
- 在
q3dscatter.h
存在类命名Q3DScatterPrivate
和Q3DScatter
- 在
.pro
文件中,第一行是QT += core gui datavisualization
我究竟做错了什么?该模块似乎存在,但为什么我不能创建Q3DScatter scatterGraph
?
编辑:这是来自编译输出的完整错误消息:
In file included from ../MandelbulbUI/main.cpp:1:0:
../MandelbulbUI/mainwindow.h:26:5: error: ‘Q3DScatter’ does not name a type; did you mean ‘QDate’?
Q3DScatter scatterGraph;
^~~~~~~~~~
QDate
In file included from ../MandelbulbUI/mainwindow.cpp:1:0:
../MandelbulbUI/mainwindow.h:26:5: error: ‘Q3DScatter’ does not name a type; did you mean ‘QDate’?
Q3DScatter scatterGraph;
^~~~~~~~~~
QDate
In file included from moc_mainwindow.cpp:9:0:
../MandelbulbUI/mainwindow.h:26:5: error: ‘Q3DScatter’ does not name a type; did you mean ‘QDate’?
Q3DScatter scatterGraph;
^~~~~~~~~~
QDate
Makefile:1598: recipe for target 'main.o' failed
make: *** [main.o] Error 1
make: *** Waiting for unfinished jobs....
Makefile:1817: recipe for target 'moc_mainwindow.o' failed
make: *** [moc_mainwindow.o] Error 1
Makefile:1805: recipe for target 'mainwindow.o' failed
make: *** [mainwindow.o] Error 1
17:30:54: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project MandelbulbUI (kit: Desktop Qt 5.12.7 GCC 64bit)
When executing step "Make"
解决方案
快速查看标题表明它Q3DScatter
是在 namespace 下声明的QtDataVisualization
。在这种情况下,您需要使用...
QtDataVisualization::Q3DScatter scatterGraph;
推荐阅读
- oauth-2.0 - Active Directory 是否不支持使用 PKCE 的授权代码流?
- vba - 为什么不使用通配符设置在 VBA 宏中查找和替换将超链接单词识别为文本的合法部分
- javascript - 如何将 html 多行表数据获取到 Javascript
- automation - 从 cgit 克隆所有项目
- python - 对一堆文件进行平均处理
- delphi - Delphi 枚举单个底层类型为字节、字等,而不更改全局编译器设置
- python-3.x - ffmpy.FFExecutableNotFoundError:找不到可执行文件'ffmpeg'?
- rust - 一个人怎么能等待一个盒装的未来的结果呢?
- asp.net-core - 我可以在同一个项目中同时使用 Blazor 客户端和服务器端吗?更重要的是,我可以在同一个页面中使用它吗?
- javascript - 如何使用 lodash 将两个数组(数组 1d 和数组 2d)合并为一个对象