Skip to content

Commit 64dfc35

Browse files
committed
LP-567 add new highlightTopTreeItems property
false by default and not accessible through the UI...
1 parent 7996675 commit 64dfc35

2 files changed

Lines changed: 18 additions & 1 deletion

File tree

ground/gcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,16 @@ void UAVObjectTreeModel::setOnlyHighlightChangedValues(bool highlight)
141141
m_settings.setValue("onlyHighlightChangedValues", highlight);
142142
}
143143

144+
bool UAVObjectTreeModel::highlightTopTreeItems() const
145+
{
146+
return m_settings.value("highlightTopTreeItems", false).toBool();
147+
}
148+
149+
void UAVObjectTreeModel::setHighlightTopTreeItems(bool highlight)
150+
{
151+
m_settings.setValue("highlightTopTreeItems", highlight);
152+
}
153+
144154
void UAVObjectTreeModel::setupModelData()
145155
{
146156
QList<QVariant> rootData;
@@ -571,7 +581,11 @@ QVariant UAVObjectTreeModel::data(const QModelIndex &index, int role) const
571581

572582
case Qt::BackgroundRole:
573583
if (index.column() == TreeItem::TITLE_COLUMN) {
574-
if (!dynamic_cast<TopTreeItem *>(item) && item->isHighlighted()) {
584+
// TODO filtering here on highlightTopTreeItems() should not be necessary
585+
// top tree items should not be highlighted at all in the first place
586+
// when highlightTopTreeItems() is false
587+
bool highlight = (highlightTopTreeItems() || !dynamic_cast<TopTreeItem *>(item));
588+
if (highlight && item->isHighlighted()) {
575589
return recentlyUpdatedColor();
576590
}
577591
} else if (index.column() == TreeItem::DATA_COLUMN) {

ground/gcs/src/plugins/uavobjectbrowser/uavobjecttreemodel.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ class UAVObjectTreeModel : public QAbstractItemModel {
8888
bool onlyHighlightChangedValues() const;
8989
void setOnlyHighlightChangedValues(bool highlight);
9090

91+
bool highlightTopTreeItems() const;
92+
void setHighlightTopTreeItems(bool highlight);
93+
9194
private slots:
9295
void newObject(UAVObject *obj);
9396
void updateObject(UAVObject *obj);

0 commit comments

Comments
 (0)