diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/treeitem.h b/ground/openpilotgcs/src/plugins/uavobjectbrowser/treeitem.h index 9f693684b..e1c6712ec 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectbrowser/treeitem.h +++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/treeitem.h @@ -231,8 +231,8 @@ public: QList getMetaObjectItems(); private: - QMap m_objectTreeItemsPerObjectIds; - QMap m_metaObjectTreeItemsPerObjectIds; + QHash m_objectTreeItemsPerObjectIds; + QHash m_metaObjectTreeItemsPerObjectIds; }; class ObjectTreeItem : public TreeItem { diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserwidget.cpp b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserwidget.cpp index bcca753e3..ecc9343bf 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserwidget.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjectbrowserwidget.cpp @@ -122,7 +122,7 @@ void UAVObjectBrowserWidget::useScientificNotation(bool scientific) Q_ASSERT(objManager); UAVObjectTreeModel *tmpModel = m_model; - m_model = new UAVObjectTreeModel(0, m_viewoptions->cbCategorized, scientific); + m_model = new UAVObjectTreeModel(0, m_viewoptions->cbCategorized->isChecked(), scientific); m_model->setRecentlyUpdatedColor(m_recentlyUpdatedColor); m_model->setManuallyChangedColor(m_manuallyChangedColor); m_model->setRecentlyUpdatedTimeout(m_recentlyUpdatedTimeout); diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp index 23e4849ac..1845f2c35 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp +++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp @@ -33,7 +33,6 @@ #include "uavobjectfield.h" #include "extensionsystem/pluginmanager.h" #include -// #include #include #include #include @@ -41,6 +40,7 @@ UAVObjectTreeModel::UAVObjectTreeModel(QObject *parent, bool categorize, bool useScientificNotation) : QAbstractItemModel(parent), m_useScientificFloatNotation(useScientificNotation), + m_categorize(categorize), m_recentlyUpdatedTimeout(500), // ms m_recentlyUpdatedColor(QColor(255, 230, 230)), m_manuallyChangedColor(QColor(230, 230, 255)) @@ -54,7 +54,7 @@ UAVObjectTreeModel::UAVObjectTreeModel(QObject *parent, bool categorize, bool us connect(objManager, SIGNAL(newInstance(UAVObject *)), this, SLOT(newObject(UAVObject *))); TreeItem::setHighlightTime(m_recentlyUpdatedTimeout); - setupModelData(objManager, categorize); + setupModelData(objManager); } UAVObjectTreeModel::~UAVObjectTreeModel() @@ -63,7 +63,7 @@ UAVObjectTreeModel::~UAVObjectTreeModel() delete m_rootItem; } -void UAVObjectTreeModel::setupModelData(UAVObjectManager *objManager, bool categorize) +void UAVObjectTreeModel::setupModelData(UAVObjectManager *objManager) { // root QList rootData; @@ -83,7 +83,7 @@ void UAVObjectTreeModel::setupModelData(UAVObjectManager *objManager, bool categ QList< QList > objList = objManager->getDataObjects(); foreach(QList list, objList) { foreach(UAVDataObject * obj, list) { - addDataObject(obj, categorize); + addDataObject(obj); } } } @@ -97,13 +97,13 @@ void UAVObjectTreeModel::newObject(UAVObject *obj) } } -void UAVObjectTreeModel::addDataObject(UAVDataObject *obj, bool categorize) +void UAVObjectTreeModel::addDataObject(UAVDataObject *obj) { TopTreeItem *root = obj->isSettings() ? m_settingsTree : m_nonSettingsTree; TreeItem *parent = root; - if (categorize && obj->getCategory() != 0 && !obj->getCategory().isEmpty()) { + if (m_categorize && obj->getCategory() != 0 && !obj->getCategory().isEmpty()) { QStringList categoryPath = obj->getCategory().split('/'); parent = createCategoryItems(categoryPath, root); } diff --git a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.h b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.h index 86e5c90c8..775785c69 100644 --- a/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.h +++ b/ground/openpilotgcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.h @@ -92,9 +92,9 @@ private slots: void updateHighlight(TreeItem *); private: - void setupModelData(UAVObjectManager *objManager, bool categorize = true); + void setupModelData(UAVObjectManager *objManager); QModelIndex index(TreeItem *item); - void addDataObject(UAVDataObject *obj, bool categorize = true); + void addDataObject(UAVDataObject *obj); MetaObjectTreeItem *addMetaObject(UAVMetaObject *obj, TreeItem *parent); void addArrayField(UAVObjectField *field, TreeItem *parent); void addSingleField(int index, UAVObjectField *field, TreeItem *parent); @@ -115,6 +115,7 @@ private: QColor m_manuallyChangedColor; bool m_onlyHilightChangedValues; bool m_useScientificFloatNotation; + bool m_categorize; // Highlight manager to handle highlighting of tree items. HighLightManager *m_highlightManager;