Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[solved] problem with QStringList in a Model class?



  • I am trying to build a table model, but when compiled, the error genereated "field stepTable has incomplete type", what does that mean?

    another question is that what's the best data struct to hold a two demisional string matrix. thanks

    @class steptablemodel : public QAbstractTableModel
    {
    Q_OBJECT
    public:
    explicit steptablemodel(QObject *parent = 0);
    steptablemodel(QStringList tablelist, QObject *parent = 0);
    int rowCount(const QModelIndex &parent) const;
    int columnCount(const QModelIndex &parent) const;
    QVariant data(const QModelIndex &index, int role) const;

    signals:

    public slots:

    private:
    QStringList stepTable;
    }; @


  • Lifetime Qt Champion

    Hi,

    Did you @include <QStringList>@

    in your header ?

    On a related note Qt offers a "QStringListModel":http://qt-project.org/doc/qt-4.8/qstringlistmodel.html

    Hope it helps



  • thanks. I want a two demension table view. so QStringListModel does not fit that.


Log in to reply