114 QPointF pos = mouseEvent->scenePos();
116 QList<QGraphicsItem *> itemList = items(pos);
117 if (itemList.empty()) {
121 }
else if (itemList[0]->zValue() == 2) {
124 for (
int i = 0; i < numCircle; i++) {
126 if (obj == itemList[0]) {
134 if (mouseEvent->buttons() == Qt::LeftButton) {
136 double myx = pos.x() /
_width;
138 if (interpFromNearby == T_CURVE::kNone)
139 interpFromNearby = T_CURVE::kMonotoneSpline;
265 int numCV =
_cvs.size();
266 for (
int i = 0; i < numCV; i++) {
267 const T_CURVE::CV &pt =
_cvs[i];
270 pen = QPen(Qt::white, 1.0);
272 pen = QPen(Qt::black, 1.0);
276 circle->setFlag(QGraphicsItem::ItemIsMovable,
true);
277 circle->setZValue(2);
285 auto *mainLayout =
new QHBoxLayout();
286 mainLayout->setContentsMargins({});
288 auto *edits =
new QWidget;
289 auto *editsLayout =
new QFormLayout;
290 editsLayout->setContentsMargins({});
291 edits->setLayout(editsLayout);
294 auto *posValidator =
new QDoubleValidator(0.0, 1.0, 6,
_selPosEdit);
297 if (pLabel.isEmpty()) {
298 posLabel = tr(
"Selected Position:");
305 auto *valValidator =
new QDoubleValidator(0.0, 1.0, 6,
_selValEdit);
308 if (vLabel.isEmpty()) {
309 valLabel = tr(
"Selected Value:");
316 if (iLabel.isEmpty()) {
317 interpLabel = tr(
"Interp:");
319 interpLabel = iLabel;
331 curveView->setFrameShape(QFrame::StyledPanel);
332 curveView->setFrameShadow(QFrame::Sunken);
333 curveView->setLineWidth(1);
334 curveView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
335 curveView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
337 curveView->setScene(
_scene);
338 curveView->setTransform(QTransform().scale(1, -1));
339 curveView->setRenderHints(QPainter::Antialiasing);
341 mainLayout->addWidget(edits);
342 mainLayout->addWidget(curveView);
344 auto *expandButton =
new QToolButton(
this);
345 expandButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
346 QIcon expandIcon = QIcon::fromTheme(
"arrow-right", QIcon::fromTheme(
"go-next"));
347 auto *detailAction =
new QAction(expandIcon, tr(
"&Expand..."));
348 expandButton->setDefaultAction(detailAction);
349 mainLayout->addWidget(expandButton);
351 connect(expandButton, SIGNAL(triggered(QAction *)),
this, SLOT(
openDetail()));
353 mainLayout->setStretchFactor(curveView, 100);
354 setLayout(mainLayout);
369 connect(curveView, SIGNAL(resizeSignal(
int,
int)),
_scene, SLOT(resize(
int,
int)));
405 auto *dialog =
new QDialog();
406 dialog->setMinimumWidth(1024);
407 dialog->setMinimumHeight(400);
408 auto *curve =
new ExprCurve(
nullptr, QString(), QString(), QString(),
false);
411 const std::vector<T_CURVE::CV> &data =
_scene->
_cvs;
412 for (
const auto & i : data)
413 curve->addPoint(i._pos, i._val, i._interp);
415 auto *layout =
new QVBoxLayout();
416 dialog->setLayout(layout);
417 layout->addWidget(curve);
418 auto *buttonbar =
new QDialogButtonBox();
419 buttonbar->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
420 connect(buttonbar, SIGNAL(accepted()), dialog, SLOT(accept()));
421 connect(buttonbar, SIGNAL(rejected()), dialog, SLOT(reject()));
422 layout->addWidget(buttonbar);
424 if (dialog->exec() == QDialog::Accepted) {
427 const auto &dataNew = curve->_scene->_cvs;
428 for (
const auto & i : dataNew)
429 addPoint(i._pos, i._val, i._interp);
433 if (dialog->exec() == QDialog::Accepted) {
436 const auto &dataNew = curve->_scene->_cvs;
437 for (
const auto & i : dataNew)
438 addPoint(i._pos, i._val, i._interp);