--- wt-3.2.1/src/Wt/WDialog.C.orig +++ wt-3.2.1/src/Wt/WDialog.C @@ -177,12 +177,17 @@ WCompositeWidget::render(flags); } -void WDialog::rejectWhenEscapePressed() +void WDialog::rejectWhenEscapePressed(bool enable) { - WApplication::instance()->globalEscapePressed() - .connect(this, &WDialog::reject); + if (enable) { + escapeConnection1_ = WApplication::instance()->globalEscapePressed() + .connect(this, &WDialog::reject); - impl_->escapePressed().connect(this, &WDialog::reject); + escapeConnection2_ = impl_->escapePressed().connect(this, &WDialog::reject); + } else { + escapeConnection1_.disconnect(); + escapeConnection2_.disconnect(); + } } #ifndef WT_DEPRECATED_3_0_0