diff --git a/Source/Fractorium/Fractorium.cpp b/Source/Fractorium/Fractorium.cpp index 4d860da..7dbddca 100644 --- a/Source/Fractorium/Fractorium.cpp +++ b/Source/Fractorium/Fractorium.cpp @@ -880,6 +880,7 @@ void Fractorium::SetTabOrders() w = SetTabOrder(this, w, ui.AddFinalXformButton); w = SetTabOrder(this, w, m_XformWeightSpin); 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, w, ui.RandomColorIndicesButton); w = SetTabOrder(this, w, ui.ToggleColorIndicesButton); diff --git a/Source/Fractorium/Fractorium.h b/Source/Fractorium/Fractorium.h index 9fcfa81..28fc71b 100644 --- a/Source/Fractorium/Fractorium.h +++ b/Source/Fractorium/Fractorium.h @@ -255,7 +255,7 @@ public slots: void OnAddFinalXformButtonClicked(bool checked); void OnXformWeightChanged(double d); void OnEqualWeightButtonClicked(bool checked); - void OnXformNameChanged(int row, int col); + void OnXformNameChanged(const QString& s); void OnXformAnimateCheckBoxStateChanged(int state); //Xforms Affine. @@ -504,6 +504,7 @@ private: //Xforms. DoubleSpinBox* m_XformWeightSpin; SpinnerLabelButtonWidget* m_XformWeightSpinnerButtonWidget; + QLineEdit* m_XformNameEdit; QFormLayout* m_XformsSelectionLayout; vector m_XformSelections; diff --git a/Source/Fractorium/FractoriumEmberController.h b/Source/Fractorium/FractoriumEmberController.h index c35ea92..d1ca72b 100644 --- a/Source/Fractorium/FractoriumEmberController.h +++ b/Source/Fractorium/FractoriumEmberController.h @@ -185,7 +185,7 @@ public: virtual void CurrentXformComboChanged(int index) { } virtual void XformWeightChanged(double d) { } virtual void EqualizeWeights() { } - virtual void XformNameChanged(int row, int col) { } + virtual void XformNameChanged(const QString& s) { } virtual void XformAnimateChanged(int state) { } virtual void FillXforms(int index = 0) { } virtual void UpdateXformName(int index) { } @@ -467,7 +467,7 @@ public: virtual void CurrentXformComboChanged(int index) override; virtual void XformWeightChanged(double d) 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 FillXforms(int index = 0) override; virtual void UpdateXformName(int index) override; diff --git a/Source/Fractorium/FractoriumXforms.cpp b/Source/Fractorium/FractoriumXforms.cpp index 0010fac..5dc9a9c 100644 --- a/Source/Fractorium/FractoriumXforms.cpp +++ b/Source/Fractorium/FractoriumXforms.cpp @@ -30,8 +30,9 @@ void Fractorium::InitXformsUI() m_XformWeightSpinnerButtonWidget->setMaximumWidth(130); connect(m_XformWeightSpinnerButtonWidget->m_Button, SIGNAL(clicked(bool)), this, SLOT(OnEqualWeightButtonClicked(bool)), Qt::QueuedConnection); ui.XformWeightNameTable->setCellWidget(0, 0, m_XformWeightSpinnerButtonWidget); - ui.XformWeightNameTable->setItem(0, 1, new QTableWidgetItem()); - connect(ui.XformWeightNameTable, SIGNAL(cellChanged(int, int)), this, SLOT(OnXformNameChanged(int, int)), Qt::QueuedConnection); + m_XformNameEdit = new QLineEdit(ui.XformWeightNameTable); + 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()->setMaximumWidth(500); //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. /// Called when the user types in the name cell of the table. /// -/// The row of the cell -/// The col of the cell +/// The text of the cell template -void FractoriumEmberController::XformNameChanged(int row, int col) +void FractoriumEmberController::XformNameChanged(const QString& s) { bool forceFinal = m_Fractorium->HaveFinal(); UpdateXform([&] (Xform* 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)); }); }, eXformUpdate::UPDATE_CURRENT, false); FillSummary();//Manually update because this does not trigger a render, which is where this would normally be called. 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()); }