Bad fix of tables selection
This commit is contained in:
parent
8e6b4f9f38
commit
b3443bd64a
@ -108,7 +108,7 @@
|
|||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Создать</string>
|
<string>Регистрация</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="echoModButton">
|
<widget class="QPushButton" name="echoModButton">
|
||||||
|
|||||||
@ -569,6 +569,28 @@ void MainWindow::filterTables()
|
|||||||
cardsModel->select();
|
cardsModel->select();
|
||||||
recordsModel->setFilter(f);
|
recordsModel->setFilter(f);
|
||||||
recordsModel->select();
|
recordsModel->select();
|
||||||
|
QModelIndex index = recordsModel->index(0, 1);
|
||||||
|
|
||||||
|
if(recordsModel->data(index, Qt::DisplayRole).toString().isEmpty())
|
||||||
|
{
|
||||||
|
ui->pushButton_8->setEnabled(false);
|
||||||
|
ui->pushButton_4->setEnabled(false);
|
||||||
|
ui->pushButton_9->setEnabled(false);
|
||||||
|
ui->pushButton_12->setEnabled(false);
|
||||||
|
ui->deleteButton->setEnabled(false);
|
||||||
|
ui->deleteButton_3->setEnabled(false);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->pushButton_8->setEnabled(true);
|
||||||
|
ui->pushButton_4->setEnabled(true);
|
||||||
|
ui->pushButton_9->setEnabled(true);
|
||||||
|
ui->pushButton_12->setEnabled(true);
|
||||||
|
ui->deleteButton->setEnabled(true);
|
||||||
|
ui->deleteButton_3->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
void MainWindow::enableButtons()
|
void MainWindow::enableButtons()
|
||||||
@ -730,7 +752,8 @@ void MainWindow::addRecordSlot(Record *r)
|
|||||||
qDebug() << "id here:";
|
qDebug() << "id here:";
|
||||||
|
|
||||||
recordsModel->select();
|
recordsModel->select();
|
||||||
QModelIndex index = ui->tableViewRecords->model()->index(0, 0);
|
filterTables();
|
||||||
|
QModelIndex index = ui->tableViewRecords->model()->index(0, 1);
|
||||||
ui->tableViewRecords->setCurrentIndex(index);
|
ui->tableViewRecords->setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
void MainWindow::addCardSlot(Card *r)
|
void MainWindow::addCardSlot(Card *r)
|
||||||
@ -740,7 +763,8 @@ void MainWindow::addCardSlot(Card *r)
|
|||||||
qDebug() << "id here:";
|
qDebug() << "id here:";
|
||||||
|
|
||||||
cardsModel->select();
|
cardsModel->select();
|
||||||
QModelIndex index = ui->tableViewCards->model()->index(0, 0);
|
filterTables();
|
||||||
|
QModelIndex index = ui->tableViewCards->model()->index(0, 1);
|
||||||
ui->tableViewCards->setCurrentIndex(index);
|
ui->tableViewCards->setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -974,13 +998,17 @@ void MainWindow::on_addDirectoryButton_clicked() //add papka
|
|||||||
qDebug() << "newDir: " << newName;
|
qDebug() << "newDir: " << newName;
|
||||||
query->exec();
|
query->exec();
|
||||||
directoriesModel->select();
|
directoriesModel->select();
|
||||||
QModelIndex index = ui->directoriesList->model()->index(0, 0);
|
// QModelIndex index = ui->directoriesList->model()->index(0, 0);
|
||||||
ui->directoriesList->setCurrentIndex(index);
|
// ui->directoriesList->setCurrentIndex(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_directoriesList_clicked(const QModelIndex &index)
|
void MainWindow::on_directoriesList_clicked(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
enableButtons();
|
enableButtons();
|
||||||
|
QModelIndex recin = ui->tableViewRecords->model()->index(0, 1);
|
||||||
|
ui->tableViewRecords->setCurrentIndex(recin);
|
||||||
|
QModelIndex cardin = ui->tableViewRecords->model()->index(0, 1);
|
||||||
|
ui->tableViewRecords->setCurrentIndex(cardin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user