maybe we don't need our own class
still some work to do, but the main thing works
This commit is contained in:
parent
fa8b4da0b2
commit
a6f7c16e24
|
@ -1,13 +1,39 @@
|
|||
#include "Box.h"
|
||||
#include "DaytimeSkin.h"
|
||||
|
||||
#include "QskShadowedRectangle.h"
|
||||
#include "src/shadowedrectangle.h"
|
||||
|
||||
#include <QskBoxBorderColors.h>
|
||||
#include <QskBoxBorderMetrics.h>
|
||||
#include <QskBoxShapeMetrics.h>
|
||||
#include <QskTextLabel.h>
|
||||
|
||||
ShadowBox::ShadowBox( QskControl* control, QQuickItem* parent )
|
||||
: QskControl( parent )
|
||||
, m_control( control )
|
||||
, m_rectangle( new ShadowedRectangle( this ) )
|
||||
{
|
||||
setAutoLayoutChildren( true );
|
||||
|
||||
m_rectangle->shadow()->setColor( Qt::black );
|
||||
m_rectangle->shadow()->setSize( 15 );
|
||||
m_rectangle->setColor( Qt::white ); // ### opacity should only be for the shadow, not the background
|
||||
m_rectangle->setOpacity( 0.1 );
|
||||
m_rectangle->setSize( m_control->preferredSize() );
|
||||
m_rectangle->corners()->setTopLeft( 6 );
|
||||
m_rectangle->corners()->setTopRight( 6 );
|
||||
m_rectangle->corners()->setBottomLeft( 6 );
|
||||
m_rectangle->corners()->setBottomRight( 6 );
|
||||
}
|
||||
|
||||
void ShadowBox::updateLayout()
|
||||
{
|
||||
const auto s = m_rectangle->shadow()->size();
|
||||
qDebug() << m_control->geometry() << geometry();
|
||||
m_control->setPosition( {15, 0} ); // ### why?
|
||||
m_control->setZ( 1 );
|
||||
}
|
||||
|
||||
Box::Box( const QString& title, QQuickItem* parent )
|
||||
: QskLinearBox( Qt::Vertical, parent )
|
||||
, m_title( title )
|
||||
|
@ -26,16 +52,16 @@ Box::Box( const QString& title, QQuickItem* parent )
|
|||
setBoxBorderColorsHint( QskBox::Panel, borderColors );
|
||||
|
||||
|
||||
auto* r = new QskShadowedRectangle( this );
|
||||
// r->setPosition( {50, 50} );
|
||||
// r->setColor( Qt::green );
|
||||
// r->setOpacity( 0.5 );
|
||||
// r->setSize( {100, 50} );
|
||||
// r->setVisible( true );
|
||||
// r->corners()->setTopLeft( 5 );
|
||||
// r->corners()->setTopRight( 5 );
|
||||
// r->corners()->setBottomLeft( 5 );
|
||||
// r->corners()->setBottomRight( 5 );
|
||||
auto* r = new ShadowedRectangle( this );
|
||||
r->shadow()->setColor( Qt::black );
|
||||
r->shadow()->setSize( 15 );
|
||||
r->setPosition( {0, 0} );
|
||||
r->setOpacity( 0.1 );
|
||||
r->setSize( {100, 50} );
|
||||
r->corners()->setTopLeft( 6 );
|
||||
r->corners()->setTopRight( 6 );
|
||||
r->corners()->setBottomLeft( 6 );
|
||||
r->corners()->setBottomRight( 6 );
|
||||
// r->setRadius( 5 );
|
||||
auto* t = new QskTextLabel( "bla", r );
|
||||
|
||||
|
|
|
@ -1,10 +1,26 @@
|
|||
#ifndef CARD_H
|
||||
#define CARD_H
|
||||
|
||||
#include "src/shadowedrectangle.h"
|
||||
|
||||
#include <QskLinearBox.h>
|
||||
|
||||
class QskTextLabel;
|
||||
|
||||
class ShadowBox : public QskControl
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ShadowBox( QskControl* control, QQuickItem* parent );
|
||||
|
||||
protected:
|
||||
void updateLayout() override;
|
||||
|
||||
private:
|
||||
QskControl* m_control;
|
||||
ShadowedRectangle* m_rectangle;
|
||||
};
|
||||
|
||||
class Box : public QskLinearBox
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -32,7 +32,8 @@ MainContent::MainContent( QQuickItem* parent ) : QskLinearBox( Qt::Vertical, par
|
|||
gridBox->setBoxBorderMetricsHint( QskBox::Panel, 2 );
|
||||
|
||||
auto* usage = new Usage( gridBox );
|
||||
gridBox->addItem( usage, 0, 0, 2, 1 );
|
||||
auto* usageShadowBox = new ShadowBox( usage, this );
|
||||
gridBox->addItem( usageShadowBox, 0, 0, 2, 1 );
|
||||
|
||||
auto* indoorTemperature = new IndoorTemperature( gridBox );
|
||||
gridBox->addItem( indoorTemperature, 0, 1 );
|
||||
|
|
Loading…
Reference in New Issue