17 #include <QApplication>
20 #include <QMessageBox>
27 Qt::WindowFlags flags )
28 : QDialog(parent, flags), m_associatedWin(nullptr), m_processing(false) {}
35 "[ccOverlayDialog] Can't change associated window while "
36 "running/displayed!");
48 QWidgetList topWidgets = QApplication::topLevelWidgets();
49 foreach (QWidget* widget, topWidgets) {
50 widget->removeEventFilter(
this);
62 QWidgetList topWidgets = QApplication::topLevelWidgets();
63 foreach (QWidget* widget, topWidgets) {
64 widget->installEventFilter(
this);
103 if (QMessageBox::question(
104 this, tr(
"Quit"), tr(
"Are you sure you want to quit dialog?"),
105 QMessageBox::Ok, QMessageBox::Cancel) == QMessageBox::Cancel) {
119 if (e->type() == QEvent::KeyPress) {
120 QKeyEvent* keyEvent =
static_cast<QKeyEvent*
>(e);
126 return QDialog::eventFilter(obj, e);
129 if (e->type() == QEvent::Show) {
134 return QDialog::eventFilter(obj, e);
static bool Warning(const char *format,...)
Prints out a formatted warning message in console.
ccOverlayDialog(QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::FramelessWindowHint|Qt::Tool)
Default constructor.
void shown()
Signal emitted when a 'show' event is detected.
void shortcutTriggered(int key)
Signal emitted when an overridden key shortcut is pressed.
virtual void onLinkedWindowDeletion(QObject *object=nullptr)
Slot called when the linked window is deleted (calls 'onClose')
virtual void stop(bool accepted)
Stops process/dialog.
QList< int > m_overriddenKeys
Overridden keys.
virtual bool start()
Starts process.
bool m_processing
Running/processing state.
void processFinished(bool accepted)
Signal emitted when process is finished.
QWidget * m_associatedWin
Associated (MDI) window.
~ccOverlayDialog() override
Destructor.
virtual bool linkWith(QWidget *win)
Links the overlay dialog with a MDI window.
bool eventFilter(QObject *obj, QEvent *e) override
void addOverridenShortcut(Qt::Key key)