50 setDropIndicatorShown(
true );
51 setUniformRowHeights(
true );
52 setHeaderHidden(
true );
53 setDragEnabled(
true );
54 setAcceptDrops(
true );
56 setSelectionMode( QAbstractItemView::ExtendedSelection );
57 setEditTriggers( QAbstractItemView::AllEditTriggers );
58 setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
60 QTimer* timer =
new QTimer(
this );
61 connect( timer, SIGNAL( timeout() ),
this, SLOT(
update() ));
67 QTreeView::currentChanged( new_current_index, previous_current_index );
73 QTreeView::selectionChanged( selected, deselected );
83 disconnect(
model_, SIGNAL( expand(
const QModelIndex& )),
84 this, SLOT( expand(
const QModelIndex& )));
85 disconnect(
model_, SIGNAL( collapse(
const QModelIndex& )),
86 this, SLOT( collapse(
const QModelIndex& )));
89 QTreeView::setModel(
model_ );
94 connect(
model_, SIGNAL( expand(
const QModelIndex& )),
95 this, SLOT( expand(
const QModelIndex& )));
96 connect(
model_, SIGNAL( collapse(
const QModelIndex& )),
97 this, SLOT( collapse(
const QModelIndex& )));
123 if( num_children > 0 )
125 QHash<QString, int> name_counts;
126 for(
int i = 0; i < num_children; i++ )
128 QModelIndex child_index =
model_->
index( i, 0, parent_index );
130 QString child_name = child->
getName();
131 if( qobject_cast<StatusList*>( child ))
135 child_name =
"Status";
137 int name_occurrence = ++( name_counts[ child_name ]);
138 QString full_name = prefix +
"/" + child_name + QString::number( name_occurrence );
139 if( isExpanded( child_index ))
151 QSet<QString> expanded_full_names;
152 int num_expanded = expanded_list_config.
listLength();
153 for(
int i = 0; i < num_expanded; i++ )
160 if( config.
mapGetFloat(
"Splitter Ratio", &ratio ))
167 const QModelIndex& parent_index,
168 const QString& prefix )
171 if( num_children > 0 )
173 QHash<QString, int> name_counts;
174 for(
int i = 0; i < num_children; i++ )
176 QModelIndex child_index =
model_->
index( i, 0, parent_index );
178 QString child_name = child->
getName();
179 if( qobject_cast<StatusList*>( child ))
181 child_name =
"Status";
183 int name_occurrence = ++( name_counts[ child_name ]);
184 QString full_name = prefix +
"/" + child_name + QString::number( name_occurrence );
185 if( expanded_full_names.contains( full_name ))
187 setExpanded( child_index,
true );
189 expandEntries( expanded_full_names, child_index, full_name );
void setValue(const QVariant &value)
Ensures this is a valid Config object, sets the type to Value then sets the value.
float getRatio()
Get the ratio of the parent's left column to the parent widget width.
int rowNumberInParent() const
Return the row number of this property within its parent, or -1 if it has no parent.
virtual QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
int listLength() const
Returns the length of the List in this Node, or 0 if this Node does not have type List...
Config listChildAt(int i) const
Return the i'th child in the list, if the referenced Node has type List. Returns an Invalid Config if...
A single element of a property tree, with a name, value, description, and possibly children...
bool mapGetFloat(const QString &key, float *value_out) const
Convenience function for looking up a named float.
virtual int rowCount(const QModelIndex &parent=QModelIndex()) const
Return the number of rows under the given parent index.
A tall skinny invisible widget providing left-right sliding column separator adjustment for a two-col...
void mapSetValue(const QString &key, QVariant value)
Set a named child to the given value.
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)
Configuration data storage class.
QModelIndex parentIndex(const Property *child) const
Same as parent() but taking a Property pointer instead of an index.
void setModel(PropertyTreeModel *model)
Set the model managing this Property and all its child properties, recursively.
QVariant getValue() const
If this config object is valid and is a Value type, this returns its value. Otherwise it returns an i...
Config mapMakeChild(const QString &key)
Create a child node stored with the given key, and return the child.
PropertyTreeModel * getModel() const
Return the model managing this Property and its childrent.
Config listAppendNew()
Ensure the referenced Node is of type List, append a new Empty Node to the end of the list...
void setRatio(float ratio)
Set the ratio of the parent's left column to the parent widget width.
Property * getProp(const QModelIndex &index) const
return the Property at the given index, or the root property if the index is invalid.
Config mapGetChild(const QString &key) const
If the referenced Node is a Map and it has a child with the given key, return a reference to the chil...
Property * getRoot() const
virtual QString getName() const
Return the name of this Property as a QString.