@@ -28,6 +28,10 @@ DatasetsAction::DatasetsAction(QObject* parent, const QString& title) :
2828 addAction (&_pointSizeDatasetPickerAction);
2929 addAction (&_pointOpacityDatasetPickerAction);
3030
31+ _colorDatasetPickerAction.setDefaultWidgetFlag (OptionAction::Clearable);
32+ _pointSizeDatasetPickerAction.setDefaultWidgetFlag (OptionAction::Clearable);
33+ _pointOpacityDatasetPickerAction.setDefaultWidgetFlag (OptionAction::Clearable);
34+
3135 _positionDatasetPickerAction.setFilterFunction ([this ](mv::Dataset<DatasetImpl> dataset) -> bool {
3236 return dataset->getDataType () == PointType;
3337 });
@@ -56,9 +60,12 @@ DatasetsAction::DatasetsAction(QObject* parent, const QString& title) :
5660 connect (&scatterplotPlugin->getPositionDataset (), &Dataset<Points>::changed, this , [this ](DatasetImpl* dataset) -> void {
5761 _positionDatasetPickerAction.setCurrentDataset (dataset);
5862 });
59-
60- connect (&_colorDatasetPickerAction, &DatasetPickerAction::datasetPicked, [this , scatterplotPlugin](Dataset<DatasetImpl> pickedDataset) -> void {
61- scatterplotPlugin->getSettingsAction ().getColoringAction ().setCurrentColorDataset (pickedDataset);
63+
64+ auto & coloringAction = scatterplotPlugin->getSettingsAction ().getColoringAction ();
65+
66+ connect (&_colorDatasetPickerAction, &DatasetPickerAction::datasetPicked, [this , &coloringAction](Dataset<DatasetImpl> pickedDataset) -> void {
67+ coloringAction.getColorByAction ().setCurrentIndex (pickedDataset.isValid () ? 2 : 0 );
68+ coloringAction.setCurrentColorDataset (pickedDataset);
6269 });
6370
6471 connect (&scatterplotPlugin->getSettingsAction ().getColoringAction (), &ColoringAction::currentColorDatasetChanged, this , [this ](Dataset<DatasetImpl> currentColorDataset) -> void {
@@ -79,11 +86,11 @@ DatasetsAction::DatasetsAction(QObject* parent, const QString& title) :
7986 connect (&pointSizeAction, &ScalarAction::sourceSelectionChanged, this , pointSizeSourceChanged);
8087 connect (&pointSizeAction, &ScalarAction::sourceDataChanged, this , pointSizeSourceChanged);
8188
82- connect (&_pointSizeDatasetPickerAction, &DatasetPickerAction::datasetPicked, this , [this , &pointSizeAction](Dataset<DatasetImpl> dataset) -> void {
83- if (!dataset.isValid ())
84- return ;
89+ connect (&_pointSizeDatasetPickerAction, &DatasetPickerAction::currentIndexChanged, this , [this , &pointSizeAction](const int32_t & currentIndex) -> void {
90+ pointSizeAction.setCurrentDataset (_pointSizeDatasetPickerAction.getCurrentDataset ());
8591
86- pointSizeAction.setCurrentDataset (dataset);
92+ if (currentIndex < 0 )
93+ pointSizeAction.setCurrentSourceIndex (ScalarSourceModel::DefaultRow::Constant);
8794 });
8895
8996 const auto pointOpacitySourceChanged = [this , &pointOpacityAction]() -> void {
@@ -96,11 +103,11 @@ DatasetsAction::DatasetsAction(QObject* parent, const QString& title) :
96103 connect (&pointOpacityAction, &ScalarAction::sourceSelectionChanged, this , pointOpacitySourceChanged);
97104 connect (&pointOpacityAction, &ScalarAction::sourceDataChanged, this , pointOpacitySourceChanged);
98105
99- connect (&_pointOpacityDatasetPickerAction, &DatasetPickerAction::datasetPicked, this , [this , &pointOpacityAction](Dataset<DatasetImpl> dataset) -> void {
100- if (!dataset.isValid ())
101- return ;
106+ connect (&_pointOpacityDatasetPickerAction, &DatasetPickerAction::currentIndexChanged, this , [this , &pointOpacityAction](const int32_t & currentIndex) -> void {
107+ pointOpacityAction.setCurrentDataset (_pointOpacityDatasetPickerAction.getCurrentDataset ());
102108
103- pointOpacityAction.setCurrentDataset (dataset);
109+ if (currentIndex < 0 )
110+ pointOpacityAction.setCurrentSourceIndex (ScalarSourceModel::DefaultRow::Constant);
104111 });
105112}
106113
0 commit comments