QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskDialogButtonBox.h
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#ifndef QSK_DIALOG_BUTTON_BOX_H
7#define QSK_DIALOG_BUTTON_BOX_H
8
9#include "QskBox.h"
10#include "QskDialog.h"
11
12class QskPushButton;
13
14class QSK_EXPORT QskDialogButtonBox : public QskBox
15{
16 Q_OBJECT
17
18 Q_PROPERTY( Qt::Orientation orientation READ orientation
19 WRITE setOrientation NOTIFY orientationChanged )
20
21 Q_PROPERTY( bool centeredButtons READ centeredButtons
22 WRITE setCenteredButtons NOTIFY centeredButtonsChanged )
23
24 using Inherited = QskBox;
25
26 public:
27 QSK_SUBCONTROLS( Panel )
28
29 QskDialogButtonBox( QQuickItem* parent = nullptr );
30 QskDialogButtonBox( Qt::Orientation orientation, QQuickItem* parent = nullptr );
31
32 ~QskDialogButtonBox() override;
33
34 void setOrientation( Qt::Orientation );
35 Qt::Orientation orientation() const;
36
37 void setCenteredButtons( bool center );
38 bool centeredButtons() const;
39
40 void addButton( QskPushButton*, QskDialog::ActionRole );
41 void removeButton( QskPushButton* );
42 void clear();
43
44 QVector< QskPushButton* > buttons() const;
45 QVector< QskPushButton* > buttons( QskDialog::ActionRole ) const;
46
47 QskDialog::ActionRole actionRole( const QskPushButton* ) const;
48
49 void addAction( QskDialog::Action );
50
51 void setActions( QskDialog::Actions );
52 QskDialog::Actions actions() const;
53
54 QskDialog::Action action( const QskPushButton* ) const;
55
56 QskPushButton* button( QskDialog::Action ) const;
57
58 QskDialog::Action clickedAction() const;
59
60 void setDefaultButton( QskPushButton* );
61 QskPushButton* defaultButton() const;
62
63 static bool isDefaultButtonKeyEvent( const QKeyEvent* );
64
65 Q_SIGNALS:
66 void clicked( QskPushButton* button );
67 void accepted();
68 void rejected();
69
70 void centeredButtonsChanged();
71 void orientationChanged();
72
73 protected:
74 bool event( QEvent* ) override;
75 void itemChange( ItemChange, const ItemChangeData& ) override;
76
77 void updateLayout() override;
78 QSizeF layoutSizeHint( Qt::SizeHint, const QSizeF& ) const override;
79
80 virtual QskPushButton* createButton( QskDialog::Action ) const;
81 void invalidateLayout();
82
83 QskAspect::Subcontrol substitutedSubcontrol(
84 QskAspect::Subcontrol ) const override;
85
86 private:
87 void onButtonClicked();
88 void rearrangeButtons();
89 void updateTabFocusChain();
90
91 class PrivateData;
92 std::unique_ptr< PrivateData > m_data;
93};
94
95#endif
Subcontrol
For use within the rendering or lay-outing of a specific QskSkinnable.
Definition QskAspect.h:104
void itemChange(ItemChange, const ItemChangeData &) override