2017-07-21 18:21:34 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
|
|
|
* This file may be used under the terms of the QSkinny License, Version 1.0
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
#include "QskDialogButton.h"
|
|
|
|
#include "QskDialogButtonBox.h"
|
|
|
|
|
|
|
|
QSK_SUBCONTROL( QskDialogButton, Panel )
|
|
|
|
QSK_SUBCONTROL( QskDialogButton, Text )
|
|
|
|
QSK_SUBCONTROL( QskDialogButton, Graphic )
|
|
|
|
|
|
|
|
QskDialogButton::QskDialogButton(
|
2018-11-05 13:29:52 +01:00
|
|
|
QskDialog::Action action, QQuickItem* parent )
|
2018-08-03 08:15:28 +02:00
|
|
|
: QskPushButton( parent )
|
2018-11-05 13:29:52 +01:00
|
|
|
, m_action( action )
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
2018-11-05 13:29:52 +01:00
|
|
|
setText( QskDialogButtonBox::buttonText( m_action ) );
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
2018-08-03 08:15:28 +02:00
|
|
|
QskDialogButton::QskDialogButton( QQuickItem* parent )
|
2018-11-05 13:29:52 +01:00
|
|
|
: QskDialogButton( QskDialog::NoAction, parent )
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
QskDialogButton::~QskDialogButton()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
QskAspect::Subcontrol QskDialogButton::effectiveSubcontrol(
|
|
|
|
QskAspect::Subcontrol subControl ) const
|
|
|
|
{
|
|
|
|
if ( subControl == QskPushButton::Panel )
|
|
|
|
return QskDialogButton::Panel;
|
|
|
|
|
|
|
|
if ( subControl == QskPushButton::Text )
|
|
|
|
return QskDialogButton::Text;
|
|
|
|
|
|
|
|
if ( subControl == QskPushButton::Graphic )
|
|
|
|
return QskDialogButton::Graphic;
|
|
|
|
|
|
|
|
return Inherited::effectiveSubcontrol( subControl );
|
|
|
|
}
|
|
|
|
|
2018-11-05 13:29:52 +01:00
|
|
|
void QskDialogButton::setAction( QskDialog::Action action )
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
2018-11-05 13:29:52 +01:00
|
|
|
if ( action != m_action )
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
2018-11-05 13:29:52 +01:00
|
|
|
m_action = action;
|
|
|
|
setText( QskDialogButtonBox::buttonText( m_action ) );
|
2017-07-21 18:21:34 +02:00
|
|
|
|
2018-11-05 13:29:52 +01:00
|
|
|
Q_EMIT actionChanged();
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-11-05 13:29:52 +01:00
|
|
|
QskDialog::Action QskDialogButton::action() const
|
2017-07-21 18:21:34 +02:00
|
|
|
{
|
2018-11-05 13:29:52 +01:00
|
|
|
return m_action;
|
2017-07-21 18:21:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void QskDialogButton::changeEvent( QEvent* event )
|
|
|
|
{
|
|
|
|
if ( event->type() == QEvent::LocaleChange )
|
2018-11-05 13:29:52 +01:00
|
|
|
setText( QskDialogButtonBox::buttonText( m_action ) );
|
2017-07-21 18:21:34 +02:00
|
|
|
|
|
|
|
Inherited::changeEvent( event );
|
|
|
|
}
|
|
|
|
|
|
|
|
#include "moc_QskDialogButton.cpp"
|