Skip to content

Commit

Permalink
add cancel button to option dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
sunderme committed Apr 21, 2024
1 parent 6a5ed4a commit bbd2a86
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/aichatassistant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,14 +312,19 @@ void AIChatAssistant::slotOptions()
hl2->addWidget(cbStream);
ly->addLayout(hl2);

auto *btOk=new QPushButton(tr("OK"));
connect(btOk,&QPushButton::clicked,[&](){
auto *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok
| QDialogButtonBox::Cancel);

connect(buttonBox, &QDialogButtonBox::accepted,[&](){
config->ai_systemPrompt=leSystemPrompt->toPlainText();
config->ai_temperature=leTemp->text();
config->ai_streamResults=cbStream->isChecked();
dlg.close();
});
ly->addWidget(btOk);
connect(buttonBox, &QDialogButtonBox::rejected, [&](){
dlg.close();
});
ly->addWidget(buttonBox);
dlg.setLayout(ly);
dlg.exec();
}
Expand Down

0 comments on commit bbd2a86

Please sign in to comment.