modelClientsList->setQuery("SELECT client_id, client_fullName, client_city, client_street, client_code, client_nip, client_regon, client_contactName, client_phone, client_fax, client_url, client_email, client_notes FROM scm_clients");
modelClientsList
->setHeaderData
(0, Qt
::Horizontal,
QObject::trUtf8("ID"));
modelClientsList
->setHeaderData
(1, Qt
::Horizontal,
QObject::trUtf8("Name"));
modelClientsList
->setHeaderData
(2, Qt
::Horizontal,
QObject::trUtf8("City"));
QSqlQueryModel *modelClientsList = new QSqlQueryModel;
modelClientsList->setQuery("SELECT client_id, client_fullName, client_city, client_street, client_code, client_nip, client_regon, client_contactName, client_phone, client_fax, client_url, client_email, client_notes FROM scm_clients");
modelClientsList->setHeaderData(0, Qt::Horizontal, QObject::trUtf8("ID"));
modelClientsList->setHeaderData(1, Qt::Horizontal, QObject::trUtf8("Name"));
modelClientsList->setHeaderData(2, Qt::Horizontal, QObject::trUtf8("City"));
To copy to clipboard, switch view to plain text mode
AND
ui->clientComboBox->setModel(modelClientsList);
ui->clientComboBox->setModelColumn(1);
ui->clientComboBox->setCurrentIndex(-1);
ui->clientComboBox->setModel(modelClientsList);
ui->clientComboBox->setModelColumn(1);
ui->clientComboBox->setCurrentIndex(-1);
To copy to clipboard, switch view to plain text mode
AND
void StackedWidget::on_clientComboBox_currentIndexChanged(int index)
{
qDebug() << ui->clientComboBox->itemData(index);
qDebug() << ui->clientComboBox->itemData(currentIndex()).toString();
}
void StackedWidget::on_clientComboBox_currentIndexChanged(int index)
{
qDebug() << ui->clientComboBox->itemData(index);
qDebug() << ui->clientComboBox->itemData(currentIndex()).toString();
}
To copy to clipboard, switch view to plain text mode
Bookmarks