QskDialogSubWindow API improved

This commit is contained in:
Uwe Rathmann 2018-11-08 13:33:30 +01:00
parent 958e087943
commit 8a97403343
4 changed files with 33 additions and 3 deletions

View File

@ -272,7 +272,7 @@ void QskDialogButtonBox::addButton(
}
}
void QskDialogButtonBox::addButton( QskDialog::Action action )
void QskDialogButtonBox::addAction( QskDialog::Action action )
{
QskPushButton* button = createButton( action );
if ( button )
@ -339,7 +339,7 @@ void QskDialogButtonBox::setActions( QskDialog::Actions actions )
{
const auto action = static_cast< QskDialog::Action >( i );
if ( action & actions )
addButton( action );
addAction( action );
}
invalidateLayout();

View File

@ -39,7 +39,6 @@ class QSK_EXPORT QskDialogButtonBox : public QskBox
bool centeredButtons() const;
void addButton( QskPushButton*, QskDialog::ActionRole );
void addButton( QskDialog::Action );
void removeButton( QskPushButton* );
void clear();
@ -48,8 +47,11 @@ class QSK_EXPORT QskDialogButtonBox : public QskBox
QskDialog::ActionRole actionRole( const QskPushButton* ) const;
void addAction( QskDialog::Action );
void setActions( QskDialog::Actions );
QskDialog::Actions actions() const;
QskDialog::Action action( const QskPushButton* ) const;
QskPushButton* button( QskDialog::Action ) const;

View File

@ -51,6 +51,31 @@ QskDialogSubWindow::~QskDialogSubWindow()
{
}
void QskDialogSubWindow::addDialogAction( QskDialog::Action action )
{
if ( action != QskDialog::NoAction )
{
if ( m_data->buttonBox == nullptr )
m_data->buttonBox = createButtonBox();
if ( m_data->buttonBox )
m_data->buttonBox->addAction( action );
}
}
void QskDialogSubWindow::addDialogButton(
QskPushButton* button, QskDialog::ActionRole actionRole )
{
if ( button )
{
if ( m_data->buttonBox == nullptr )
m_data->buttonBox = createButtonBox();
if ( m_data->buttonBox )
m_data->buttonBox->addButton( button, actionRole );
}
}
void QskDialogSubWindow::setDialogActions( QskDialog::Actions actions )
{
if ( m_data->actions == actions )

View File

@ -27,6 +27,9 @@ class QSK_EXPORT QskDialogSubWindow : public QskSubWindow
QskDialog::Actions dialogActions() const;
void setDialogActions( QskDialog::Actions );
void addDialogAction( QskDialog::Action );
void addDialogButton( QskPushButton*, QskDialog::ActionRole );
Q_INVOKABLE QskDialog::Action clickedAction() const;