also using updateBoxNode for QskSubWindowArea::Panel
This commit is contained in:
parent
dcc4cee5da
commit
cc7d3eb473
@ -47,8 +47,8 @@ int main( int argc, char* argv[] )
|
||||
SkinnyShortcut::enable( SkinnyShortcut::AllShortcuts );
|
||||
|
||||
QskSubWindowArea* area = new QskSubWindowArea();
|
||||
area->setGradient( QskGradient( QskGradient::Diagonal,
|
||||
"DarkSlateGray", "LightSlateGray" ) );
|
||||
area->setGradientHint( QskSubWindowArea::Panel,
|
||||
QskGradient( QskGradient::Diagonal, "DarkSlateGray", "LightSlateGray" ) );
|
||||
|
||||
QRectF windowRect( 0, 0, 250, 250 );
|
||||
|
||||
|
@ -5,7 +5,6 @@
|
||||
|
||||
#include "QskSubWindowArea.h"
|
||||
#include "QskSubWindow.h"
|
||||
#include "QskGradient.h"
|
||||
#include "QskFunctions.h"
|
||||
#include "QskEvent.h"
|
||||
|
||||
@ -86,8 +85,6 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
QskGradient gradient;
|
||||
|
||||
// data about the window being dragged
|
||||
|
||||
bool isDraggableByHeaderOnly : 1;
|
||||
@ -108,33 +105,6 @@ QskSubWindowArea::~QskSubWindowArea()
|
||||
{
|
||||
}
|
||||
|
||||
void QskSubWindowArea::setGradient( const QskGradient& gradient )
|
||||
{
|
||||
if ( gradient != m_data->gradient )
|
||||
{
|
||||
m_data->gradient = gradient;
|
||||
|
||||
update();
|
||||
Q_EMIT gradientChanged();
|
||||
}
|
||||
}
|
||||
|
||||
QskGradient QskSubWindowArea::gradient() const
|
||||
{
|
||||
return m_data->gradient;
|
||||
}
|
||||
|
||||
void QskSubWindowArea::resetGradient()
|
||||
{
|
||||
if ( m_data->gradient.isValid() )
|
||||
{
|
||||
m_data->gradient.invalidate();
|
||||
update();
|
||||
|
||||
Q_EMIT gradientChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void QskSubWindowArea::geometryChangeEvent( QskGeometryChangeEvent* event )
|
||||
{
|
||||
if ( event->isResized() )
|
||||
|
@ -16,9 +16,6 @@ class QSK_EXPORT QskSubWindowArea : public QskControl
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY( QskGradient gradient READ gradient
|
||||
WRITE setGradient RESET resetGradient NOTIFY gradientChanged FINAL )
|
||||
|
||||
using Inherited = QskControl;
|
||||
|
||||
public:
|
||||
@ -27,14 +24,6 @@ public:
|
||||
QskSubWindowArea( QQuickItem* parent = nullptr );
|
||||
virtual ~QskSubWindowArea();
|
||||
|
||||
void setGradient( const QskGradient& gradient );
|
||||
QskGradient gradient() const;
|
||||
void resetGradient();
|
||||
|
||||
|
||||
Q_SIGNALS:
|
||||
void gradientChanged();
|
||||
|
||||
protected:
|
||||
virtual void geometryChangeEvent( QskGeometryChangeEvent* ) override;
|
||||
|
||||
|
@ -5,8 +5,6 @@
|
||||
|
||||
#include "QskSubWindowAreaSkinlet.h"
|
||||
#include "QskSubWindowArea.h"
|
||||
#include "QskBoxOptions.h"
|
||||
#include "QskBoxNode.h"
|
||||
|
||||
QskSubWindowAreaSkinlet::QskSubWindowAreaSkinlet( QskSkin* skin ):
|
||||
Inherited( skin )
|
||||
@ -22,9 +20,7 @@ QRectF QskSubWindowAreaSkinlet::subControlRect(
|
||||
const auto area = static_cast< const QskSubWindowArea* >( skinnable );
|
||||
|
||||
if ( subControl == QskSubWindowArea::Panel )
|
||||
{
|
||||
return area->contentsRect();
|
||||
}
|
||||
|
||||
return Inherited::subControlRect( skinnable, subControl );
|
||||
}
|
||||
@ -32,36 +28,13 @@ QRectF QskSubWindowAreaSkinlet::subControlRect(
|
||||
QSGNode* QskSubWindowAreaSkinlet::updateSubNode(
|
||||
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
|
||||
{
|
||||
const auto area = static_cast< const QskSubWindowArea* >( skinnable );
|
||||
|
||||
switch( nodeRole )
|
||||
{
|
||||
case PanelRole:
|
||||
{
|
||||
return updatePanelNode( area, node );
|
||||
}
|
||||
return updateBoxNode( skinnable, node, QskSubWindowArea::Panel );
|
||||
}
|
||||
|
||||
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
||||
}
|
||||
|
||||
QSGNode* QskSubWindowAreaSkinlet::updatePanelNode(
|
||||
const QskSubWindowArea* area, QSGNode* node ) const
|
||||
{
|
||||
const QRectF rect = subControlRect( area, QskSubWindowArea::Panel );
|
||||
|
||||
if ( !area->gradient().isValid() || rect.isEmpty() )
|
||||
return nullptr;
|
||||
|
||||
auto boxNode = static_cast< QskBoxNode* >( node );
|
||||
if ( boxNode == nullptr )
|
||||
boxNode = new QskBoxNode();
|
||||
|
||||
QskBoxOptions options;
|
||||
options.fillGradient = area->gradient();
|
||||
boxNode->setBoxData( rect, options );
|
||||
|
||||
return boxNode;
|
||||
}
|
||||
|
||||
#include "moc_QskSubWindowAreaSkinlet.cpp"
|
||||
|
Loading…
x
Reference in New Issue
Block a user