Sandboxie/SandboxiePlus/MiscHelpers/Common/CheckableMessageBox.h

80 lines
2.6 KiB
C
Raw Normal View History

2020-06-01 17:11:56 +01:00
#ifndef CHECKABLEMESSAGEBOX_H
#define CHECKABLEMESSAGEBOX_H
#include <QDialogButtonBox>
2021-10-16 16:19:51 +01:00
#include <QMessageBox>
2020-06-01 17:11:56 +01:00
class CCheckableMessageBoxPrivate;
#include "../mischelpers_global.h"
class MISCHELPERS_EXPORT CCheckableMessageBox : public QDialog
{
Q_OBJECT
Q_PROPERTY(QString text READ text WRITE setText)
2020-12-07 16:34:20 +00:00
Q_PROPERTY(Qt::TextFormat textFormat READ textFormat WRITE setTextFormat)
2020-06-01 17:11:56 +01:00
Q_PROPERTY(QPixmap iconPixmap READ iconPixmap WRITE setIconPixmap)
Q_PROPERTY(bool isChecked READ isChecked WRITE setChecked)
Q_PROPERTY(QString checkBoxText READ checkBoxText WRITE setCheckBoxText)
Q_PROPERTY(QDialogButtonBox::StandardButtons buttons READ standardButtons WRITE setStandardButtons)
Q_PROPERTY(QDialogButtonBox::StandardButton defaultButton READ defaultButton WRITE setDefaultButton)
public:
explicit CCheckableMessageBox(QWidget *parent = NULL);
virtual ~CCheckableMessageBox();
static QDialogButtonBox::StandardButton
question(QWidget *parent,
const QString &title,
const QString &question,
const QString &checkBoxText,
bool *checkBoxSetting,
QDialogButtonBox::StandardButtons buttons = QDialogButtonBox::Yes|QDialogButtonBox::No,
QDialogButtonBox::StandardButton defaultButton = QDialogButtonBox::No,
QMessageBox::Icon icon = QMessageBox::Question);
QString text() const;
void setText(const QString &);
2021-10-16 16:19:51 +01:00
Qt::TextFormat textFormat() const;
2020-12-07 16:34:20 +00:00
void setTextFormat(Qt::TextFormat format);
2020-06-01 17:11:56 +01:00
bool isChecked() const;
void setChecked(bool s);
QString checkBoxText() const;
void setCheckBoxText(const QString &);
bool isCheckBoxVisible() const;
void setCheckBoxVisible(bool);
QDialogButtonBox::StandardButtons standardButtons() const;
void setStandardButtons(QDialogButtonBox::StandardButtons s);
QPushButton *button(QDialogButtonBox::StandardButton b) const;
QPushButton *addButton(const QString &text, QDialogButtonBox::ButtonRole role);
QDialogButtonBox::StandardButton defaultButton() const;
void setDefaultButton(QDialogButtonBox::StandardButton s);
// See static QMessageBox::standardPixmap()
QPixmap iconPixmap() const;
void setIconPixmap (const QPixmap &p);
// Query the result
QAbstractButton *clickedButton() const;
QDialogButtonBox::StandardButton clickedStandardButton() const;
// Conversion convenience
static QMessageBox::StandardButton dialogButtonBoxToMessageBoxButton(QDialogButtonBox::StandardButton);
private slots:
void slotClicked(QAbstractButton *b);
private:
CCheckableMessageBoxPrivate *d;
};
#endif // CHECKABLEMESSAGEBOX_H