QSkinny 0.8.0
C++/Qt UI toolkit
Loading...
Searching...
No Matches
QskDialogSubWindow.h
1/******************************************************************************
2 * QSkinny - Copyright (C) The authors
3 * SPDX-License-Identifier: BSD-3-Clause
4 *****************************************************************************/
5
6#ifndef QSK_DIALOG_SUB_WINDOW_H
7#define QSK_DIALOG_SUB_WINDOW_H
8
9#include "QskDialog.h"
10#include "QskSubWindow.h"
11
13class QskPushButton;
14class QskTextLabel;
15
16class QSK_EXPORT QskDialogSubWindow : public QskSubWindow
17{
18 Q_OBJECT
19
20 Q_PROPERTY( QskDialog::Actions dialogActions
21 READ dialogActions WRITE setDialogActions )
22
23 Q_PROPERTY( QString title READ title
24 WRITE setTitle NOTIFY titleChanged )
25
26 using Inherited = QskSubWindow;
27
28 public:
29 QSK_SUBCONTROLS( DialogTitle )
30
31 QskDialogSubWindow( QQuickItem* parent = nullptr );
32 ~QskDialogSubWindow() override;
33
34 QskDialog::Actions dialogActions() const;
35 void setDialogActions( QskDialog::Actions );
36
37 void addDialogAction( QskDialog::Action );
38 void addDialogButton( QskPushButton*, QskDialog::ActionRole );
39
40 Q_INVOKABLE QskDialog::Action clickedAction() const;
41
42 Q_INVOKABLE QskDialog::DialogCode result() const;
43 Q_INVOKABLE QskDialog::DialogCode exec();
44
45 void setDefaultDialogAction( QskDialog::Action );
46
47 void setDefaultButton( QskPushButton* );
48 QskPushButton* defaultButton() const;
49
50 QskDialogButtonBox* buttonBox();
51 const QskDialogButtonBox* buttonBox() const;
52
53 void setContentItem( QQuickItem* );
54 QQuickItem* contentItem() const;
55
56 void setTitle( const QString& );
57 QString title() const;
58
59 QskTextLabel* titleLabel();
60 const QskTextLabel* titleLabel() const;
61
62 // padding around the contentItem
63 void setContentPadding( const QMarginsF& );
64 QMarginsF contentPadding() const;
65
66 Q_SIGNALS:
67 void titleChanged( const QString& );
68
69 void finished( QskDialog::DialogCode );
70 void accepted();
71 void rejected();
72
73 public Q_SLOTS:
74 void accept();
75 void reject();
76
77 virtual void done( QskDialog::DialogCode );
78
79 protected:
80 void setResult( QskDialog::DialogCode );
81
82 void keyPressEvent( QKeyEvent* ) override;
83
84 virtual void updateGeometry();
85
86 void updateLayout() override;
87
88 QSizeF layoutSizeHint( Qt::SizeHint, const QSizeF& ) const;
89
90 private:
91 void initButtonBox();
92
93 class PrivateData;
94 std::unique_ptr< PrivateData > m_data;
95};
96
97#endif