Subversion Repositories OpenInventory

Compare Revisions

Ignore whitespace Rev 220 → Rev 221

/trunk/DBViewer/database.cpp
816,10 → 816,10
QString model_id;
class_id = ui->treeWidget->currentItem()->text(1);
model_id = ui->treeWidget->currentItem()->text(6);
int row = filtr_model->rowCount();
filtr_model->insertRows(row, 1);
filtr_model->setData(filtr_model->index(row, 1), QVariant(model_id), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "Model ID"
filtr_model->setData(filtr_model->index(row, 2), QVariant(class_id), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "Class ID"
int row = filter_model->rowCount();
filter_model->insertRows(row, 1);
filter_model->setData(filter_model->index(row, 1), QVariant(model_id), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "Model ID"
filter_model->setData(filter_model->index(row, 2), QVariant(class_id), Qt::EditRole); // ïðèñâàèâàåì íîâîå çíà÷åíèå ïîëþ "Class ID"
ui->pushButton_11->setEnabled(true);
ui->pushButton_12->setEnabled(true);
 
827,17 → 827,42
 
void MainWindow::on_pushButton_10_clicked()// íàæàòèå êíîïêè "Óäàëèòü ôèëüòð" (íà âêëàäêå ôèëüòðîâ)
{
QModelIndex model_index;
QItemSelectionModel *selectionModel = ui->tableView_3->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));
 
filter_model->removeRow(selectedRows.at(m));
 
}
filter_model->submitAll();
// getDatabaseData();
 
}
 
void MainWindow::on_pushButton_11_clicked()// íàæàòèå êíîïêè "Ïðèìåíèòü" (íà âêëàäêå ôèëüòðîâ)
{
filtr_model->submitAll();
filter_model->submitAll();
ui->pushButton_11->setEnabled(false);
ui->pushButton_12->setEnabled(false);
}
 
void MainWindow::on_pushButton_12_clicked()// íàæàòèå êíîïêè "Ñáðîñèòü èçìåíåíèÿ" (íà âêëàäêå ôèëüòðîâ)
{
 
filter_model->select();
ui->pushButton_11->setEnabled(false);
ui->pushButton_12->setEnabled(false);
}
 
 
870,6 → 895,19
}
 
 
 
 
void MainWindow::on_filter_model_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ) // èçìåíèëè ñâîéñòâà ôèëüòðà èëè äîáàâèëè íîâûé ôèëüòð
 
{
ui->pushButton_11->setEnabled(true);
ui->pushButton_12->setEnabled(true);
}
 
 
 
 
 
// ïîëó÷àåì ñïèñîê âñåõ ïîëåé-óêàçàòåëåé, â êà÷åñòâå êëþ÷åé ïîëó÷èì èìåíà ïîëåé-óêàçàòåëåé
// â êà÷åñòâå çíà÷åíèé ïîëó÷èì ñïèñîê òàáëèö-õðàíèëèù îáúåêòîâ ðîäèòåëüñêèõ êëàññîâ