这是我的课:
// file .h
#ifndef UNDOREDO_H
#define UNDOREDO_H
#include <QUndoCommand>
typedef QVector<QStringList> vector_t ;
class UndoRedo : public QUndoCommand
{
public:
UndoRedo(QList<vector_t> v,
QUndoCommand *parent = 0);
void undo();
private:
QList<vector_t> *cb_values;
};
#endif // UNDOREDO_H
// file .cpp
#include "undoredo.h"
UndoRedo::UndoRedo(QList<vector_t> v,
QUndoCommand *parent)
: QUndoCommand(parent)
{
cb_values = &v;
}
void UndoRedo::undo() {
QString last = cb_values[0][0].takeLast();
qDebug() << last << "removed!";
}
当我调用 undo() 方法时,IDE 会引发此错误:
错误:请求从“QStringList”转换为非标量类型“QString”
我在哪里做错了?