add ctrl enter as shortcut for ok when setting annotation (#4929)
This commit is contained in:
parent
4acc8bfe80
commit
28f80e18a0
2 changed files with 28 additions and 4 deletions
|
@ -3246,6 +3246,16 @@ void Player::actFlowT()
|
|||
actIncPT(-1, 1);
|
||||
}
|
||||
|
||||
void AnnotationDialog::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Return && event->modifiers() & Qt::ControlModifier) {
|
||||
event->accept();
|
||||
accept();
|
||||
return;
|
||||
}
|
||||
QInputDialog::keyPressEvent(event);
|
||||
}
|
||||
|
||||
void Player::actSetAnnotation()
|
||||
{
|
||||
QString oldAnnotation;
|
||||
|
@ -3257,15 +3267,18 @@ void Player::actSetAnnotation()
|
|||
}
|
||||
}
|
||||
|
||||
bool ok;
|
||||
dialogSemaphore = true;
|
||||
QString annotation = QInputDialog::getMultiLineText(game, tr("Set annotation"),
|
||||
tr("Please enter the new annotation:"), oldAnnotation, &ok)
|
||||
.left(MAX_NAME_LENGTH);
|
||||
AnnotationDialog *dialog = new AnnotationDialog(game);
|
||||
dialog->setOptions(QInputDialog::UsePlainTextEditForTextInput);
|
||||
dialog->setWindowTitle(tr("Set annotation"));
|
||||
dialog->setLabelText(tr("Please enter the new annotation:"));
|
||||
dialog->setTextValue(oldAnnotation);
|
||||
bool ok = dialog->exec();
|
||||
dialogSemaphore = false;
|
||||
if (clearCardsToDelete() || !ok) {
|
||||
return;
|
||||
}
|
||||
QString annotation = dialog->textValue().left(MAX_NAME_LENGTH);
|
||||
|
||||
QList<const ::google::protobuf::Message *> commandList;
|
||||
for (const auto &item : sel) {
|
||||
|
|
|
@ -477,4 +477,15 @@ public:
|
|||
void setLastToken(CardInfoPtr cardInfo);
|
||||
};
|
||||
|
||||
class AnnotationDialog : public QInputDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
void keyPressEvent(QKeyEvent *e) override;
|
||||
|
||||
public:
|
||||
AnnotationDialog(QWidget *parent) : QInputDialog(parent)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue