读书人

事例程序QtExample/tutorials/modelvi

发布时间: 2012-12-23 11:28:15 作者: rapoo

例子程序QtExample/tutorials/modelview/5_edit中有一个函数无法定位
如题。我在学习Qt的过程中遇到了这样一个怪事。附带的例子程序5_edit中MyEdit类的成员函数editCompleted()无法定位。在文档中也鲜有提及。这个成员函数究竟是怎么回事呢?
以上是例子程序mymodel.h


#ifndef MYMODEL_H
#define MYMODEL_H

//! [Quoting ModelView Tutorial]
// mymodel.h
#include <QAbstractTableModel>
#include <QString>

const int COLS= 3;
const int ROWS= 2;


class MyModel : public QAbstractTableModel
{
Q_OBJECT
public:
MyModel(QObject *parent);
int rowCount(const QModelIndex &parent = QModelIndex()) const ;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
bool setData(const QModelIndex & index, const QVariant & value, int role = Qt::EditRole);
Qt::ItemFlags flags(const QModelIndex & index) const ;
private:
QString m_gridData[ROWS][COLS]; //holds text entered into QTableView
signals:
void editCompleted(const QString &);
};
//! [Quoting ModelView Tutorial]

#endif // MYMODEL_H


经查,例子程序中的源文件mymodel.cpp没有对editCompleted()函数的实现。而且使用Ctrl+左键 无法对此函数进行定位。即无法查看它的实现。
[最优解释]
信号不需要实现
[其他解释]
如果是Qt Creator的问题的话,下面是版本信息:
Qt Creator 2.4.1
基于 Qt 4.7.4 (32 bit)

构建于 11:24:30 Jan 25 2012

来自版本 8cd370e163
[其他解释]
引用:
信号不需要实现

那么是Qt帮助自动实现吗?
[其他解释]
引用:
信号不需要实现

但是信号作为普通的成员函数是要实现的吧?

读书人网 >QT开发

热点推荐