21 #include <QtGui/QLineEdit>
23 #include <SeExpr2/ExprFunc.h>
29 :QAbstractItemModel(parent)
32 std::vector<std::string> builtins_std;
34 for(
unsigned int i=0;i<builtins_std.size();i++)
builtins.push_back(QString(builtins_std[i].c_str()));
71 static QColor variableColor=QColor(100,200,250),functionColor=QColor(100,250,200),
72 backgroundColor(50,50,50);
74 if(!index.isValid())
return QVariant();
75 int row=index.row(),column=index.column();
77 int functions_offset=
builtins.size();
78 int variables_offset=functions_offset+
functions.size();
79 int local_variables_offset=variables_offset+
variables.size();
81 if(role==Qt::BackgroundRole)
return backgroundColor;
83 if(role==Qt::FontRole && column==0){
89 if(row<functions_offset){
91 if(role==Qt::DisplayRole || role==Qt::EditRole){
92 if(column==0)
return QVariant(
builtins[index]);
94 }
else if(role==Qt::ForegroundRole)
96 }
else if(row<variables_offset){
97 int index=row-functions_offset;
98 if(role==Qt::DisplayRole || role==Qt::EditRole){
99 if(column==0)
return QVariant(
functions[index]);
101 }
else if(role==Qt::ForegroundRole)
102 return functionColor;
103 }
else if(row<local_variables_offset){
104 int index=row-variables_offset;
105 if(role==Qt::DisplayRole || role==Qt::EditRole){
106 if(column==0)
return QVariant(
variables[index]);
108 }
else if(role==Qt::ForegroundRole)
109 return variableColor;
111 int index=row-local_variables_offset;
112 if(role==Qt::DisplayRole || role==Qt::EditRole){
114 else if(column==1)
return QVariant(
"Local");
115 }
else if(role==Qt::ForegroundRole)
116 return variableColor;
static std::string getDocString(const char *functionName)
Get doc string for a specific function.
std::vector< QString > variables
void addVariable(const QString &str, const QString &comment)
static void getFunctionNames(std::vector< std::string > &names)
Get a list of registered builtin and DSO generated functions.
std::vector< QString > local_variables
void addFunction(const QString &function, const QString &docString)
std::map< QString, int > functionNameToFunction
The result is computed int int< br >< divstyle="margin-left:40px;"> Picks values randomly between loRange and hiRange based on supplied index(which is automatically hashed). 
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
ExprCompletionModel(QObject *parent=0)
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)