我想在我的 3d 查看器中使用选择,我尝试了这个例子,但我遇到了以下问题:
错误:“SceneElement”未在此范围 QList sceneElements 中声明;
场景.h 文件:
#ifndef SCENE_H
#define SCENE_H
#include <sceneelement.h>
#include <QGLViewer/qglviewer.h>
class Scene
{
private:
/// The list of elements that make up the scene
QList <SceneElement*> sceneElements ;
public:
Scene();
/// Creates a scene with RenderElements positionned on a regular grid.
/// Consider increasing selectBufferSize() if you use more RenderElements.
void draw();
void setSelected(int i);
void drawWithNames();
void clearSelection();
};
场景元素.h 文件:
#include <QGLViewer/qglviewer.h>
#include <viewer.h>
class SceneElement
{
friend class Scene;
private:
qglviewer::Frame frame;
bool isSelected;
public:
/// Constructor
SceneElement(float x, float y){
isSelected=false;
qglviewer::Vec pos(x,y,0.0);
frame.setPosition(pos);
}
/// Draws this element
void draw() const;
};
我不知道为什么它不能使用SceneElement,虽然我包括了 sceneelement.h
感谢您的帮助,谢谢。