28 #include <QTreeWidget>
54 if (colors.isEmpty ())
56 colors << QColor (190,255,255)
57 << QColor (220,255,220)
58 << QColor (220,220,255)
59 << QColor (255,255,190)
60 << QColor (255,220,220)
61 << QColor (255,190,255);
75 names << QObject::tr (
"automatic")
76 << QObject::tr (
"function")
77 << QObject::tr (
"global")
78 << QObject::tr (
"hidden")
79 << QObject::tr (
"inherited")
80 << QObject::tr (
"persistent");
101 Qt::ItemFlags retval = 0;
105 retval |= Qt::ItemIsEnabled;
108 retval |= Qt::ItemIsSelectable;
118 if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
131 if (role == Qt::BackgroundColorRole)
135 = class_chars.indexOf (
_scopes[idx.row ()].toAscii ());
136 if (actual_class >= 0)
142 if (role == Qt::DisplayRole
143 || (idx.column () == 0 && role == Qt::EditRole)
144 || (idx.column () == 0 && role == Qt::ToolTipRole))
146 switch (idx.column ())
149 if (role == Qt::ToolTipRole)
151 = QVariant (tr (
"Right click to copy, rename, or display"));
153 retval = QVariant (
_symbols[idx.row ()]);
165 retval = QVariant (
_values[idx.row ()]);
175 = class_chars.indexOf (
_scopes[idx.row ()].toAscii ());
177 if (actual_class >= 0)
179 QStringList class_names
182 sclass = class_names.at (actual_class);
187 if (sclass.isEmpty ())
188 sclass = tr (
"complex");
190 sclass +=
", " + tr (
"complex");
193 retval = QVariant (sclass);
209 if (idx.column () == 0 && role == Qt::EditRole)
211 QString qold_name =
_symbols[idx.row ()];
213 QString qnew_name = value.toString ();
215 std::string new_name = qnew_name.toStdString ();
232 const QString& scopes,
233 const QStringList& symbols,
234 const QStringList& class_names,
235 const QStringList& dimensions,
236 const QStringList& values,
288 for (
int i = 0; i < class_chars.length (); i++)
290 QVariant default_var = default_colors.at (i);
291 QColor setting_color = settings->value (
"workspaceview/color_"
292 + class_chars.mid (i,1),
293 default_var).value<QColor> ();
static QStringList storage_class_names(void)
QList< QColor > _storage_class_colors
void rename_variable(const QString &old_name, const QString &new_name)
Qt::ItemFlags flags(const QModelIndex &index) const
int rowCount(const QModelIndex &parent=QModelIndex()) const
static string_vector names(const map_type &lst)
static QList< QColor > storage_class_default_colors(void)
static QList< QColor > storage_class_default_colors(void)
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole)
bool valid_identifier(const char *s)
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
void notice_settings(const QSettings *)
void set_workspace(bool top_level, bool debug, const QString &scopes, const QStringList &symbols, const QStringList &class_names, const QStringList &dimensions, const QStringList &values, const QIntList &complex_flags)
workspace_model(QObject *parent=0)
QVariant data(const QModelIndex &index, int role) const
static QString storage_class_chars(void)
static QStringList storage_class_names(void)
int columnCount(const QModelIndex &parent=QModelIndex()) const
void clear_workspace(void)