230,31 → 230,8 |
ui->tableView->hideColumn(3); |
ui->tableView->hideColumn(2); |
|
ui->tableView_2->hideColumn(0); |
ui->tableView_2->hideColumn(5); |
ui->tableView_2->hideColumn(2); |
|
currIndexOfClassesTable = modelForDescription->index(0, 1); |
QModelIndex index_temp; |
|
currClassID = mymodel->data(mymodel->index(0,0)).toString(); |
QItemSelectionModel *selectionModel = ui->tableView->selectionModel(); |
|
QModelIndex topLeft; |
QModelIndex bottomRight; |
|
topLeft = mymodel->index(0, 0, QModelIndex()); |
bottomRight = mymodel->index(0, 1, QModelIndex()); |
|
QItemSelection selection(topLeft, bottomRight); |
selectionModel->select(selection, QItemSelectionModel::Select); |
|
|
|
//connect(ui->tableView, SIGNAL(clicked(const QModelIndex)), this, SLOT(on_tableView_clicked(const QModelIndex))); |
connect(mymodel, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_myModel_dataChanged(QModelIndex,QModelIndex))); |
connect(modelForDescription, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(on_modelForDescription_dataChanged(QModelIndex,QModelIndex))); |
|
} |
|
|
351,30 → 328,6 |
} |
|
|
void ClassEditor::addNewField(){ |
// QSqlRecord rec = mymodel->record(1); |
//bool ok; |
//ok = rec.isEmpty(); |
//QString currientClassID; |
//currientClassID = rec.value(1).toString(); |
int row = modelForDescription->rowCount(); |
modelForDescription->insertRows(row, 1); |
modelForDescription->setData(modelForDescription->index(row, 5), QVariant(currClassID), Qt::EditRole); |
modelForDescription->setData(modelForDescription->index(row, 4), QVariant(tr("NULL")), Qt::EditRole); |
|
modelForDescription->submitAll(); |
} |
|
|
|
|
|
|
|
|
|
|
|
void ClassEditor::on_pushButton_clicked(){ |
//int i; |
//i++; |
390,17 → 343,14 |
i++; |
row = index.row(); |
column = index.column(); |
currIndexOfClassesTable = index; |
QModelIndex index_tmp; |
QModelIndex index_tmp; |
QString tmp_str, filter_str; |
index_tmp = ui->tableView->model()->index(row, 0); |
tmp_str = ui->tableView->model()->data(index_tmp).toString(); |
currClassID = tmp_str; |
// ui->label->setText(QVariant(currIndexOfClassesTable.row()).toString()); |
//ui->label->setText(tmp_str); |
filter_str = tr("ClassIdentifer = "); |
filter_str.append(tmp_str); |
modelForDescription->setFilter(filter_str); |
ui->tableView_2->resizeColumnsToContents(); |
i++; |
} |
|
415,30 → 365,8 |
void ClassEditor::on_pushButton_3_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Íîâîå ïîëå" |
int i; |
i++; |
ClassEditor::addNewField(); |
ClassEditor::modelForDescription->select(); |
} |
void ClassEditor::on_pushButton_4_clicked(){ // îáðàáîò÷èê íàæàòèÿ êíîïêè "Óäàëèòü ïîëå" |
int i; |
i++; |
QModelIndex model_index; |
QItemSelectionModel *selectionModel = ui->tableView->selectionModel(); |
QModelIndexList indexes = selectionModel->selectedIndexes(); |
//model_index = mymodel->selec; |
//modelList = ui->tableView->SelectItems; |
i = indexes.size(); |
|
if (i > 0) model_index = indexes.at(0); |
i++; |
} |
|
|
void ClassEditor::on_myModel_dataChanged( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ |
int i; |
i++; |
ui->tableView->resizeColumnsToContents(); |
} |
|
void ClassEditor::on_modelForDescription_dataChanged ( const QModelIndex & topLeft, const QModelIndex & bottomRight ){ |
ui->tableView_2->resizeColumnsToContents(); |
} |