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);
|
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()
|
void Player::actSetAnnotation()
|
||||||
{
|
{
|
||||||
QString oldAnnotation;
|
QString oldAnnotation;
|
||||||
|
@ -3257,15 +3267,18 @@ void Player::actSetAnnotation()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ok;
|
|
||||||
dialogSemaphore = true;
|
dialogSemaphore = true;
|
||||||
QString annotation = QInputDialog::getMultiLineText(game, tr("Set annotation"),
|
AnnotationDialog *dialog = new AnnotationDialog(game);
|
||||||
tr("Please enter the new annotation:"), oldAnnotation, &ok)
|
dialog->setOptions(QInputDialog::UsePlainTextEditForTextInput);
|
||||||
.left(MAX_NAME_LENGTH);
|
dialog->setWindowTitle(tr("Set annotation"));
|
||||||
|
dialog->setLabelText(tr("Please enter the new annotation:"));
|
||||||
|
dialog->setTextValue(oldAnnotation);
|
||||||
|
bool ok = dialog->exec();
|
||||||
dialogSemaphore = false;
|
dialogSemaphore = false;
|
||||||
if (clearCardsToDelete() || !ok) {
|
if (clearCardsToDelete() || !ok) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
QString annotation = dialog->textValue().left(MAX_NAME_LENGTH);
|
||||||
|
|
||||||
QList<const ::google::protobuf::Message *> commandList;
|
QList<const ::google::protobuf::Message *> commandList;
|
||||||
for (const auto &item : sel) {
|
for (const auto &item : sel) {
|
||||||
|
|
|
@ -477,4 +477,15 @@ public:
|
||||||
void setLastToken(CardInfoPtr cardInfo);
|
void setLastToken(CardInfoPtr cardInfo);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class AnnotationDialog : public QInputDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
void keyPressEvent(QKeyEvent *e) override;
|
||||||
|
|
||||||
|
public:
|
||||||
|
AnnotationDialog(QWidget *parent) : QInputDialog(parent)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue