I want to get the index of item of QListView and set at this item focus. The items are strings! How can I make it?
I have made this is:
void LicenceBuilder::findLeftSN(const QString& new_SN)
{
if(new_SN.isEmpty()) return;
model.setTable("DeviceList");
model.select();
for(int i=0; i<model.rowCount(); ++i)
{
listNames.append(record.value("serialNumber").toString());
}
if(name.indexOf(new_SN, 0, Qt::CaseInsensitive) != -1)
selList.append(name);
/// What to do??????
}
void LicenceBuilder::findLeftSN(const QString& new_SN)
{
if(new_SN.isEmpty()) return;
QSqlTableModel model;
model.setTable("DeviceList");
model.select();
QStringList listNames, selList;
for(int i=0; i<model.rowCount(); ++i)
{
QSqlRecord record = model.record(i);
listNames.append(record.value("serialNumber").toString());
}
foreach(QString name, listNames)
if(name.indexOf(new_SN, 0, Qt::CaseInsensitive) != -1)
selList.append(name);
/// What to do??????
}
To copy to clipboard, switch view to plain text mode
This slot must find index of item and set focus. Help me, please!
Bookmarks