##// END OF EJS Templates
Some WIP refactoring, trying to remove TimeController object...
Some WIP refactoring, trying to remove TimeController object SciQLOP core should be usable OOTB without creating controllers objects. Time range should be given on variable creation not taken from a global object. Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>

File last commit:

r1321:8614c945da0f
r1345:ce477e992869
Show More
VisualizationSelectionZoneManager.cpp
54 lines | 1.6 KiB | text/x-c | CppLexer
/ gui / src / Visualization / VisualizationSelectionZoneManager.cpp
#include "Visualization/VisualizationSelectionZoneManager.h"
#include "Visualization/VisualizationSelectionZoneItem.h"
struct VisualizationSelectionZoneManager::VisualizationSelectionZoneManagerPrivate {
QVector<VisualizationSelectionZoneItem *> m_SelectedItems;
};
VisualizationSelectionZoneManager::VisualizationSelectionZoneManager()
: impl{spimpl::make_unique_impl<VisualizationSelectionZoneManagerPrivate>()}
{
}
void VisualizationSelectionZoneManager::select(
const QVector<VisualizationSelectionZoneItem *> &items)
{
clearSelection();
for (auto item : items) {
setSelected(item, true);
}
}
void VisualizationSelectionZoneManager::setSelected(VisualizationSelectionZoneItem *item,
bool value)
{
if (value != item->selected()) {
item->setSelected(value);
item->parentPlot()->replot(QCustomPlot::rpQueuedReplot);
}
if (!value && impl->m_SelectedItems.contains(item)) {
impl->m_SelectedItems.removeAll(item);
}
else if (value) {
impl->m_SelectedItems << item;
}
}
void VisualizationSelectionZoneManager::clearSelection()
{
for (auto item : impl->m_SelectedItems) {
item->setSelected(false);
auto parentPlot = item->parentPlot();
if (parentPlot) {
parentPlot->replot(QCustomPlot::rpQueuedReplot);
}
}
impl->m_SelectedItems.clear();
}
QVector<VisualizationSelectionZoneItem *> VisualizationSelectionZoneManager::selectedItems() const
{
return impl->m_SelectedItems;
}