Home > Mobile >  The problem of Qt TableView
The problem of Qt TableView

Time:10-07

TableView is set up like this:
Customor: : customor (QWidget * parent) :
QWidget (parent),
UI (new UI: : customor)
{
The UI - & gt; SetupUi (this);
The model=new QSqlTableModel (this);
The model - & gt; SetTable (" Press ");
The model - & gt; The select ();
The UI - & gt; Baokantableview - & gt; SetModel (model);
}
Set in the constructor, so that we can display properly, double-click the TableView can directly edit content
But using a write their own search function, double-click the TableView can't edit the
Void customor: : find ()
{
QSqlQueryModel * modell=new QSqlQueryModel;
QString find sql0;
The find=UI - & gt; LineEdit - & gt; The text ();
Sql0="select * from Press where names LIKE '%" + find + "%'";
Modell - & gt; SetQuery (sql0);

The UI - & gt; Baokantableview - & gt; SetModel (modell);

}

Before I search can edit

Search after the double-click will not be able to edit the
??????????/

CodePudding user response:

Up and down is not the same as the model

CodePudding user response:

The former is: QSqlTableModel, the latter is: QSqlQueryModel
  •  Tags:  
  • Qt
  • Related