2021-04-29 07:49:08 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* Copyright (C) 2021 Edelhirsch Software GmbH
|
|
|
|
* This file may be used under the terms of the 3-clause BSD License
|
|
|
|
*****************************************************************************/
|
2021-04-26 06:22:35 +02:00
|
|
|
|
|
|
|
#include "BoxWithButtons.h"
|
2021-08-04 18:55:18 +02:00
|
|
|
#include "RoundButton.h"
|
2021-04-26 06:22:35 +02:00
|
|
|
#include "RoundedIcon.h"
|
|
|
|
#include "Skin.h"
|
|
|
|
|
|
|
|
#include <QskTextLabel.h>
|
2021-08-04 18:55:18 +02:00
|
|
|
#include <QskLinearBox.h>
|
2021-04-26 06:22:35 +02:00
|
|
|
|
2021-08-04 18:55:18 +02:00
|
|
|
QSK_SUBCONTROL( BoxWithButtons, ValueText )
|
|
|
|
QSK_SUBCONTROL( BoxWithButtons, ValuePanel )
|
2021-04-26 06:22:35 +02:00
|
|
|
QSK_SUBCONTROL( BoxWithButtons, Panel )
|
|
|
|
|
2021-08-04 18:55:18 +02:00
|
|
|
namespace
|
|
|
|
{
|
|
|
|
class UpAndDownBox : public QskLinearBox
|
2021-08-24 14:38:03 +02:00
|
|
|
{
|
2021-08-04 18:55:18 +02:00
|
|
|
public:
|
|
|
|
UpAndDownBox( QQuickItem* parent )
|
|
|
|
: QskLinearBox( Qt::Vertical, parent )
|
|
|
|
{
|
|
|
|
setSizePolicy( Qt::Horizontal, QskSizePolicy::Fixed );
|
|
|
|
setSpacing( 0 );
|
|
|
|
|
|
|
|
new RoundButton( QskAspect::Top, this );
|
|
|
|
new RoundButton( QskAspect::Bottom, this );
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
2021-04-26 06:22:35 +02:00
|
|
|
|
2021-08-04 15:06:04 +02:00
|
|
|
BoxWithButtons::BoxWithButtons( const QString& title, const QString& value,
|
|
|
|
bool isBright, QQuickItem* parent )
|
|
|
|
: Box( QString(), parent )
|
2021-04-26 06:22:35 +02:00
|
|
|
{
|
|
|
|
setPanel( true );
|
2021-08-04 15:06:04 +02:00
|
|
|
setSubcontrolProxy( QskBox::Panel, Panel );
|
|
|
|
|
2021-04-26 06:22:35 +02:00
|
|
|
setSizePolicy( Qt::Vertical, QskSizePolicy::Maximum );
|
|
|
|
|
2021-08-04 15:06:44 +02:00
|
|
|
auto* layout = new QskLinearBox( Qt::Horizontal, this );
|
2021-04-26 06:22:35 +02:00
|
|
|
layout->setSpacing( 20 );
|
|
|
|
|
|
|
|
QString iconFile = title.toLower();
|
|
|
|
iconFile = iconFile.replace( ' ', '-' );
|
|
|
|
new RoundedIcon( iconFile, isBright, false, layout );
|
|
|
|
|
2021-08-04 18:55:18 +02:00
|
|
|
auto titleAndValue = new QskLinearBox( Qt::Vertical, layout );
|
|
|
|
titleAndValue->setPanel( true );
|
|
|
|
titleAndValue->setSubcontrolProxy( QskBox::Panel, ValuePanel );
|
2021-04-26 06:22:35 +02:00
|
|
|
|
|
|
|
auto* titleLabel = new QskTextLabel( title, titleAndValue );
|
|
|
|
titleLabel->setFontRole( Skin::TitleFont );
|
|
|
|
|
2021-08-04 18:55:18 +02:00
|
|
|
auto valueLabel = new QskTextLabel( value, titleAndValue );
|
|
|
|
valueLabel->setSubcontrolProxy( QskTextLabel::Text, ValueText );
|
2021-04-26 06:22:35 +02:00
|
|
|
|
2021-08-04 18:55:18 +02:00
|
|
|
new UpAndDownBox( layout );
|
2021-04-26 06:22:35 +02:00
|
|
|
}
|