【问题标题】:Qt/C++ Inheritance from QPolygonF as QList item从 QPolygonF 继承 Qt/C++ 作为 QList 项
【发布时间】:2014-09-02 12:34:11
【问题描述】:

我在使用 QList 时遇到问题。

T 应该继承自 QPolygonF。

看起来像:

class Polygon : public QPolygonF
{
public:
    Polygon(){}
    Polygon &operator=(const Polygon &other);
};

当我尝试定义 QList 时,出现以下编译错误:

type/value mismatch [...] for 'template<class T> class QList'
error: expected a type, got 'Polygon'

所以我认为,有些东西是在编译时定义的,但我不明白:(

QPolygonF 被 QVector 继承,也许这是个问题?

非常感谢!

【问题讨论】:

  • 我无法使用您提供的代码(Qt 4.x,msvc9)重现此问题。也许您必须包含声明多边形的头文件?看起来编译器不知道“多边形”类型是什么。
  • 我正在使用 Qt 5.2,MinGW,包含头文件

标签: c++ qt inheritance qlist qpolygon


【解决方案1】:

我想通了。 我使用了一些已经定义了多边形的 CAD 库。编译器消息没有帮助 =(

可以关闭。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-08
    • 2011-09-24
    • 2010-11-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多