qskinny/examples/iotdashboard/UpAndDownButton.cpp
Uwe Rathmann d947920abe Squashed commit of the following:
commit f429d3ab4e82ab06bfd40577aef8e2d5fdfd59fd
Author: Uwe Rathmann <Uwe.Rathmann@tigertal.de>
Date:   Wed Aug 4 14:40:36 2021 +0200

    subcontrolProxy introduced
2021-08-04 15:06:04 +02:00

54 lines
1.4 KiB
C++

/******************************************************************************
* Copyright (C) 2021 Edelhirsch Software GmbH
* This file may be used under the terms of the 3-clause BSD License
*****************************************************************************/
#include "UpAndDownButton.h"
#include <QskBoxShapeMetrics.h>
#include <QskGraphic.h>
#include <QskGraphicIO.h>
#include <QskPushButton.h>
#include <QImage>
QSK_SUBCONTROL( RoundButton, Panel )
QSK_STATE( RoundButton, Top, ( QskAspect::FirstUserState << 1 ) )
RoundButton::RoundButton( QskAspect::Placement placement, QQuickItem* parent )
: QskPushButton( parent )
{
setSubcontrolProxy( QskPushButton::Panel, RoundButton::Panel );
setSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Expanding );
QskGraphic graphic;
QImage image;
if( placement == QskAspect::Top )
{
setSkinStateFlag( Top );
image.load( ":/images/up.svg" );
}
else
{
image.load( ":/images/down.svg" );
}
setGraphicSourceSize( image.size() );
graphic = QskGraphic::fromImage( image );
setGraphic( graphic );
}
UpAndDownButton::UpAndDownButton( QQuickItem* parent )
: QskLinearBox( Qt::Vertical, parent )
{
setSizePolicy( Qt::Horizontal, QskSizePolicy::Fixed );
setSpacing( 0 );
new RoundButton( QskAspect::Top, this );
new RoundButton( QskAspect::Bottom, this );
}
#include "moc_UpAndDownButton.cpp"