Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/ScalarAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ void ScalarAction::addDataset(const Dataset<DatasetImpl>& dataset)

sourceModel.addDataset(dataset);

/* TODO: this connection is not removed when the dataset is removed from the model, but that should not cause any issues since the dataset will be invalid and the connection will not do anything in that case
connect(&sourceModel.getDatasets().last(), &Dataset<DatasetImpl>::dataChanged, this, [this, dataset]() {
const auto currentDataset = getCurrentDataset();

Expand All @@ -55,6 +56,8 @@ void ScalarAction::addDataset(const Dataset<DatasetImpl>& dataset)
emit sourceDataChanged(dataset);
});

*/

connect(&_magnitudeAction, &DecimalAction::valueChanged, this, [this, dataset](const float& value) {
emit magnitudeChanged(value);
});
Expand All @@ -72,20 +75,20 @@ Dataset<DatasetImpl> ScalarAction::getCurrentDataset()
const auto currentSourceIndex = _sourceAction.getPickerAction().getCurrentIndex();

if (currentSourceIndex < ScalarSourceModel::DefaultRow::DatasetStart)
return Dataset<DatasetImpl>();
return {};

return scalarSourceModel.getDataset(currentSourceIndex);
}

void ScalarAction::setCurrentDataset(const Dataset<DatasetImpl>& dataset)
{
const auto datasetRowIndex = _sourceAction.getModel().rowIndex(dataset);
const auto datasetRowIndex = _sourceAction.getModel().getRowIndex(dataset);

if (datasetRowIndex >= 0)
_sourceAction.getPickerAction().setCurrentIndex(datasetRowIndex);
}

void ScalarAction::setCurrentSourceIndex(bool sourceIndex)
void ScalarAction::setCurrentSourceIndex(std::int32_t sourceIndex)
{
_sourceAction.getPickerAction().setCurrentIndex(sourceIndex);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ScalarAction.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class ScalarAction : public GroupAction
* Set the current source index
* @param sourceIndex Source index
*/
void setCurrentSourceIndex(bool sourceIndex);
void setCurrentSourceIndex(std::int32_t sourceIndex);

/** Determines whether the scalar source is a constant */
bool isSourceConstant() const;
Expand Down
Loading
Loading