#pragma once #include #include "nglwidgets_export.h" class NGLWIDGETS_EXPORT NGLStandardButton : public QPushButton { Q_OBJECT Q_PROPERTY(StandardButton standardButton READ type WRITE setType) Q_PROPERTY(qint32 layoutPriority READ layoutPriority WRITE setLayoutPriority) public: enum StandardButton { NoButton = 0x00000000, Ok = 0x00000001, Save = 0x00000002, Open = 0x00000004, Yes = 0x00000008, No = 0x00000010, Close = 0x00000020, Cancel = 0x00000040, Help = 0x00000080, Apply = 0x00000100, Reset = 0x00000200, Print = 0x00000400, Add = 0x00000800, Remove = 0x00002000, Edit = 0x00008000, Send = 0x00010000, New = 0x00020000, Delete = 0x00040000, Download = 0x00080000, Library = 0x00100000, Show = 0x00200000, ZoomIn = 0x00400000, ZoomOut = 0x00800000, Modify = 0x01000000, Hide = 0x02000000, #ifndef Q_MOC_RUN FirstButton = Ok, LastButton = Hide #endif }; Q_ENUM(StandardButton) Q_DECLARE_FLAGS(StandardButtons, StandardButton) Q_FLAG(StandardButtons) explicit NGLStandardButton(QWidget *parent = nullptr); explicit NGLStandardButton(StandardButton type, QWidget *parent = nullptr); StandardButton type() const; void setType(StandardButton t); void setLayoutPriority(qint32 priority); virtual qint32 layoutPriority() const; QList actions() const; void setDefaultText(const char *text); void setDefaultToolTip(const char *toolTip); protected: StandardButton m_type; qint32 m_layoutPriority; QByteArray m_defaultText; QByteArray m_defaultToolTip; QList m_actionList; virtual void changeEvent(QEvent *e); private: void init(); }; Q_DECLARE_OPERATORS_FOR_FLAGS(NGLStandardButton::StandardButtons)