22 #ifndef ExprCompletionModel_h
23 #define ExprCompletionModel_h
25 #include <QtCore/QAbstractItemModel>
26 #include <QtCore/QString>
27 #include <QtCore/QSize>
35 void addFunction(
const QString&
function,
const QString& docString);
39 void addVariable(
const QString& str,
const QString& comment);
46 QModelIndex
index(
int row,
int column,
const QModelIndex&)
const
47 {
return createIndex(row,column,0);}
49 QModelIndex
parent(
const QModelIndex&)
const
50 {
return QModelIndex();}
60 {Q_UNUSED(parent);
return 2;}
64 size_t newline=all.find(
"\n");
65 if(newline!=std::string::npos)
return QString(all.substr(0,newline).c_str());
66 else return QString(all.c_str());
69 QVariant
data(
const QModelIndex&
index,
int role=Qt::DisplayRole)
const;
71 QVariant
headerData (
int section, Qt::Orientation orientation,
int role = Qt::DisplayRole )
const
73 Q_UNUSED(orientation);
74 if(role==Qt::DisplayRole)
return QVariant(
"");
75 else if(role==Qt::SizeHintRole){
76 if(section==0)
return QVariant(QSize(100,1));
77 else return QVariant(QSize(200,1));
78 }
else return QVariant();
std::vector< QString > variables
void addVariable(const QString &str, const QString &comment)
std::vector< QString > local_variables
void addFunction(const QString &function, const QString &docString)
QModelIndex parent(const QModelIndex &) const
int rowCount(const QModelIndex &parent=QModelIndex()) const
std::map< QString, int > functionNameToFunction
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
ExprCompletionModel(QObject *parent=0)
int columnCount(const QModelIndex &parent) const
QModelIndex index(int row, int column, const QModelIndex &) const
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
std::vector< QString > functions_comment
std::vector< QString > functions
std::vector< QString > variables_comment
QString getFirstLine(const std::string &all) const
void syncExtras(const ExprCompletionModel &otherModel)
static std::vector< QString > builtins
QString getDocString(const QString &s)