Bug: when closing Variables Table with escape key it cannot be reopened

This is on the latest tip (c497f4b1). Just open any pattern, use Ctrl-T to open the variables table. Then press escape. Now you cannot open the Variables Table anymore. If you close the dialog with Alt-F4, it works fine.

Ubuntu 18.04, Qt 5.9.

It also happens for me with the AppImage I downloaded the other day:

DEBUG:Build revision: Git:c403baf205f0
DEBUG:"Based on Qt 5.13.2 (GCC 7.5.0, 64 bit)"
DEBUG:Built on Aug  3 2020 at 00:37:47

No log messages. It displays “Showing variables” when it works, but nothing when it doesn’t work.

A quick Google tells by pressing Escape triggers the “reject()” call. In many other dialogs it does something with this, but dialogincrements doesn’t. Maybe related?


Hmmm… the ESQ key closes the window, but does not trigger the closeEvent signal - like with clicking the X on the title bar or clicking OK does. DialogIncrements overrides closeEvent() method and in it the signal DialogClosed is emitted:

emit DialogClosed(QDialog::Accepted);

which is connected in mainWindow:

connect(dialogTable.data(), &DialogIncrements::DialogClosed, this, [ this ]() { ui->actionTable->setChecked(false); delete dialogTable; })

Problem is since hitting ESQ emits rejected(), but does not emit the eventClose signal - the ui->actionTable is never reset to setChecked(false) and the dialog deleted. As far as the program is concerned the dialog window is still open so it won’t open / show the dialog again.

have to handle the rejected() signal… could try adding:

connect(dialogTable.data(), &DialogIncrements::rejected, this, [ this ]() { ui->actionTable->setChecked(false); delete dialogTable; })

…just a guess.


I can confirm that this fixes the problem.


Here’s the build with @Douglas’s code fix, can you all test if this fixed the problem for you?


@Douglas, does using the “x” in the upper right corner to close the window instead of exiting also trigger the rejected() signal and not the eventClose?

1 Like

That fixes it over here in Focal Fossa

1 Like

Clicking the X in the title bar acts as if you clicked OK - if it were there - and still emits the eventClose(). Nothing changes there. In other words if you added increments - hitting the X will save the changes.

Maybe It would make a bit more sense to add an OK and Cancel button along with the Refresh button?


Actually, that would make sense to me, but it might be a lot of work to do that throughout the program.


It’s just the Variables Table dialog that is missing the OK / Cancel buttons. It only has a Refresh button (which is a topic for another discussion). Not sure why it only relies on the Close X to save and close the dialog? Most all the others have OK / Cancel / Apply like:


The Variables table has a Refresh button because it is non modal and the dialog is not connected to automatically update from any changes in other tools. Changing THAT behavior so it automatically updates would be a lot of work.

With all the other dialogs clicking OK is the same as clicking the X (save & close). Cancel is like ESQ (rejected) - or do not save & close… Apply, applies the changes to the drawing without closing.