--User changes

-Make the xform name field be a standard edit control so it's always editable.
This commit is contained in:
Person 2019-11-28 12:18:36 -08:00
parent adf590209a
commit 59605f10a8
4 changed files with 13 additions and 11 deletions

View File

@ -880,6 +880,7 @@ void Fractorium::SetTabOrders()
w = SetTabOrder(this, w, ui.AddFinalXformButton); w = SetTabOrder(this, w, ui.AddFinalXformButton);
w = SetTabOrder(this, w, m_XformWeightSpin); w = SetTabOrder(this, w, m_XformWeightSpin);
w = SetTabOrder(this, w, m_XformWeightSpinnerButtonWidget->m_Button); w = SetTabOrder(this, w, m_XformWeightSpinnerButtonWidget->m_Button);
w = SetTabOrder(this, w, m_XformNameEdit);
w = SetTabOrder(this, m_XformColorIndexSpin, ui.XformColorScroll);//Xforms color. w = SetTabOrder(this, m_XformColorIndexSpin, ui.XformColorScroll);//Xforms color.
w = SetTabOrder(this, w, ui.RandomColorIndicesButton); w = SetTabOrder(this, w, ui.RandomColorIndicesButton);
w = SetTabOrder(this, w, ui.ToggleColorIndicesButton); w = SetTabOrder(this, w, ui.ToggleColorIndicesButton);

View File

@ -255,7 +255,7 @@ public slots:
void OnAddFinalXformButtonClicked(bool checked); void OnAddFinalXformButtonClicked(bool checked);
void OnXformWeightChanged(double d); void OnXformWeightChanged(double d);
void OnEqualWeightButtonClicked(bool checked); void OnEqualWeightButtonClicked(bool checked);
void OnXformNameChanged(int row, int col); void OnXformNameChanged(const QString& s);
void OnXformAnimateCheckBoxStateChanged(int state); void OnXformAnimateCheckBoxStateChanged(int state);
//Xforms Affine. //Xforms Affine.
@ -504,6 +504,7 @@ private:
//Xforms. //Xforms.
DoubleSpinBox* m_XformWeightSpin; DoubleSpinBox* m_XformWeightSpin;
SpinnerLabelButtonWidget* m_XformWeightSpinnerButtonWidget; SpinnerLabelButtonWidget* m_XformWeightSpinnerButtonWidget;
QLineEdit* m_XformNameEdit;
QFormLayout* m_XformsSelectionLayout; QFormLayout* m_XformsSelectionLayout;
vector<QCheckBox*> m_XformSelections; vector<QCheckBox*> m_XformSelections;

View File

@ -185,7 +185,7 @@ public:
virtual void CurrentXformComboChanged(int index) { } virtual void CurrentXformComboChanged(int index) { }
virtual void XformWeightChanged(double d) { } virtual void XformWeightChanged(double d) { }
virtual void EqualizeWeights() { } virtual void EqualizeWeights() { }
virtual void XformNameChanged(int row, int col) { } virtual void XformNameChanged(const QString& s) { }
virtual void XformAnimateChanged(int state) { } virtual void XformAnimateChanged(int state) { }
virtual void FillXforms(int index = 0) { } virtual void FillXforms(int index = 0) { }
virtual void UpdateXformName(int index) { } virtual void UpdateXformName(int index) { }
@ -467,7 +467,7 @@ public:
virtual void CurrentXformComboChanged(int index) override; virtual void CurrentXformComboChanged(int index) override;
virtual void XformWeightChanged(double d) override; virtual void XformWeightChanged(double d) override;
virtual void EqualizeWeights() override; virtual void EqualizeWeights() override;
virtual void XformNameChanged(int row, int col) override; virtual void XformNameChanged(const QString& s) override;
virtual void XformAnimateChanged(int state) override; virtual void XformAnimateChanged(int state) override;
virtual void FillXforms(int index = 0) override; virtual void FillXforms(int index = 0) override;
virtual void UpdateXformName(int index) override; virtual void UpdateXformName(int index) override;

View File

