removecurvedialog.cpp
Go to the documentation of this file.
1 #include "removecurvedialog.h"
2 #include "ui_removecurvedialog.h"
3 #include "plotwidget.h"
4 #include <QDebug>
5 #include "plotwidget.h"
6 
8  QDialog(parent),
9  ui(new Ui::RemoveCurveDialog),
10  _parent(parent)
11 {
12  ui->setupUi(this);
13 }
14 
16 {
17  delete ui;
18 }
19 
20 void RemoveCurveDialog::addCurveName(const QString &name, const QColor &color )
21 {
22  QListWidgetItem* item = new QListWidgetItem( name );
23  item->setForeground(color);
24  ui->listCurveWidget->addItem(item);
25 }
26 
28 {
29  auto selected_items = ui->listCurveWidget->selectedItems();
30 
31  for(const auto item: selected_items)
32  {
33  if( item->isHidden() == false)
34  {
35  _parent->removeCurve( item->text().toStdString() );
36  item->setHidden( true );
37  }
38  }
39 
40  if( ui->listCurveWidget->count() > 0)
41  {
42  _parent->replot();
43  }
44  closeIfEmpty();
45 }
46 
48 {
49  bool isEmpty = true;
50  for(int index = 0; index <ui->listCurveWidget->count(); ++index)
51  {
52  QListWidgetItem* item = ui->listCurveWidget->item( index );
53  if( item->isHidden() == false)
54  {
55  isEmpty = false;
56  break;
57  }
58  }
59  if( isEmpty ) this->accept();
60 }
void replot() override
Ui::RemoveCurveDialog * ui
RemoveCurveDialog(PlotWidget *parent)
void addCurveName(const QString &name, const QColor &color)
PlotWidget * _parent
void removeCurve(const std::string &name)
Definition: plotwidget.cpp:426


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:18