qskinny/examples/iot-dashboard/Box.cpp

46 lines
1.0 KiB
C++
Raw Normal View History

2020-09-17 14:14:29 +00:00
#include "Box.h"
2021-03-31 08:08:30 +00:00
#include "Skin.h"
2020-05-22 09:48:05 +00:00
#include "src/shadowedrectangle.h"
2020-09-18 13:40:46 +00:00
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-23 15:45:06 +00:00
QSK_SUBCONTROL( Box, Panel )
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
setPaddingHint( Panel, 15 );
2020-09-16 16:38:17 +00:00
setPanel( true );
setBoxShapeHint( QskBox::Panel, 6 );
QskBoxBorderColors borderColors( "#dddddd" );
borderColors.setAlpha( 100 );
setBoxBorderColorsHint( QskBox::Panel, borderColors );
m_label->setFontRole( Skin::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
}
2020-09-23 15:45:06 +00:00
QskAspect::Subcontrol Box::effectiveSubcontrol( QskAspect::Subcontrol subControl ) const
{
if( subControl == QskBox::Panel )
{
return Box::Panel;
}
return subControl;
}