11#include <QDoubleValidator>
14#include <QInputDialog>
35 const QString &constraint,
bool othersFixed,
bool allOthersFixed,
36 bool othersTied,
bool logOptionsEnabled)
37 : QWidget(parent), m_index(
index),
m_value(QString::number(
value,
'g', 16)), m_fixed(fixed), m_tie(tie),
38 m_constraint(constraint), m_othersFixed(othersFixed), m_allOthersFixed(allOthersFixed), m_othersTied(othersTied) {
39 auto layout =
new QHBoxLayout(
this);
41 layout->setSpacing(0);
42 layout->setContentsMargins(0, 0, 0, 0);
45 m_editor->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
46 this->setFocusPolicy(Qt::StrongFocus);
50 m_button->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding);
51 m_button->setFocusPolicy(Qt::NoFocus);
55 layout->setStretch(0, 1);
56 layout->setStretch(1, 0);
58 auto setMenu =
new QMenu(
this);
65 setMenu->addSeparator();
67 m_fixAction->setToolTip(
"Fix value of this parameter");
81 setMenu->addSeparator();
102 setMenu->addSeparator();
123 setMenu->addSeparator();
131 m_setAllToLogAction->setToolTip(
"Set all parameters to log value from the relevant workspace");
140 connect(
m_editor, SIGNAL(textEdited(
const QString &)),
this, SLOT(
updateValue(
const QString &)));
179 if (!tie.isEmpty()) {
196 if (!tie.isEmpty()) {
214 if (!constraint.isEmpty()) {
229 if (!constraint.isEmpty()) {
249 if (evn->type() == QEvent::KeyPress) {
250 auto keyEvent =
static_cast<QKeyEvent *
>(evn);
251 if (keyEvent->key() == Qt::Key_F && keyEvent->modifiers() == Qt::ControlModifier &&
m_tie.isEmpty()) {
255 if (
m_tie.isEmpty()) {
284 auto validator =
new QDoubleValidator(
this);
285 validator->setDecimals(16);
288 m_editor->setToolTip(
"Edit local parameter value. Press Ctrl+F to fix/unfix it.");
292 m_editor->setToolTip(
"Edit local parameter tie.");
299 input.setWindowTitle(
"Set a tie.");
300 input.setTextValue(tie);
301 if (input.exec() == QDialog::Accepted) {
302 return input.textValue();
309 input.setWindowTitle(
"Set a constraint.");
310 input.setTextValue(constraint);
311 if (input.exec() == QDialog::Accepted) {
312 return input.textValue();
const std::string & m_value
double value
The value of the point.
std::map< DeltaEMode::Type, std::string > index