#pragma once #include "lts_frameless_dialog.h" #include "lts_message_dialog.h" #include #include #include class QPushButton; class QHBoxLayout; namespace LtsWidgets { /** * @brief The LtsMessageDialogHelper class cannot be exported and only is a helper class which is actually instantiated, shows the LtsMessageDialog. * To provide the blocking call to showMessage (call with return type), an event loop is created and exited when the user has selected a button to close the dialog. * If the behaviour is non-modal, closing the Dialog by clicking outside of it will return Button::Cancel. */ class LtsMessageDialogHelper : public QObject { Q_OBJECT public: explicit LtsMessageDialogHelper(QObject *parent = nullptr); ~LtsMessageDialogHelper() = default; Button showMessage(QWidget *parent, const QString &message, const QString &title, Behaviour behaviour, LtsWidgets::Buttons buttons, const QHash &buttonTexts); private: QPushButton *addButton(const QString &text, QHBoxLayout *thatLayout, LtsFramelessDialog *dialog, const Button &button, QWidget *parent); Button m_result; LtsFramelessDialog *m_dialog; private slots: void slotOkay(); void slotYes(); void slotNo(); void slotCancel(); void slotApply(); void slotDiscard(); signals: void signalQuitEventLoop(); }; } // namespace LtsWidgets