-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathhelpmodel.h
51 lines (46 loc) · 1.74 KB
/
helpmodel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// ******************************************************
// * copyright (C) 2017 by Reinhardt Behm/rbehm@hushmail.com
// * All Rights reserved
// * created 10/19/2017 by behm
// ******************************************************
#ifndef HELPMODEL_H
#define HELPMODEL_H
///
/// \brief The HelpItem struct
/// holds the info extracted from the help files for each word.
struct HelpItem
{
QString file; ///< where it was found
QString word; ///< the FORTH word
QString parms; ///< the parameters as found in the help file in FORTH standard notation ( stack-in -- stack out )
QString description; ///< the description found in the help file
QString header; ///< the description found in the help file
};
class HelpModel : public QAbstractTableModel
{
Q_OBJECT
public:
enum Cols { File, Word, Params, Description, NCols };
Q_ENUM(Cols)
explicit HelpModel(QObject *parent = 0);
~HelpModel();
void load(); ///< laod the help info from all files
const HelpItem item(const QModelIndex &idx);
// the standard model interface
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const;
virtual int rowCount(const QModelIndex &) const { return m_data.count(); }
virtual int columnCount(const QModelIndex &) const { return NCols; }
virtual bool hasChildren(const QModelIndex &) const { return false; }
virtual QVariant data(const QModelIndex &index, int role) const;
virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const;
virtual Qt::ItemFlags flags(const QModelIndex &) const;
void clear(); ///< clear the model
signals:
public slots:
private slots:
protected:
private:
QVector<HelpItem> m_data; ///< the model data
const QStringList m_header; ///< the strings for the header
};
#endif // HELPMODEL_H