void ConfigGadgetWidget::tabAboutToChange(int index, bool *proceed) { Q_UNUSED(index); *proceed = true; ConfigTaskWidget *wid = qobject_cast<ConfigTaskWidget *>(stackWidget->currentWidget()); if (!wid) { return; } if (wid->isDirty()) { int ans = QMessageBox::warning(this, tr("Unsaved changes"), tr("The tab you are leaving has unsaved changes, " "if you proceed they will be lost.\n" "Do you still want to proceed?"), QMessageBox::Yes, QMessageBox::No); if (ans == QMessageBox::No) { *proceed = false; } else { wid->setDirty(false); } } }