#pragma once #include #include #include "nglwidgets_export.h" #include "nglstandardbutton.h" class QFrame; class NGLWIDGETS_EXPORT NGLDialogButtonBox : public QWidget { Q_OBJECT Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) Q_PROPERTY(NGLStandardButton::StandardButtons standardButtons READ standardButtons WRITE setStandardButtons) Q_PROPERTY(bool m_bLineVisible READ lineVisible WRITE setLineVisible) public: explicit NGLDialogButtonBox(QWidget *parent = nullptr); explicit NGLDialogButtonBox(Qt::Orientation orientation, QWidget *parent = nullptr); NGLDialogButtonBox(NGLStandardButton::StandardButtons buttons, Qt::Orientation orientation = Qt::Horizontal, QWidget *parent = nullptr); Qt::Orientation orientation() const; void setOrientation(Qt::Orientation orientation); NGLStandardButton::StandardButtons standardButtons() const; void setStandardButtons(NGLStandardButton::StandardButtons buttons); void addButton(NGLStandardButton *button); NGLStandardButton *addButton(NGLStandardButton::StandardButton button); NGLStandardButton *button(NGLStandardButton::StandardButton button); void removeFromActionList(NGLStandardButton::StandardButton button); bool setEnabled(NGLStandardButton::StandardButton button, bool enable); bool isEnabled(NGLStandardButton::StandardButton button); bool lineVisible() const; void setLineVisible(bool bVisible); bool setVisible(NGLStandardButton::StandardButton button, bool visible); void setVisible(bool visible) { QWidget::setVisible(visible); } void enableExport(bool ena); void enableImport(bool ena); public Q_SLOTS: void layoutPriorityChanged(); Q_SIGNALS: void clicked(NGLStandardButton *button); void onOk(); void onSend(); void onNew(); void onDelete(); void onSave(); void onOpen(); void onYes(); void onNo(); void onClose(); void onCancel(); void onHelp(); void onApply(); void onReset(); void onPrint(); void onModify(); void onAdd(); void onRemove(); void onEdit(); void onDownload(); void onLibraryImport(); void onLibraryExport(); void onShow(); void onZoomIn(); void onZoomOut(); void onHide(); protected: void init(); void addButtonInternal(NGLStandardButton *button); protected Q_SLOTS: void buttonClicked(); protected: QMultiMap m_standardButtons; Qt::Orientation m_orientation; NGLStandardButton::StandardButtons m_buttons; NGLStandardButton::StandardButtons m_disabledActions; QFrame *m_line; QAction *m_bSpacer2ContextAction; bool m_bLineVisible; };