Skip to content

Commit

Permalink
Makes use of TreeViewComboBox::plotColumnTopLevelClasses() also in Ba…
Browse files Browse the repository at this point in the history
…rPlotDock and in ErrorBarWidget.
  • Loading branch information
asemke committed Oct 5, 2024
1 parent a41362c commit 44135ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 32 deletions.
23 changes: 4 additions & 19 deletions src/frontend/dockwidgets/BarPlotDock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,24 +311,11 @@ void BarPlotDock::removeXColumn() {

void BarPlotDock::addDataColumn() {
auto* cb = new TreeViewComboBox(this);

static const QList<AspectType> list{AspectType::Folder,
AspectType::Workbook,
AspectType::Datapicker,
AspectType::DatapickerCurve,
AspectType::Spreadsheet,
AspectType::LiveDataSource,
AspectType::Column,
AspectType::Worksheet,
AspectType::CartesianPlot,
AspectType::XYFitCurve,
AspectType::XYSmoothCurve,
AspectType::Notebook};
cb->setTopLevelClasses(list);
cb->setTopLevelClasses(TreeViewComboBox::plotColumnTopLevelClasses());
cb->setModel(aspectModel());
connect(cb, &TreeViewComboBox::currentModelIndexChanged, this, &BarPlotDock::dataColumnChanged);

int index = m_dataComboBoxes.size();
const int index = m_dataComboBoxes.size();

if (index == 0) {
QSizePolicy sizePolicy1(QSizePolicy::Expanding, QSizePolicy::Preferred);
Expand Down Expand Up @@ -373,19 +360,17 @@ void BarPlotDock::removeDataColumn() {
}

// TODO
if (!m_removeButtons.isEmpty()) {
if (!m_removeButtons.isEmpty())
ui.lDataColumn->setText(i18n("Columns:"));
} else {
else
ui.lDataColumn->setText(i18n("Column:"));
}

if (!m_initializing)
setDataColumns();
}

void BarPlotDock::dataColumnChanged(const QModelIndex&) {
CONDITIONAL_LOCK_RETURN;

setDataColumns();
}

Expand Down
14 changes: 1 addition & 13 deletions src/frontend/widgets/ErrorBarWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,21 +166,9 @@ void ErrorBarWidget::setErrorBars(const QList<ErrorBar*>& errorBars) {
}

void ErrorBarWidget::setModel(AspectTreeModel* model) {
QList<AspectType> list{AspectType::Folder,
AspectType::Workbook,
AspectType::Datapicker,
AspectType::DatapickerCurve,
AspectType::Spreadsheet,
AspectType::LiveDataSource,
AspectType::Column,
AspectType::Worksheet,
AspectType::CartesianPlot,
AspectType::XYFitCurve,
AspectType::XYSmoothCurve,
AspectType::Notebook};

cbXPlusColumn->setModel(model);
cbXMinusColumn->setModel(model);
const auto& list = TreeViewComboBox::plotColumnTopLevelClasses();
cbXPlusColumn->setTopLevelClasses(list);
cbXMinusColumn->setTopLevelClasses(list);

Expand Down

0 comments on commit 44135ee

Please sign in to comment.