261 : QWidget(parent), _scene(0), _selPosEdit(0), _selValEdit(0), _interpComboBox(0) {
263 QHBoxLayout *mainLayout =
new QHBoxLayout();
264 mainLayout->setSpacing(2);
265 mainLayout->setMargin(4);
267 QWidget *edits =
new QWidget;
268 QVBoxLayout *editsLayout =
new QVBoxLayout;
269 editsLayout->setAlignment(Qt::AlignTop);
270 editsLayout->setSpacing(0);
271 editsLayout->setMargin(0);
272 edits->setLayout(editsLayout);
274 QWidget *selPos =
new QWidget;
275 QHBoxLayout *selPosLayout =
new QHBoxLayout;
276 selPosLayout->setSpacing(1);
277 selPosLayout->setMargin(1);
278 selPos->setLayout(selPosLayout);
280 QDoubleValidator *posValidator =
new QDoubleValidator(0.0, 1.0, 6,
_selPosEdit);
282 int editwidth = QFontMetrics(font()).width(
"9.999") + 8;
285 selPosLayout->addStretch(50);
287 if (pLabel.isEmpty()) {
288 posLabel =
new QLabel(
"Selected Position: ");
290 posLabel =
new QLabel(pLabel);
292 selPosLayout->addWidget(posLabel);
295 QWidget *selVal =
new QWidget;
296 QBoxLayout *selValLayout =
new QHBoxLayout;
297 selValLayout->setSpacing(1);
298 selValLayout->setMargin(1);
299 selVal->setLayout(selValLayout);
301 QDoubleValidator *valValidator =
new QDoubleValidator(0.0, 1.0, 6,
_selValEdit);
305 selValLayout->addStretch(50);
307 if (vLabel.isEmpty()) {
308 valLabel =
new QLabel(
"Selected Value: ");
310 valLabel =
new QLabel(vLabel);
312 selValLayout->addWidget(valLabel);
325 editsLayout->addWidget(selPos);
326 editsLayout->addWidget(selVal);
329 QFrame *curveFrame =
new QFrame;
330 curveFrame->setFrameShape(QFrame::Panel);
331 curveFrame->setFrameShadow(QFrame::Sunken);
332 curveFrame->setLineWidth(1);
333 QHBoxLayout *curveFrameLayout =
new QHBoxLayout;
334 curveFrameLayout->setMargin(0);
336 curveView->setFrameShape(QFrame::Panel);
337 curveView->setFrameShadow(QFrame::Sunken);
338 curveView->setLineWidth(1);
339 curveView->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
340 curveView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
342 curveView->setScene(
_scene);
343 curveView->setTransform(QTransform().scale(1, -1));
344 curveView->setRenderHints(QPainter::Antialiasing);
345 curveFrameLayout->addWidget(curveView);
346 curveFrame->setLayout(curveFrameLayout);
348 mainLayout->addWidget(edits);
349 mainLayout->addWidget(curveFrame);
351 QPushButton *expandButton =
new QPushButton(
">");
352 expandButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Expanding);
353 expandButton->setFixedWidth(15);
354 mainLayout->addWidget(expandButton);
356 connect(expandButton, SIGNAL(clicked()),
this, SLOT(
openDetail()));
358 mainLayout->setStretchFactor(curveFrame, 100);
359 setLayout(mainLayout);
374 connect(curveView, SIGNAL(resizeSignal(
int,
int)),
_scene, SLOT(resize(
int,
int)));
404 QDialog *dialog =
new QDialog();
405 dialog->setMinimumWidth(1024);
406 dialog->setMinimumHeight(400);
410 const std::vector<T_CURVE::CV> &data =
_scene->
_cvs;
411 typedef std::vector<T_CURVE::CV>::const_iterator ITERATOR;
412 for (ITERATOR i = data.begin(); i != data.end(); ++i) curve->addPoint(i->_pos, i->_val, i->_interp);
414 QVBoxLayout *layout =
new QVBoxLayout();
415 dialog->setLayout(layout);
416 layout->addWidget(curve);
417 QDialogButtonBox *buttonbar =
new QDialogButtonBox();
418 buttonbar->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
419 connect(buttonbar, SIGNAL(accepted()), dialog, SLOT(accept()));
420 connect(buttonbar, SIGNAL(rejected()), dialog, SLOT(reject()));
421 layout->addWidget(buttonbar);
423 if (dialog->exec() == QDialog::Accepted) {
426 const std::vector<T_CURVE::CV> &dataNew = curve->_scene->_cvs;
427 typedef std::vector<T_CURVE::CV>::const_iterator ITERATOR;
428 for (ITERATOR i = dataNew.begin(); i != dataNew.end(); ++i)
addPoint(i->_pos, i->_val, i->_interp);
432 if (dialog->exec() == QDialog::Accepted) {
435 const std::vector<T_CURVE::CV> &dataNew = curve->_scene->_cvs;
436 typedef std::vector<T_CURVE::CV>::const_iterator ITERATOR;
437 for (ITERATOR i = dataNew.begin(); i != dataNew.end(); ++i)
addPoint(i->_pos, i->_val, i->_interp);