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

LP-567 add new highlightTopTreeItems property

false by default and not accessible through the UI...
This commit is contained in:
Philippe Renon 2018-03-26 22:27:49 +02:00
parent 7996675708
commit 64dfc358f8
2 changed files with 18 additions and 1 deletions

View File

@ -141,6 +141,16 @@ void UAVObjectTreeModel::setOnlyHighlightChangedValues(bool highlight)
m_settings.setValue("onlyHighlightChangedValues", highlight); m_settings.setValue("onlyHighlightChangedValues", highlight);
} }
bool UAVObjectTreeModel::highlightTopTreeItems() const
{
return m_settings.value("highlightTopTreeItems", false).toBool();
}
void UAVObjectTreeModel::setHighlightTopTreeItems(bool highlight)
{
m_settings.setValue("highlightTopTreeItems", highlight);
}
void UAVObjectTreeModel::setupModelData() void UAVObjectTreeModel::setupModelData()
{ {
QList<QVariant> rootData; QList<QVariant> rootData;
@ -571,7 +581,11 @@ QVariant UAVObjectTreeModel::data(const QModelIndex &index, int role) const
case Qt::BackgroundRole: case Qt::BackgroundRole:
if (index.column() == TreeItem::TITLE_COLUMN) { if (index.column() == TreeItem::TITLE_COLUMN) {
if (!dynamic_cast<TopTreeItem *>(item) && item->isHighlighted()) { // TODO filtering here on highlightTopTreeItems() should not be necessary
// top tree items should not be highlighted at all in the first place
// when highlightTopTreeItems() is false
bool highlight = (highlightTopTreeItems() || !dynamic_cast<TopTreeItem *>(item));
if (highlight && item->isHighlighted()) {
return recentlyUpdatedColor(); return recentlyUpdatedColor();
} }
} else if (index.column() == TreeItem::DATA_COLUMN) { } else if (index.column() == TreeItem::DATA_COLUMN) {

View File

@ -88,6 +88,9 @@ public:
bool onlyHighlightChangedValues() const; bool onlyHighlightChangedValues() const;
void setOnlyHighlightChangedValues(bool highlight); void setOnlyHighlightChangedValues(bool highlight);
bool highlightTopTreeItems() const;
void setHighlightTopTreeItems(bool highlight);
private slots: private slots:
void newObject(UAVObject *obj); void newObject(UAVObject *obj);
void updateObject(UAVObject *obj); void updateObject(UAVObject *obj);