2 #include "ui_plotwidget_editor.h" 6 #include <QListWidgetItem> 10 #include <QDialogButtonBox> 18 ui(new
Ui::PlotWidgetEditor),
19 _plotwidget_origin(plotwidget)
23 installEventFilter(
this);
39 auto layout =
new QVBoxLayout();
40 ui->framePlotPreview->setLayout(layout);
49 restoreGeometry(settings.value(
"PlotwidgetEditor.geometry").toByteArray());
53 ui->radioLines->setChecked(
true);
57 ui->radioPoints->setChecked(
true);
60 ui->radioBoth->setChecked(
true);
63 ui->lineLimitMax->setValidator(
new QDoubleValidator(
this));
64 ui->lineLimitMin->setValidator(
new QDoubleValidator(
this));
72 ui->checkBoxMin->setChecked(
true);
73 ui->lineLimitMin->setText(QString::number(ylimits.min));
76 ui->lineLimitMin->setText(QString::number(suggested_limits.
min));
81 ui->checkBoxMax->setChecked(
true);
82 ui->lineLimitMax->setText(QString::number(ylimits.max));
85 ui->lineLimitMax->setText(QString::number(suggested_limits.
max));
90 if(
ui->listWidget->count() != 0 ){
91 ui->listWidget->item(0)->setSelected(
true);
98 settings.setValue(
"PlotwidgetEditor.geometry", saveGeometry());
106 auto selected =
ui->listWidget->selectedItems();
107 if( selected.size() != 1)
111 auto item = selected.front();
113 auto row_widget =
dynamic_cast<EditorRowWidget*
>(
ui->listWidget->itemWidget(item) );
114 auto name = row_widget->text();
115 if( row_widget->color() !=
c)
117 row_widget->setColor( c );
126 auto wheel_layout =
new QVBoxLayout();
127 wheel_layout->setMargin(0);
128 wheel_layout->setSpacing(5);
129 ui->widgetWheel->setLayout( wheel_layout );
145 this, [
this](QColor col)
147 QSignalBlocker
block(
ui->editColotText );
148 ui->editColotText->setText( col.name() );
156 int row_count =
ui->listWidget->count();
157 for(
int row = 0; row < row_count; row++ )
159 auto item =
ui->listWidget->item(row);
160 auto widget =
ui->listWidget->itemWidget(item);
165 ui->listWidget->takeItem(row);
167 widget->deleteLater();
181 ui->widgetColor->setEnabled(
false);
185 ui->frameLimits->setEnabled(
false);
186 ui->frameStyle->setEnabled(
false);
194 for (
auto& it : colors)
196 auto alias = it.first;
197 auto color = it.second;
198 auto item =
new QListWidgetItem();
200 item->setData(Qt::UserRole, it.first );
202 ui->listWidget->addItem( item );
204 item->setSizeHint( plot_row->sizeHint() );
205 ui->listWidget->setItemWidget(item, plot_row );
221 if (
ui->checkBoxMax->isChecked() && !
ui->lineLimitMax->text().isEmpty())
224 double val =
ui->lineLimitMax->text().toDouble(&ok);
225 if(ok) { ymax = val; }
228 if (
ui->checkBoxMin->isChecked() && !
ui->lineLimitMin->text().isEmpty())
231 double val =
ui->lineLimitMin->text().toDouble(&ok);
232 if(ok) { ymin = val; }
238 ui->lineLimitMin->setText(QString::number(ymax));
239 ui->lineLimitMax->setText(QString::number(ymin));
251 if( text.size() == 7 && text[0] ==
'#' && QColor::isValidColor(text))
286 ui->lineLimitMax->setEnabled(checked);
292 ui->lineLimitMin->setEnabled(checked);
307 ui->lineLimitMin->setText(QString::number(limits.
min));
308 ui->lineLimitMax->setText(QString::number(limits.
max));
337 setMouseTracking(
true);
338 const QSize button_size(20,20);
340 auto layout =
new QHBoxLayout();
342 _text =
new QLabel(text,
this);
351 auto icon = QIcon(
":/resources/svg/remove_red.svg");
352 _delete_button->setStyleSheet(
"QPushButton:hover{ border: 0px;}");
359 layout->addWidget(
_text);
380 return _text->text();
385 setStyleSheet( QString(
"color: %1;").
arg(color.name()));
396 auto selected = ui->listWidget->selectedItems();
397 if( selected.size() == 0 || ui->listWidget->count() == 0)
399 ui->widgetColor->setEnabled(
false);
400 ui->editColotText->setText(
"#000000" );
404 ui->widgetColor->setEnabled(
true);
406 if( selected.size() != 1)
411 auto item = selected.front();
412 auto row_widget =
dynamic_cast<EditorRowWidget*
>( ui->listWidget->itemWidget(item) );
415 ui->editColotText->setText( row_widget->color().name() );
static void block(LexState *ls)
detail::named_arg< Char, T > arg(const Char *name, const T &arg)