qskinny/examples/iot-dashboard/Box.cpp

37 lines
781 B
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
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 );
setPanel( true );
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;
}