Add new lines of code:
M_pModel2 - & gt; AddFormula (1, 1, 0, false);
for (int i=0; i{
UI. LvContainer - & gt; OpenPersistentEditor (m_pModel2 - & gt; The index (I, 0));
UI. LvContainer - & gt; OpenPersistentEditor (m_pModel2 - & gt; The index (I, 1));
UI. LvContainer - & gt; OpenPersistentEditor (m_pModel2 - & gt; The index (I, 2));
UI. LvContainer - & gt; OpenPersistentEditor (m_pModel2 - & gt; The index (I, 3));
}
AddFormula function implementation:
Void FormulaListModel: : AddFormula (int op1, int op2, int op, bool isEnable)
{
BeginResetModel ();
PFORMULA pf=new FORMULA;
Pf - & gt; Op=op;
Pf - & gt; Op1=op1;
Pf - & gt; Op2=op2;
Pf - & gt; IsEnable=isEnable;
M_lsFormula & lt;EndResetModel ();
}
Caveat: I want to achieve is to realize a formula editor in QTableView function, each time adding a new formula, which produce a new line, including three QComboBox QCheckBox and controls,
CodePudding user response:
Control the state of preservation in the model? You keep the state into the model, and then in itemdelegate by reading the model of state data show that the control again, ok