Go to the documentation of this file.
49 QItemSelectionModel::SelectionFlags command)
51 QModelIndex property_index = index.sibling(index.row(), 1);
52 if (index.flags() & Qt::ItemIsEditable || !property_index.isValid())
54 QItemSelectionModel::setCurrentIndex(index,
command);
58 QItemSelectionModel::setCurrentIndex(property_index,
command);
63 : QTreeView(parent), model_(nullptr), splitter_handle_(new
SplitterHandle(this))
66 setDropIndicatorShown(
true);
67 setUniformRowHeights(
true);
68 setHeaderHidden(
true);
72 setAllColumnsShowFocus(
true);
73 setSelectionMode(QAbstractItemView::ExtendedSelection);
74 setEditTriggers(QAbstractItemView::AllEditTriggers);
76 QTimer* timer =
new QTimer(
this);
77 connect(timer, &QTimer::timeout,
this, [
this] {
update(); });
82 const QModelIndex& previous_current_index)
84 QTreeView::currentChanged(new_current_index, previous_current_index);
89 const QItemSelection& deselected)
91 QTreeView::selectionChanged(selected, deselected);
105 QTreeView::setModel(
model_);
108 QItemSelectionModel* m = selectionModel();
127 if (parent_index.isValid())
131 <<
"' that is not part of the model.");
143 const QModelIndex& parent_index,
144 const QString& prefix)
const
147 if (num_children > 0)
149 QHash<QString, int> name_counts;
150 for (
int i = 0; i < num_children; i++)
152 QModelIndex child_index =
model_->
index(i, 0, parent_index);
154 QString child_name = child->
getName();
155 if (qobject_cast<StatusList*>(child))
159 child_name =
"Status";
161 int name_occurrence = ++(name_counts[child_name]);
162 QString full_name = prefix +
"/" + child_name + QString::number(name_occurrence);
163 if (isExpanded(child_index))
165 config.listAppendNew().setValue(full_name);
174 Config expanded_list_config =
config.mapGetChild(
"Expanded");
175 QSet<QString> expanded_full_names;
176 int num_expanded = expanded_list_config.
listLength();
177 for (
int i = 0; i < num_expanded; i++)
184 if (
config.mapGetFloat(
"Splitter Ratio", &ratio))
191 const QModelIndex& parent_index,
192 const QString& prefix)
195 if (num_children > 0)
197 QHash<QString, int> name_counts;
198 for (
int i = 0; i < num_children; i++)
200 QModelIndex child_index =
model_->
index(i, 0, parent_index);
202 QString child_name = child->
getName();
203 if (qobject_cast<StatusList*>(child))
205 child_name =
"Status";
207 int name_occurrence = ++(name_counts[child_name]);
208 QString full_name = prefix +
"/" + child_name + QString::number(name_occurrence);
209 if (expanded_full_names.contains(full_name))
211 setExpanded(child_index,
true);
void setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command) override
void expand(const QModelIndex &index)
Emitted when a Property wants to expand (display its children).
void collapse(const QModelIndex &index)
Emitted when a Property wants to collapse (hide its children).
void setRatio(float ratio)
Set the ratio of the parent's left column to the parent widget width.
ROSLIB_DECL std::string command(const std::string &cmd)
Property * getProp(const QModelIndex &index) const
return the Property at the given index, or the root property if the index is invalid.
int listLength() const
Returns the length of the List in this Node, or 0 if this Node does not have type List.
QModelIndex parentIndex(const Property *child) const
Same as parent() but taking a Property pointer instead of an index.
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Return the number of rows under the given parent index.
void propertyHiddenChanged(const Property *property)
Emitted when a property within the model is hidden or shown.
A single element of a property tree, with a name, value, description, and possibly children.
#define ROS_WARN_STREAM(args)
void update(const std::string &key, const XmlRpc::XmlRpcValue &v)
A tall skinny invisible widget providing left-right sliding column separator adjustment for a two-col...
float getRatio()
Get the ratio of the parent's left column to the parent widget width.
virtual bool getHidden() const
Return the hidden/shown state. True means hidden, false means visible.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Property * getRoot() const
int rowNumberInParent() const
Return the row number of this property within its parent, or -1 if it has no parent.
virtual QString getName() const
Return the name of this Property as a QString.
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...
PropertyTreeModel * getModel() const
Return the model managing this Property and its childrent.
Configuration data storage class.
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...
PropertySelectionModel(QAbstractItemModel *model=nullptr)
rviz
Author(s): Dave Hershberger, David Gossow, Josh Faust, William Woodall
autogenerated on Fri Dec 13 2024 03:31:02