qskinny/examples/iot-dashboard/Box.cpp

40 lines
1009 B
C++
Raw Normal View History

2020-09-17 14:14:29 +00:00
#include "Box.h"
2020-09-16 16:38:17 +00:00
#include "DaytimeSkin.h"
2020-05-22 09:48:05 +00:00
2020-09-18 13:40:46 +00:00
#include "src/shadowedrectangle.h"
2020-09-16 16:38:17 +00:00
#include <QskBoxBorderColors.h>
#include <QskBoxBorderMetrics.h>
#include <QskBoxShapeMetrics.h>
2020-05-22 09:48:05 +00:00
#include <QskTextLabel.h>
2020-09-17 14:14:29 +00:00
Box::Box( const QString& title, QQuickItem* parent )
2020-09-16 16:38:17 +00:00
: QskLinearBox( Qt::Vertical, parent )
, m_title( title )
, m_label( new QskTextLabel( m_title, this ) )
2020-05-22 09:48:05 +00:00
{
2020-09-16 16:38:17 +00:00
setAutoAddChildren( true );
setAutoLayoutChildren( true );
2020-09-17 15:01:06 +00:00
setBackgroundColor( Qt::white );
2020-09-16 16:38:17 +00:00
setMarginsHint( Panel | QskAspect::Padding, 15 );
setPanel( true );
setBoxShapeHint( QskBox::Panel, 6 );
setBoxBorderMetricsHint( QskBox::Panel, 2 );
QskBoxBorderColors borderColors( "#dddddd" );
borderColors.setAlpha( 100 );
setBoxBorderColorsHint( QskBox::Panel, borderColors );
2020-09-18 13:40:46 +00:00
auto* r = new ShadowedRectangle( this );
r->setColor( Qt::green );
2020-09-16 16:38:17 +00:00
m_label->setFontRole( DaytimeSkin::TitleFont );
2020-09-17 14:22:47 +00:00
if( m_label->text().isEmpty() )
{
m_label->setVisible( false );
}
2020-05-22 09:48:05 +00:00
}