mirror of
https://bitbucket.org/mfeemster/fractorium.git
synced 2025-06-30 21:36:33 -04:00
--Bug fixes
-Change variation spin boxes to only show the precision needed, and also allow scientific notation.
This commit is contained in:
@ -356,7 +356,7 @@ VariationTreeDoubleSpinBox::VariationTreeDoubleSpinBox(QWidget* p, VariationTree
|
||||
m_WidgetItem = widgetItem;
|
||||
m_Param = param;
|
||||
m_Id = id;
|
||||
setDecimals(3);
|
||||
//setDecimals(3);
|
||||
//PI
|
||||
auto piAction = new QAction("PI", this);
|
||||
connect(piAction, SIGNAL(triggered(bool)), this, SLOT(PiActionTriggered(bool)), Qt::QueuedConnection);
|
||||
@ -407,6 +407,7 @@ VariationTreeDoubleSpinBox::VariationTreeDoubleSpinBox(QWidget* p, VariationTree
|
||||
this->addAction(sqrtThreeAction);
|
||||
//Need this for it to show up properly.
|
||||
this->setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||
lineEdit()->setValidator(new QDoubleValidator(this));
|
||||
}
|
||||
|
||||
void VariationTreeDoubleSpinBox::PiActionTriggered(bool checked) { setValue(M_PI); }
|
||||
@ -422,6 +423,12 @@ void VariationTreeDoubleSpinBox::FourOverPiActionTriggered(bool checked) { setV
|
||||
void VariationTreeDoubleSpinBox::SqrtTwoActionTriggered(bool checked) { setValue(M_SQRT2); }
|
||||
void VariationTreeDoubleSpinBox::SqrtThreeActionTriggered(bool checked) { setValue(std::sqrt(3.0)); }
|
||||
|
||||
|
||||
QString VariationTreeDoubleSpinBox::textFromValue(double value) const
|
||||
{
|
||||
return QWidget::locale().toString(value, 'g', 10);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor that sets up the context menu for special numerical values specific to affine spinners.
|
||||
/// </summary>
|
||||
|
@ -98,6 +98,7 @@ public:
|
||||
string ParamName() { return m_Param; }
|
||||
eVariationId GetVariationId() { return m_Id; }
|
||||
VariationTreeWidgetItem* WidgetItem() { return m_WidgetItem; }
|
||||
virtual QString textFromValue(double value) const override;
|
||||
|
||||
public slots:
|
||||
void PiActionTriggered(bool checked = false);
|
||||
|
@ -122,7 +122,7 @@ void FractoriumEmberController<T>::SetupVariationsTree()
|
||||
spinBox->DoubleClickZero(1);
|
||||
spinBox->DoubleClickNonZero(0);
|
||||
spinBox->SmallStep(0.001);
|
||||
spinBox->setDecimals(4);
|
||||
//spinBox->setDecimals(4);
|
||||
tree->setItemWidget(item, 1, spinBox);
|
||||
m_Fractorium->connect(spinBox, SIGNAL(valueChanged(double)), SLOT(OnVariationSpinBoxValueChanged(double)), Qt::QueuedConnection);
|
||||
|
||||
|
Reference in New Issue
Block a user