FixedAdding #1

Merged
danylo_nevidomiy merged 33 commits from FixedAdding into main 2025-02-12 21:46:46 +03:00
2 changed files with 33 additions and 5 deletions
Showing only changes of commit b3443bd64a - Show all commits

View File

@ -108,7 +108,7 @@
</rect>
</property>
<property name="text">
<string>Создать</string>
<string>Регистрация</string>
</property>
</widget>
<widget class="QPushButton" name="echoModButton">

View File

@ -569,6 +569,28 @@ void MainWindow::filterTables()
cardsModel->select();
recordsModel->setFilter(f);
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()
@ -730,7 +752,8 @@ void MainWindow::addRecordSlot(Record *r)
qDebug() << "id here:";
recordsModel->select();
QModelIndex index = ui->tableViewRecords->model()->index(0, 0);
filterTables();
QModelIndex index = ui->tableViewRecords->model()->index(0, 1);
ui->tableViewRecords->setCurrentIndex(index);
}
void MainWindow::addCardSlot(Card *r)
@ -740,7 +763,8 @@ void MainWindow::addCardSlot(Card *r)
qDebug() << "id here:";
cardsModel->select();
QModelIndex index = ui->tableViewCards->model()->index(0, 0);
filterTables();
QModelIndex index = ui->tableViewCards->model()->index(0, 1);
ui->tableViewCards->setCurrentIndex(index);
}
@ -974,13 +998,17 @@ void MainWindow::on_addDirectoryButton_clicked() //add papka
qDebug() << "newDir: " << newName;
query->exec();
directoriesModel->select();
QModelIndex index = ui->directoriesList->model()->index(0, 0);
ui->directoriesList->setCurrentIndex(index);
// QModelIndex index = ui->directoriesList->model()->index(0, 0);
// ui->directoriesList->setCurrentIndex(index);
}
void MainWindow::on_directoriesList_clicked(const QModelIndex &index)
{
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);
}