#include "Dialog.h"
#include "GuiView.h"
+#include <QCloseEvent>
#include <QDialog>
namespace lyx {
namespace frontend {
-/** \c Dialog collects the different parts of a Model-Controller-View
- * split of a generic dialog together.
- */
class DialogView : public QDialog, public Dialog
{
public:
virtual QWidget const * asQWidget() const { return this; }
protected:
- /// Dialog inherited methods
+ /// \name Dialog inherited methods
//@{
void applyView() {}
bool initialiseParams(std::string const & /*data*/) { return true; }
void clearParams() {}
+ bool needBufferOpen() const { return isBufferDependent(); }
//@}
+ /// Any dialog that overrides this method should make sure to call it.
+ void closeEvent(QCloseEvent * ev)
+ {
+ clearParams();
+ Dialog::disconnect();
+ ev->accept();
+ }
+ /// Any dialog that overrides this method should make sure to call it.
+ void hideEvent(QHideEvent * ev)
+ {
+ if (!ev->spontaneous()) {
+ clearParams();
+ Dialog::disconnect();
+ ev->accept();
+ }
+ }
};
} // namespace frontend