##// END OF EJS Templates
Handles rendering of plottables (1)...
Handles rendering of plottables (1) As for the axes properties, we create a helper used to set rendering properties of the plottables depending on the type of the data series used to create these plottables. Rendering properties will be, for example: - the color of each component for a scalar or a vector - the color scale management for a spectrogram

File last commit:

r476:becb718e8802
r918:8264fa4b2aa2
Show More
DataSourceTreeWidgetHelper.cpp
36 lines | 1.0 KiB | text/x-c | CppLexer
/ gui / src / DataSource / DataSourceTreeWidgetHelper.cpp
#include "DataSource/DataSourceTreeWidgetHelper.h"
#include "DataSource/DataSourceTreeWidgetItem.h"
namespace {
bool filterTreeItem(DataSourceTreeWidgetItem &treeItem,
DataSourceTreeWidgetHelper::FilterFunction fun, bool parentValid = false)
{
auto selfValid = parentValid || fun(treeItem);
auto childValid = false;
auto childCount = treeItem.childCount();
for (auto i = 0; i < childCount; ++i) {
if (auto childItem = dynamic_cast<DataSourceTreeWidgetItem *>(treeItem.child(i))) {
childValid |= filterTreeItem(*childItem, fun, selfValid);
}
}
auto valid = selfValid || childValid;
treeItem.setHidden(!valid);
return valid;
}
} // namespace
void DataSourceTreeWidgetHelper::filter(QTreeWidget &treeWidget, FilterFunction fun) noexcept
{
auto itemCount = treeWidget.topLevelItemCount();
for (auto i = 0; i < itemCount; ++i) {
if (auto item = dynamic_cast<DataSourceTreeWidgetItem *>(treeWidget.topLevelItem(i))) {
filterTreeItem(*item, fun);
}
}
}