Skip to content

Commit 6114835

Browse files
committed
Add dimension changed event to coloring point dataset
1 parent f40c035 commit 6114835

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/ColoringAction.cpp

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,24 @@ ColoringAction::ColoringAction(QObject* parent, const QString& title) :
7171
_constantColorAction.setEnabled(currentIndex == 0);
7272

7373
const auto currentColorDataset = getCurrentColorDataset();
74-
74+
disconnect(&_currentColorPointsDataset, &Dataset<Points>::dataDimensionsChanged, this, nullptr);
75+
_currentColorPointsDataset = Dataset<Points>();
7576
if (currentColorDataset.isValid()) {
7677
const auto currentColorDatasetTypeIsPointType = currentColorDataset->getDataType() == PointType;
7778

78-
_dimensionAction.setPointsDataset(currentColorDatasetTypeIsPointType ? Dataset<Points>(currentColorDataset) : Dataset<Points>());
79+
if (currentColorDatasetTypeIsPointType) {
80+
_currentColorPointsDataset = currentColorDataset.get<Points>();
81+
connect(&_currentColorPointsDataset, &Dataset<Points>::dataDimensionsChanged, this, [this]() {
82+
_dimensionAction.setPointsDataset(_currentColorPointsDataset);
83+
updateScatterPlotWidgetColors();
84+
});
85+
_dimensionAction.setPointsDataset(_currentColorPointsDataset);
86+
87+
88+
}
89+
else {
90+
_dimensionAction.setPointsDataset(Dataset<Points>());
91+
}
7992
//_dimensionAction.setVisible(currentColorDatasetTypeIsPointType);
8093

8194
emit currentColorDatasetChanged(currentColorDataset);

src/ColoringAction.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ class ColoringAction : public VerticalGroupAction
134134
DimensionPickerAction _dimensionAction; /** Dimension picker action */
135135
ColorMap1DAction _colorMap1DAction; /** One-dimensional color map action */
136136
ColorMap2DAction _colorMap2DAction; /** Two-dimensional color map action */
137+
Dataset<Points> _currentColorPointsDataset; /** Current color dataset */
137138

138139
/** Default constant color */
139140
static const QColor DEFAULT_CONSTANT_COLOR;

0 commit comments

Comments
 (0)