0
我試圖創建一個Qt的線自動填充編輯,但我的程序崩潰的原因,我無法理解,這使得它崩潰是Qt的程序意外成品
model_Customer->setTable("Customer");
model_Customer->select();
model_Product->setTable("Product");
model_Product->select();
Account_completer->setModel(model_Customer);
Product_completer->setModel(model_Product);
Account_completer->setCaseSensitivity(Qt::CaseInsensitive);
Product_completer->setCaseSensitivity(Qt::CaseInsensitive);
AutoComplete();
ui->lineEdit_Invoice_Account->setCompleter(Account_completer);
ui->lineEdit_Invoice_Product->setCompleter(Product_completer);
我.h文件中低於
代碼QSqlDatabase db;
QSqlTableModel *model_Customer;
QSqlTableModel *model_Product;
QCompleter *Account_completer;
QCompleter *Product_completer;
謝謝
您是否創建了模型的新實例?像:'model_Customer = new QSqlTableModel(this,db);' – Nejat 2014-12-27 18:32:41
謝謝,我剛剛注意到我忘了補充說 – Root0x 2014-12-27 18:35:29