@ -30,8 +30,9 @@ void Fractorium::InitXformsUI()
m_XformWeightSpinnerButtonWidget->setMaximumWidth(130); m_XformWeightSpinnerButtonWidget->setMaximumWidth(130);
connect(m_XformWeightSpinnerButtonWidget->m_Button, SIGNAL(clicked(bool)), this, SLOT(OnEqualWeightButtonClicked(bool)), Qt::QueuedConnection); connect(m_XformWeightSpinnerButtonWidget->m_Button, SIGNAL(clicked(bool)), this, SLOT(OnEqualWeightButtonClicked(bool)), Qt::QueuedConnection);
ui.XformWeightNameTable->setCellWidget(0, 0, m_XformWeightSpinnerButtonWidget); ui.XformWeightNameTable->setCellWidget(0, 0, m_XformWeightSpinnerButtonWidget);
ui.XformWeightNameTable->setItem(0, 1, new QTableWidgetItem()); m_XformNameEdit = new QLineEdit(ui.XformWeightNameTable);
connect(ui.XformWeightNameTable, SIGNAL(cellChanged(int, int)), this, SLOT(OnXformNameChanged(int, int)), Qt::QueuedConnection); ui.XformWeightNameTable->setCellWidget(0, 1, m_XformNameEdit);
connect(m_XformNameEdit, SIGNAL(textChanged(const QString&)), this, SLOT(OnXformNameChanged(const QString&)), Qt::QueuedConnection);
ui.CurrentXformCombo->view()->setMinimumWidth(100); ui.CurrentXformCombo->view()->setMinimumWidth(100);
ui.CurrentXformCombo->view()->setMaximumWidth(500); ui.CurrentXformCombo->view()->setMaximumWidth(500);
//ui.CurrentXformCombo->view()->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); //ui.CurrentXformCombo->view()->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
@ -405,24 +406,23 @@ void Fractorium::OnEqualWeightButtonClicked(bool checked) { m_Controller->Equali
/// Update the corresponding xform checkbox text with the name. /// Update the corresponding xform checkbox text with the name.
/// Called when the user types in the name cell of the table. /// Called when the user types in the name cell of the table.
/// </summary> /// </summary>
/// <param name="row">The row of the cell</param> /// <param name="s">The text of the cell</param>
/// <param name="col">The col of the cell</param>
template <typename T> template <typename T>
void FractoriumEmberController<T>::XformNameChanged(int row, int col) void FractoriumEmberController<T>::XformNameChanged(const QString& s)
{ {
bool forceFinal = m_Fractorium->HaveFinal(); bool forceFinal = m_Fractorium->HaveFinal();
UpdateXform([&] (Xform<T>* xform, size_t xfindex, size_t selIndex) UpdateXform([&] (Xform<T>* xform, size_t xfindex, size_t selIndex)
{ {
xform->m_Name = m_Fractorium->ui.XformWeightNameTable->item(row, col)->text().toStdString(); xform->m_Name = s.toStdString();
XformCheckboxAt(int(xfindex), [&](QCheckBox * checkbox) { checkbox->setText(MakeXformCaption(xfindex)); }); XformCheckboxAt(int(xfindex), [&](QCheckBox * checkbox) { checkbox->setText(MakeXformCaption(xfindex)); });
}, eXformUpdate::UPDATE_CURRENT, false); }, eXformUpdate::UPDATE_CURRENT, false);
FillSummary();//Manually update because this does not trigger a render, which is where this would normally be called. FillSummary();//Manually update because this does not trigger a render, which is where this would normally be called.
m_Fractorium->FillXaosTable(); m_Fractorium->FillXaosTable();
} }
void Fractorium::OnXformNameChanged(int row, int col) void Fractorium::OnXformNameChanged(const QString& s)
{ {
m_Controller->XformNameChanged(row, col); m_Controller->XformNameChanged(s);
m_Controller->UpdateXformName(ui.CurrentXformCombo->currentIndex()); m_Controller->UpdateXformName(ui.CurrentXformCombo->currentIndex());
} }