87 lines
1.8 KiB
C++
Executable File
87 lines
1.8 KiB
C++
Executable File
#pragma once
|
|
|
|
#include "lts_widgets_export.h"
|
|
#include "lts_frameless_dialog.h"
|
|
|
|
#include <QString>
|
|
#include <QHash>
|
|
|
|
|
|
class QWidget;
|
|
class QHBoxLayout;
|
|
|
|
|
|
namespace LtsWidgets
|
|
{
|
|
|
|
|
|
|
|
enum class Button
|
|
{
|
|
UNKNOWN = 0,
|
|
Ok = 1,
|
|
Yes = 2,
|
|
No = 4,
|
|
Cancel = 8,
|
|
|
|
Apply = 16,
|
|
Discard = 32,
|
|
};
|
|
Q_DECLARE_FLAGS(Buttons, Button)
|
|
inline uint qHash(LtsWidgets::Button b)
|
|
{
|
|
return ::qHash(static_cast<int>(b));
|
|
}
|
|
|
|
|
|
|
|
namespace LtsMessageDialog
|
|
{
|
|
|
|
|
|
LTSWIDGETS_EXPORT Button showMessage(QWidget* parent,
|
|
const QString &message,
|
|
const QString &title = QString(),
|
|
const Behaviour behaviour = Behaviour::Modal,
|
|
const Buttons buttons = Button::Ok,
|
|
const QHash<Button, QString> &buttonTexts = QHash<Button, QString>());
|
|
LTSWIDGETS_EXPORT Button askApplyDiscardCancel(QWidget *parent);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
class LTSWIDGETS_EXPORT LtsMessageDialogNew : public QObject
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit LtsMessageDialogNew(QWidget* parent,
|
|
const QString &message,
|
|
const QString &title = QString(),
|
|
const Behaviour behaviour = Behaviour::Modal,
|
|
const Buttons buttons = Button::Ok,
|
|
const QHash<Button, QString> &buttonTexts = QHash<Button, QString>(),
|
|
bool deleteOnClose = true );
|
|
|
|
private:
|
|
LtsFramelessDialog *m_dialog;
|
|
|
|
QPushButton *addButton(const QString &text, QHBoxLayout *thatLayout, LtsFramelessDialog *dialog, const Button &button, QWidget *parent);
|
|
|
|
|
|
signals:
|
|
void ok();
|
|
void yes();
|
|
void no();
|
|
void apply();
|
|
void discard();
|
|
void cancel();
|
|
|
|
};
|
|
|
|
}
|
|
|
|
Q_DECLARE_OPERATORS_FOR_FLAGS(LtsWidgets::Buttons)
|