There is another discussion on that matter in the developers corner.. so expect things to happen...
https://forum.freecadweb.org/viewtopic.php?f=10&t=30759
Moderator: agryson
It would appear to me that the perceived problem was already solved here:
That is indeed still open. The solved issue was an inconsistency. The bigger discussion from the beginning of this thread was to eliminate ESC from closing sketcher and assign some other key like Shift+Esc or Ctrl+Esc to close it.abdullah wrote: ↑Fri Sep 28, 2018 2:08 pmIt would appear to me that the perceived problem was already solved here:
https://forum.freecadweb.org/viewtopic. ... 20#p255406
Do we still know to strip the ESC from closing the Sketcher?
Code: Select all
/*! \reimp */
void QDialog::keyPressEvent(QKeyEvent *e)
{
// Calls reject() if Escape is pressed. Simulates a button
// click for the default button if Enter is pressed. Move focus
// for the arrow keys. Ignore the rest.
if (e->matches(QKeySequence::Cancel)) {
reject();
} else
if (!e->modifiers() || (e->modifiers() & Qt::KeypadModifier && e->key() == Qt::Key_Enter)) {
switch (e->key()) {
case Qt::Key_Enter:
case Qt::Key_Return: {
QList<QPushButton*> list = findChildren<QPushButton*>();
for (int i=0; i<list.size(); ++i) {
QPushButton *pb = list.at(i);
if (pb->isDefault() && pb->isVisible()) {
if (pb->isEnabled())
pb->click();
return;
}
}
}
break;
default:
e->ignore();
return;
}
} else {
e->ignore();
}
}
You make a compelling argument - given that convention we probably should not mess with it.wmayer wrote: ↑Sat Sep 29, 2018 11:12 amJust create a dialog with Qt Designer and change the dialog button box to have only the OK button. Invoke the dialog and press ESC. The dialog will still disappear. The reason for this behaviour is that in QDialog::keyPressEvent it's not needed that a button with "reject role" must be present.