qskinny/src/dialogs/QskDialogSubWindow.h

81 lines
2.1 KiB
C
Raw Normal View History

2017-07-21 16:21:34 +00:00
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the QSkinny License, Version 1.0
*****************************************************************************/
#ifndef QSK_DIALOG_SUB_WINDOW_H
#define QSK_DIALOG_SUB_WINDOW_H 1
#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;
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 )
2017-07-21 16:21:34 +00:00
using Inherited = QskSubWindow;
2018-08-03 06:15:28 +00:00
public:
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 );
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;
2018-11-07 09:10:48 +00:00
// padding around the contentItem
void setContentPadding( const QMarginsF & );
QMarginsF contentPadding() const;
qreal heightForWidth( qreal width ) const override;
qreal widthForHeight( qreal height ) const override;
QSizeF contentsSizeHint() const override;
2018-08-03 06:15:28 +00:00
Q_SIGNALS:
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 done( QskDialog::DialogCode );
void accept();
void reject();
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
2018-11-07 09:10:48 +00:00
void updateLayout() override;
2018-07-31 15:32:25 +00:00
void aboutToShow() override;
2017-07-21 16:21:34 +00:00
2018-11-06 17:54:21 +00:00
virtual QskDialogButtonBox* createButtonBox();
2018-08-03 06:15:28 +00:00
private:
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