【发布时间】:2015-11-03 09:28:00
【问题描述】:
我继承了QGraphicsView:
class CustomGraphicsView : public QGraphicsView
{
public:
CustomGraphicsView(QWidget *parent = 0);
...
}
.cpp 文件中的构造函数然后是这样实现的:
CustomGraphicsView::CustomGraphicsView(QWidget * parent):
QGraphicsView(parent)
{
}
现在我通过 Qt 创建者将 QGraphicsView Widget 提升到 CustomGraphicsView。但是当我想在 ImageWindow 类的构造函数中连接到提升的小部件时;
ImageWindow::ImageWindow(QWidget *parent) :
QDialog(parent),
ui(new Ui::ImageWindow)
{
ui->setupUi(this);
CustomGraphicsView * view = ui->graphicsView();
}
我收到错误消息:
term does not evaluate to a function taking 0 arguments.
我为构造函数指定了一个默认值,即 QWidget *parent = 0,并且在ui_image_window.h 中设置了一个参数:
graphicsView = new CustomGraphicsView(ImageWindow);
那么什么会导致这个错误呢?
【问题讨论】:
标签: c++ qt qt-creator qwidget