qskinny/examples/layouts/ButtonBox.cpp

25 lines
805 B
C++
Raw Normal View History

2017-07-21 18:21:34 +02:00
/******************************************************************************
* QSkinny - Copyright (C) 2016 Uwe Rathmann
* This file may be used under the terms of the 3-clause BSD License
*****************************************************************************/
#include "ButtonBox.h"
#include <QskPushButton.h>
2018-08-03 08:15:28 +02:00
ButtonBox::ButtonBox( QQuickItem* parent )
: QskLinearBox( Qt::Horizontal, parent )
2017-07-21 18:21:34 +02:00
{
setObjectName( "ButtonBox" );
setSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed );
}
2018-08-03 08:15:28 +02:00
void ButtonBox::addButton(
const QString& text, std::function< void() > func, bool autoRepeat )
2017-07-21 18:21:34 +02:00
{
QskPushButton* button = new QskPushButton( text );
button->setAutoRepeat( autoRepeat );
QObject::connect( button, &QskPushButton::clicked, func );
addItem( button );
}