1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-11-29 07:24:13 +01:00

LP-567 added comments and const correctness

This commit is contained in:
Philippe Renon 2018-03-26 22:28:43 +02:00
parent 64dfc358f8
commit 96cf07e77d
2 changed files with 6 additions and 2 deletions

View File

@ -238,6 +238,8 @@ DataObjectTreeItem *UAVObjectTreeModel::createDataObject(UAVDataObject *obj)
addObjectTreeItem(obj->getObjID(), item); addObjectTreeItem(obj->getObjID(), item);
item->setHighlightManager(m_highlightManager); item->setHighlightManager(m_highlightManager);
// metadata items are created up front and are added/removed as needed
// see toggleMetaItems()
MetaObjectTreeItem *metaItem = createMetaObject(obj->getMetaObject()); MetaObjectTreeItem *metaItem = createMetaObject(obj->getMetaObject());
if (showMetadata()) { if (showMetadata()) {
appendItem(item, metaItem); appendItem(item, metaItem);
@ -303,6 +305,8 @@ TreeItem *UAVObjectTreeModel::getParentItem(UAVDataObject *obj, bool categorize)
QStringList categoryPath = category.split('/'); QStringList categoryPath = category.split('/');
foreach(QString category, categoryPath) { foreach(QString category, categoryPath) {
// metadata items are created and destroyed as needed
// see toggleCategoryItems()
TreeItem *categoryItem = parentItem->childByName(category); TreeItem *categoryItem = parentItem->childByName(category);
if (!categoryItem) { if (!categoryItem) {
@ -486,7 +490,7 @@ QModelIndex UAVObjectTreeModel::index(int row, int column, const QModelIndex &pa
return QModelIndex(); return QModelIndex();
} }
QModelIndex UAVObjectTreeModel::index(TreeItem *item, int column) QModelIndex UAVObjectTreeModel::index(TreeItem *item, int column) const
{ {
if (item == m_rootItem) { if (item == m_rootItem) {
return QModelIndex(); return QModelIndex();

View File

@ -109,7 +109,7 @@ private:
QHash<quint32, ObjectTreeItem *> m_objectTreeItems; QHash<quint32, ObjectTreeItem *> m_objectTreeItems;
QModelIndex index(TreeItem *item, int column = 0); QModelIndex index(TreeItem *item, int column = 0) const;
void setupModelData(); void setupModelData();
void resetModelData(); void resetModelData();