2 #include "ui_plotwidget_transforms.h" 6 #include <QListWidgetItem> 10 #include <QDialogButtonBox> 16 ui(new
Ui::plotwidget_transforms),
17 _plotwidget_origin(plotwidget)
27 auto layout =
new QVBoxLayout();
28 ui->framePlotPreview->setLayout(layout);
38 restoreGeometry(settings.value(
"DialogTransformEditor.geometry").toByteArray());
40 ui->listCurves->setStyleSheet(
"QListView::item:selected { background: #ddeeff; }");
42 auto names = TransformFactory::registeredTransforms();
44 for(
const auto&
name: names)
46 ui->listTransforms->addItem( QString::fromStdString(
name) );
49 if(
ui->listCurves->count() != 0 ){
50 ui->listCurves->item(0)->setSelected(
true);
59 for (
auto& it : colors)
62 auto color = it.second;
63 auto item =
new QListWidgetItem();
65 ui->listCurves->addItem( item );
67 item->setSizeHint( plot_row->sizeHint() );
68 ui->listCurves->setItemWidget(item, plot_row );
77 settings.setValue(
"DialogTransformEditor.geometry", saveGeometry());
84 auto layout =
new QHBoxLayout();
86 _text =
new QLabel(text,
this);
88 setStyleSheet( QString(
"color: %1;").
arg(color.name()));
91 layout->addWidget(_text);
104 auto selected =
ui->listCurves->selectedItems();
105 if( selected.size() != 1){
108 auto item = selected.front();
109 auto row_widget =
dynamic_cast<RowWidget*
>(
ui->listCurves->itemWidget(item) );
110 auto curve_name = row_widget->
text();
115 int transform_row = 0;
116 if( ts->transform() )
118 for(
int row = 1; row <
ui->listTransforms->count(); row++)
120 if(
ui->listTransforms->item(row)->text() == ts->transformName() )
128 int selected_row = -1;
129 auto selected_transforms =
ui->listTransforms->selectedItems();
130 if( selected_transforms.size() == 1)
132 selected_row =
ui->listTransforms->row(selected_transforms.front());
135 if( selected_row == transform_row){
140 ui->listTransforms->item(transform_row)->setSelected(
true);
146 auto selected_curves =
ui->listCurves->selectedItems();
147 if( selected_curves.size() != 1){
150 auto row_widget =
dynamic_cast<RowWidget*
>(
151 ui->listCurves->itemWidget(selected_curves.front()) );
153 QString curve_name = row_widget->
text();
155 auto selected_transforms =
ui->listTransforms->selectedItems();
156 if( selected_transforms.size() != 1){
159 QString transform_ID = selected_transforms.front()->text();
162 auto qwt_curve = curve_it->
curve;
165 QSignalBlocker
block(
ui->lineEditAlias);
167 if( transform_ID.isEmpty() || transform_ID ==
ui->listTransforms->item(0)->text() )
169 ts->setTransform({});
170 ts->updateCache(
true);
171 ui->stackedWidgetArguments->setCurrentIndex(0);
173 ui->lineEditAlias->setText(
"");
174 ui->lineEditAlias->setEnabled(
false);
175 qwt_curve->setTitle( curve_name );
178 ts->setTransform(transform_ID);
179 ts->updateCache(
true);
180 ui->lineEditAlias->setEnabled(
true);
182 QString curve_title = qwt_curve->title().text();
183 if( ts->transform()->alias().isEmpty())
185 auto new_title = QString(
"%1[%2]").arg(curve_name).arg(transform_ID);
186 ts->transform()->setAlias(new_title);
189 ui->lineEditAlias->setText( ts->transform()->alias() );
190 qwt_curve->setTitle( ts->transform()->alias() );
192 auto widget = ts->transform()->optionsWidget();
193 int index =
ui->stackedWidgetArguments->indexOf(widget);
196 index =
ui->stackedWidgetArguments->addWidget(widget);
199 ui->stackedWidgetArguments->setCurrentIndex(index);
203 connect( ts->transform().get(), &TimeSeriesTransform::parametersChanged,
205 ts->updateCache(
true);
232 auto selected_curves =
ui->listCurves->selectedItems();
233 if( selected_curves.size() != 1){
236 auto row_widget =
dynamic_cast<RowWidget*
>(
237 ui->listCurves->itemWidget(selected_curves.front()) );
239 QString curve_name = row_widget->
text();
244 curve_it->curve->setTitle(
ui->lineEditAlias->text() );
246 if( ts && ts->transform() )
248 ts->
transform()->setAlias(
ui->lineEditAlias->text());
static void block(LexState *ls)
detail::named_arg< Char, T > arg(const Char *name, const T &arg)