add dialog title setter, set focus on last changed element

This commit is contained in:
kvazar-network 2024-05-10 06:36:46 +03:00
parent 9ce6743227
commit 618dac55c8
3 changed files with 20 additions and 0 deletions

View File

@ -28,11 +28,24 @@ KevaAddKeyDialog::~KevaAddKeyDialog()
delete ui; delete ui;
} }
void KevaAddKeyDialog::setTitle(const QString &value)
{
setWindowTitle(
value
);
}
void KevaAddKeyDialog::setKey(const QString &value) void KevaAddKeyDialog::setKey(const QString &value)
{ {
ui->keyText->setEnabled(
true
);
ui->keyText->setText( ui->keyText->setText(
value value
); );
ui->keyText->setFocus();
} }
void KevaAddKeyDialog::setValue(const QString &value) void KevaAddKeyDialog::setValue(const QString &value)
@ -40,6 +53,8 @@ void KevaAddKeyDialog::setValue(const QString &value)
ui->valueText->setPlainText( ui->valueText->setPlainText(
value value
); );
ui->valueText->setFocus();
} }
void KevaAddKeyDialog::create() void KevaAddKeyDialog::create()

View File

@ -34,6 +34,7 @@ private:
public Q_SLOTS: public Q_SLOTS:
void create(); void create();
void cancel(); void cancel();
void setTitle(const QString& value);
void setKey(const QString& value); void setKey(const QString& value);
void setValue(const QString& value); void setValue(const QString& value);
void onKeyChanged(const QString& key); void onKeyChanged(const QString& key);

View File

@ -325,6 +325,10 @@ void KevaDialog::on_updateButton_clicked()
for (const QModelIndex& index : ui->kevaView->selectionModel()->selectedRows()) for (const QModelIndex& index : ui->kevaView->selectionModel()->selectedRows())
{ {
dialog->setTitle(
"Create new record for this key"
);
dialog->setKey( dialog->setKey(
index.sibling( index.sibling(
index.row(), index.row(),