ESC button in Sketch
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
- HarryGeier
- Veteran
- Posts: 1231
- Joined: Mon Jul 10, 2017 12:36 pm
- Location: Hof Germany
Re: ESC button in Sketch
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
https://forum.freecadweb.org/viewtopic.php?f=10&t=30759
Kaum macht man´s richtig , gehts´s
My Video Tutorials on Youtube: https://www.youtube.com/channel/UCoe3B ... p8Q/videos
My FreeCAD Stuff on Hidrive: https://my.hidrive.com/share/qr3l1yddy6#$/
My Video Tutorials on Youtube: https://www.youtube.com/channel/UCoe3B ... p8Q/videos
My FreeCAD Stuff on Hidrive: https://my.hidrive.com/share/qr3l1yddy6#$/
Re: ESC button in Sketch
ESC used to close SKETCH here is uneeded and a slight pain!
Alt-C or the CLOSE button are sufficient!
Alt-C or the CLOSE button are sufficient!
Re: ESC button in Sketch
But it's standard behaviour that with ESC you close/cancel a dialog.
Re: ESC button in Sketch
That's exactly the point with sketcher. for every action done in a workbench, the sketch is the only one what have a action in a action.
if creating a feature in part design i get into a body but a body don't have a dialog and don't need it. so when creating a extrude it is only possible to go out of the extrude. after that it is finished.
If create a sketch a dialog opens what is nice because it gives more info other cad software don't give... then i create a line it opens a dialog (too).
when canceling the line it shouldn't cancel the sketch at all... but that is what happens when canceling is slow or fails the first (number of) times
I would almost say the sketcher is the only feature what is his workbench...
that's why the sketcher need some special treatment!!
if creating a feature in part design i get into a body but a body don't have a dialog and don't need it. so when creating a extrude it is only possible to go out of the extrude. after that it is finished.
If create a sketch a dialog opens what is nice because it gives more info other cad software don't give... then i create a line it opens a dialog (too).
when canceling the line it shouldn't cancel the sketch at all... but that is what happens when canceling is slow or fails the first (number of) times
I would almost say the sketcher is the only feature what is his workbench...
that's why the sketcher need some special treatment!!
Re: ESC button in Sketch
Note that I posted PR-1656, it does not change the behaviour of Escape, so that discussion is still ongoing.
What it does though is ensure that the Sketcher behaves the same if one has just clicked on a tool in the task bar or not. So if one presses the "Create a rectangle" tool and then immediately press Escape - then the tool gets cancelled, not the entire Sketcher. This is the same behaviour as if one had actually used the tool to create a rectangle (or two) and then press Escape.
What it does though is ensure that the Sketcher behaves the same if one has just clicked on a tool in the task bar or not. So if one presses the "Create a rectangle" tool and then immediately press Escape - then the tool gets cancelled, not the entire Sketcher. This is the same behaviour as if one had actually used the tool to create a rectangle (or two) and then press Escape.
Re: ESC button in Sketch
It 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?
Re: ESC button in Sketch
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 pm It 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?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: ESC button in Sketch
One could argue that, because there isn't actually a "Cancel" from the sketcher - the only valid exit would be "OK" with its "Enter" shortcut - because regardless of what you do, your changes are already applied and will remain applied.
Re: ESC button in Sketch
Just 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.
So, the current behaviour of the task panel is the same as with Qt's implementation and IMO we shouldn't change it. And when especially talking about the sketcher dialog then we even have the "Close" button (i.e. a button with reject role) so that a user must expect that when clicking on the dialog and pressing ESC will close it. Using some non-standard key combinations like Shift+ESC or Ctrl+ESC would be quite confusing. Especially Ctrl+ESC is already reserved on Windows to open the Start menu.
Now, the likelihood that someone closes the sketcher by accident has reduced a lot with mlampert's PR because the 3d viewer will have the focus and not the dialog any more.
Btw, in sliptonic's video he exactly complained about the opposite. When using the transform tool then there is an OK but not a Close/Cancel button and he complained that when pressing ESC the dialog didn't disappear.
So, the current behaviour of the task panel is the same as with Qt's implementation and IMO we shouldn't change it. And when especially talking about the sketcher dialog then we even have the "Close" button (i.e. a button with reject role) so that a user must expect that when clicking on the dialog and pressing ESC will close it. Using some non-standard key combinations like Shift+ESC or Ctrl+ESC would be quite confusing. Especially Ctrl+ESC is already reserved on Windows to open the Start menu.
Now, the likelihood that someone closes the sketcher by accident has reduced a lot with mlampert's PR because the 3d viewer will have the focus and not the dialog any more.
Btw, in sliptonic's video he exactly complained about the opposite. When using the transform tool then there is an OK but not a Close/Cancel button and he complained that when pressing ESC the dialog didn't disappear.
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();
}
}
Re: ESC button in Sketch
You make a compelling argument - given that convention we probably should not mess with it.wmayer wrote: ↑Sat Sep 29, 2018 11:12 am Just 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.