Load up the data from the database
| 139 | |
| 140 | // Load up the data from the database |
| 141 | void NSearchView::loadData() { |
| 142 | NSqlQuery query(global.db); |
| 143 | query.exec("Select lid, name from SearchModel order by name"); |
| 144 | while (query.next()) { |
| 145 | qint32 lid = query.value(0).toInt(); |
| 146 | SearchTable table(global.db); |
| 147 | if (!table.isDeleted(lid)) { |
| 148 | NSearchViewItem *newWidget = new NSearchViewItem(); |
| 149 | newWidget->setData(NAME_POSITION, Qt::DisplayRole, query.value(1).toString()); |
| 150 | newWidget->setData(NAME_POSITION, Qt::UserRole, lid); |
| 151 | this->dataStore.insert(query.value(0).toInt(), newWidget); |
| 152 | root->addChild(newWidget); |
| 153 | } |
| 154 | } |
| 155 | query.finish(); |
| 156 | } |
| 157 | |
| 158 | |
| 159 | //************************************************************* |