qskinny/src/dialogs/QskDialogSubWindow.h

98 lines
2.4 KiB
C
Raw Normal View History

2017-07-21 16:21:34 +00:00
/******************************************************************************
2024-01-17 13:31:45 +00:00
* QSkinny - Copyright (C) The authors
2023-04-06 07:23:37 +00:00
* SPDX-License-Identifier: BSD-3-Clause
2017-07-21 16:21:34 +00:00
*****************************************************************************/
#ifndef QSK_DIALOG_SUB_WINDOW_H
2022-03-20 12:11:34 +00:00
#define QSK_DIALOG_SUB_WINDOW_H
2017-07-21 16:21:34 +00:00
#include "QskDialog.h"
2018-08-03 06:15:28 +00:00
#include "QskSubWindow.h"
2017-07-21 16:21:34 +00:00
2018-11-06 17:54:21 +00:00
class QskDialogButtonBox;
class QskPushButton;
class QskTextLabel;
2018-11-06 17:54:21 +00:00
2017-07-21 16:21:34 +00:00
class QSK_EXPORT QskDialogSubWindow : public QskSubWindow
{
Q_OBJECT
2018-11-06 17:54:21 +00:00
Q_PROPERTY( QskDialog::Actions dialogActions
READ dialogActions WRITE setDialogActions )
Q_PROPERTY( QString title READ title
WRITE setTitle NOTIFY titleChanged )
2017-07-21 16:21:34 +00:00
using Inherited = QskSubWindow;
2018-08-03 06:15:28 +00:00
public:
QSK_SUBCONTROLS( DialogTitle )
2017-07-21 16:21:34 +00:00
QskDialogSubWindow( QQuickItem* parent = nullptr );
2018-07-31 15:32:25 +00:00
~QskDialogSubWindow() override;
2017-07-21 16:21:34 +00:00
2018-11-06 17:54:21 +00:00
QskDialog::Actions dialogActions() const;
void setDialogActions( QskDialog::Actions );
2018-11-08 12:33:30 +00:00
void addDialogAction( QskDialog::Action );
void addDialogButton( QskPushButton*, QskDialog::ActionRole );
2018-11-06 17:54:21 +00:00
Q_INVOKABLE QskDialog::Action clickedAction() const;
2017-07-21 16:21:34 +00:00
Q_INVOKABLE QskDialog::DialogCode result() const;
Q_INVOKABLE QskDialog::DialogCode exec();
2018-11-06 17:54:21 +00:00
void setDefaultDialogAction( QskDialog::Action );
void setDefaultButton( QskPushButton* );
QskPushButton* defaultButton() const;
QskDialogButtonBox* buttonBox();
const QskDialogButtonBox* buttonBox() const;
void setContentItem( QQuickItem* );
QQuickItem* contentItem() const;
void setTitle( const QString& );
QString title() const;
QskTextLabel* titleLabel();
const QskTextLabel* titleLabel() const;
2018-11-07 09:10:48 +00:00
// padding around the contentItem
void setContentPadding( const QMarginsF& );
2018-11-07 09:10:48 +00:00
QMarginsF contentPadding() const;
2018-08-03 06:15:28 +00:00
Q_SIGNALS:
void titleChanged( const QString& );
2017-07-21 16:21:34 +00:00
void finished( QskDialog::DialogCode );
void accepted();
void rejected();
2018-08-03 06:15:28 +00:00
public Q_SLOTS:
2017-07-21 16:21:34 +00:00
void accept();
void reject();
2019-03-01 13:20:56 +00:00
virtual void done( QskDialog::DialogCode );
2018-08-03 06:15:28 +00:00
protected:
2018-11-06 17:54:21 +00:00
void setResult( QskDialog::DialogCode );
2018-07-31 15:32:25 +00:00
void keyPressEvent( QKeyEvent* ) override;
2017-07-21 16:21:34 +00:00
virtual void updateGeometry();
2018-11-07 09:10:48 +00:00
void updateLayout() override;
2017-07-21 16:21:34 +00:00
2025-01-03 09:08:10 +00:00
QSizeF layoutSizeHint( Qt::SizeHint, const QSizeF& ) const override;
2018-11-06 17:54:21 +00:00
2018-08-03 06:15:28 +00:00
private:
void initButtonBox();
2018-11-06 17:54:21 +00:00
class PrivateData;
std::unique_ptr< PrivateData > m_data;
2017-07-21 16:21:34 +00:00
};
#endif