1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-02 10:24:11 +01:00

OP-1169 Found the 'Control' item bug and fixed some minor things.

This commit is contained in:
Fredrik Arvidsson 2014-01-18 23:39:46 +01:00
parent 2575a37690
commit 3936173017
4 changed files with 12 additions and 11 deletions

View File

@ -231,8 +231,8 @@ public:
QList<MetaObjectTreeItem *> getMetaObjectItems();
private:
QMap<quint32, DataObjectTreeItem *> m_objectTreeItemsPerObjectIds;
QMap<quint32, MetaObjectTreeItem *> m_metaObjectTreeItemsPerObjectIds;
QHash<quint32, DataObjectTreeItem *> m_objectTreeItemsPerObjectIds;
QHash<quint32, MetaObjectTreeItem *> m_metaObjectTreeItemsPerObjectIds;
};
class ObjectTreeItem : public TreeItem {

View File

@ -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);

View File

@ -33,7 +33,6 @@
#include "uavobjectfield.h"
#include "extensionsystem/pluginmanager.h"
#include <QColor>
// #include <QIcon>
#include <QtCore/QTimer>
#include <QtCore/QSignalMapper>
#include <QtCore/QDebug>
@ -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<QVariant> rootData;
@ -83,7 +83,7 @@ void UAVObjectTreeModel::setupModelData(UAVObjectManager *objManager, bool categ
QList< QList<UAVDataObject *> > objList = objManager->getDataObjects();
foreach(QList<UAVDataObject *> 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);
}

View File

@ -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;