Subversion Repositories OpenInventory

Compare Revisions

Ignore whitespace Rev 119 → Rev 120

/trunk/DBViewer/database.cpp
465,10 → 465,31
void MainWindow::on_pushButton_2_clicked(){ // íàæàòèå êíîïêè "Óäàëèòü âûäåëåííûå îáúåêòû"
int i;
i++;
QModelIndex model_index;
QItemSelectionModel *selectionModel = ui->tableView->selectionModel();
QModelIndexList indexes = selectionModel->selectedIndexes();
QList<int> selectedRows;
selectedRows.clear();
foreach (model_index, indexes){ // ñïèñîê âñåõ âûäåëåííûõ ñòðîê
if (!selectedRows.contains(model_index.row()) && (model_index.column()==1)) selectedRows.append(model_index.row()); // îñòàâëÿåì â ñïèñêå òîëüêî âûáðàííûå â ïåðâîé êîëîíêå
 
}
qSort(selectedRows.begin(),selectedRows.end(), qGreater<int>()); // ñîðòèðóåì â îáðàòíîì ïîðÿäêå
 
 
for (int m =0; m < selectedRows.size(); ++m){
 
// ClassEditor::removeClass(selectedRows.at(m));
 
sql_mogel->removeRow(selectedRows.at(m));
 
}
sql_mogel->submitAll();
getDatabaseData();
 
}
 
 
void MainWindow::on_pushButton_3_clicked(){ // íàæàòèå êíîïêè "Ïðèìåíèòü"
int i;
i++;