6#include "QskPopupSkinlet.h"
8#include "QskRgbValue.h"
10static inline QRgb qskInterpolatedRgb( QRgb rgb, qreal factor )
12 return QskRgb::toTransparent( rgb, qRound( factor * qAlpha( rgb ) ) );
15QskPopupSkinlet::QskPopupSkinlet(
QskSkin* skin )
18 appendNodeRoles( { OverlayRole } );
21QskPopupSkinlet::~QskPopupSkinlet() =
default;
23QRectF QskPopupSkinlet::subControlRect(
const QskSkinnable* skinnable,
26 const auto popup =
static_cast< const QskPopup*
>( skinnable );
28 if ( subControl == QskPopup::Overlay )
29 return popup->overlayRect();
31 return Inherited::subControlRect( skinnable, contentsRect, subControl );
34QSGNode* QskPopupSkinlet::updateSubNode(
35 const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node )
const
37 const auto popup =
static_cast< const QskPopup*
>( skinnable );
42 return updateOverlayNode( popup, node );
45 return Inherited::updateSubNode( skinnable, nodeRole, node );
48QSGNode* QskPopupSkinlet::updateOverlayNode(
49 const QskPopup* popup, QSGNode* node )
const
53 const auto factor = popup->fadingFactor();
63 if ( gradient.isVisible() && factor != 1.0 )
65 auto stops = gradient.stops();
67 for (
auto& stop : stops )
68 stop.setRgb( qskInterpolatedRgb( stop.rgb(), factor ) );
70 gradient.setStops( stops );
73 return updateBoxNode( popup, node, rect, gradient, QskPopup::Overlay );
76#include "moc_QskPopupSkinlet.cpp"
Subcontrol
For use within the rendering or lay-outing of a specific QskSkinnable.
QRectF subControlRect(QskAspect::Subcontrol) const
QskGradient gradientHint(QskAspect, QskSkinHintStatus *=nullptr) const
Retrieves a color hint as gradient.