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
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#include "QskDialogButton.h"
|
|
|
|
#include "QskDialogButtonBox.h"
|
2022-03-08 14:59:35 +00:00
|
|
|
#include "QskSkin.h"
|
2017-07-21 16:21:34 +00:00
|
|
|
|
|
|
|
QskDialogButton::QskDialogButton(
|
2018-11-05 12:29:52 +00:00
|
|
|
QskDialog::Action action, QQuickItem* parent )
|
2018-08-03 06:15:28 +00:00
|
|
|
: QskPushButton( parent )
|
2018-11-05 12:29:52 +00:00
|
|
|
, m_action( action )
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
2022-03-08 15:15:37 +00:00
|
|
|
resetButton();
|
2017-07-21 16:21:34 +00:00
|
|
|
}
|
|
|
|
|
2018-08-03 06:15:28 +00:00
|
|
|
QskDialogButton::QskDialogButton( QQuickItem* parent )
|
2018-11-05 12:29:52 +00:00
|
|
|
: QskDialogButton( QskDialog::NoAction, parent )
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
QskDialogButton::~QskDialogButton()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2018-11-05 12:29:52 +00:00
|
|
|
void QskDialogButton::setAction( QskDialog::Action action )
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
2018-11-05 12:29:52 +00:00
|
|
|
if ( action != m_action )
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
2018-11-05 12:29:52 +00:00
|
|
|
m_action = action;
|
2022-03-08 15:15:37 +00:00
|
|
|
resetButton();
|
2017-07-21 16:21:34 +00:00
|
|
|
|
2018-11-05 12:29:52 +00:00
|
|
|
Q_EMIT actionChanged();
|
2017-07-21 16:21:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-05 12:29:52 +00:00
|
|
|
QskDialog::Action QskDialogButton::action() const
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
2018-11-05 12:29:52 +00:00
|
|
|
return m_action;
|
2017-07-21 16:21:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void QskDialogButton::changeEvent( QEvent* event )
|
|
|
|
{
|
2022-03-08 14:59:35 +00:00
|
|
|
switch( static_cast< int >( event->type() ) )
|
|
|
|
{
|
|
|
|
case QEvent::LocaleChange:
|
|
|
|
case QEvent::StyleChange:
|
2022-03-08 15:15:37 +00:00
|
|
|
resetButton();
|
|
|
|
break;
|
2022-03-08 14:59:35 +00:00
|
|
|
}
|
2017-07-21 16:21:34 +00:00
|
|
|
|
|
|
|
Inherited::changeEvent( event );
|
|
|
|
}
|
|
|
|
|
2022-03-08 15:15:37 +00:00
|
|
|
void QskDialogButton::resetButton()
|
|
|
|
{
|
|
|
|
if ( const auto skin = effectiveSkin() )
|
|
|
|
setText( skin->dialogButtonText( m_action ) );
|
|
|
|
}
|
|
|
|
|
2017-07-21 16:21:34 +00:00
|
|
|
#include "moc_QskDialogButton.cpp"
|