简体   繁体   English

Qt:即使包含“Q3DScatter”也无法识别

[英]Qt: 'Q3DScatter' not recognized even though it is included

I want to show a 3DScatter graph in my main window.我想在主窗口中显示 3DScatter 图。

In my mainwindow.h i have included #include <Q3DScatter> but when entering 3DScatter scatterGraph;在我的mainwindow.h 中,我包含了#include <Q3DScatter>但在输入3DScatter scatterGraph; in the public: section of the MainWindow class i get this error message:public: MainWindow 类的部分中,我收到此错误消息:

error: unknown type name 'Q3DScatter'

Here is what I've already checked:这是我已经检查过的:

  • In the Qt Maintenance Tool the 'Qt Data Visualization' module is already installed在 Qt 维护工具中,已经安装了“Qt 数据可视化”模块
  • There are no errors for #include <Q3DScatter> #include <Q3DScatter>没有错误
  • When going to Tools -> Locate and entering 'Q3DScatter' it finds both Q3DScatter and q3dscatter.h当转到Tools -> Locate并输入“Q3DScatter”时,它会同时找到Q3DScatterq3dscatter.h
  • In q3dscatter.h exists classes named Q3DScatterPrivate and Q3DScatterq3dscatter.h存在名为Q3DScatterPrivateQ3DScatter
  • In the .pro file the first line is QT += core gui datavisualization.pro文件中,第一行是QT += core gui datavisualization

What am I doing wrong?我究竟做错了什么? The module seems to exist but why can't I create the Q3DScatter scatterGraph ?该模块似乎存在,但为什么我不能创建Q3DScatter scatterGraph

EDIT: This is the entire error message from the Compile Output:编辑:这是来自编译输出的整个错误消息:

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"

A quick look at the headers suggests that Q3DScatter is declared under the namespace QtDataVisualization .快速查看标题表明Q3DScatter是在命名空间QtDataVisualization下声明的。 That being the case you need to use...在这种情况下,您需要使用...

QtDataVisualization::Q3DScatter scatterGraph;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM