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 "ButtonBox.h"
|
|
|
|
#include <QskPushButton.h>
|
|
|
|
|
2018-08-03 06:15:28 +00:00
|
|
|
ButtonBox::ButtonBox( QQuickItem* parent )
|
|
|
|
: QskLinearBox( Qt::Horizontal, parent )
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
|
|
|
setObjectName( "ButtonBox" );
|
|
|
|
setSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed );
|
|
|
|
}
|
|
|
|
|
2018-08-03 06:15:28 +00:00
|
|
|
void ButtonBox::addButton(
|
|
|
|
const QString& text, std::function< void() > func, bool autoRepeat )
|
2017-07-21 16:21:34 +00:00
|
|
|
{
|
2019-02-26 20:49:39 +00:00
|
|
|
auto button = new QskPushButton( text );
|
2017-07-21 16:21:34 +00:00
|
|
|
button->setAutoRepeat( autoRepeat );
|
2019-02-26 20:49:39 +00:00
|
|
|
|
2017-07-21 16:21:34 +00:00
|
|
|
QObject::connect( button, &QskPushButton::clicked, func );
|
|
|
|
|
|
|
|
addItem( button );
|
|
|
|
}
|