UI: Add Okay/Cancel Buttons to Properties Dialog
Use QDialogButtonBox to add "Okay" and "Cancel" buttons to the properties dialog. The core functionality of the dialog is not changed; I.E. the settings are still applied to the source as the user changes them. If the user clicks "Okay", the dialog simply exits. If the user clicks "Cancel", the original settings are reapplied to the source then the dialog exits. If the window is closed by any other means (I.E. by the main obs window closing) then the properties dialog prompts the user if they changed anything and asks if they wish to save their settings. In order to implement this last feature, a method of checking for open dialogs and sending each a quit message is added to the closeEvent() method for OBSBasic.
This commit is contained in:
parent
d54b3cc8c0
commit
2152b40e68
4 changed files with 95 additions and 3 deletions
|
|
@ -1536,6 +1536,16 @@ void OBSBasic::closeEvent(QCloseEvent *event)
|
|||
if (!event->isAccepted())
|
||||
return;
|
||||
|
||||
/* Check all child dialogs and ensure they run their proper closeEvent
|
||||
* methods before exiting the application. Otherwise Qt doesn't send
|
||||
* the proper QCloseEvent messages. */
|
||||
QList<QDialog*> childDialogs = this->findChildren<QDialog *>();
|
||||
if (!childDialogs.isEmpty()) {
|
||||
for (int i = 0; i < childDialogs.size(); ++i) {
|
||||
childDialogs.at(i)->close();
|
||||
}
|
||||
}
|
||||
|
||||
// remove draw callback in case our drawable surfaces go away before
|
||||
// the destructor gets called
|
||||
obs_remove_draw_callback(OBSBasic::RenderMain, this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue