mirror of
https://github.com/obsproject/obs-studio.git
synced 2026-09-24 23:31:36 +08:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user