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 );
|
SkinnyShortcut::enable( SkinnyShortcut::AllShortcuts );
|
||||||
|
|
||||||
QskSubWindowArea* area = new QskSubWindowArea();
|
QskSubWindowArea* area = new QskSubWindowArea();
|
||||||
area->setGradient( QskGradient( QskGradient::Diagonal,
|
area->setGradientHint( QskSubWindowArea::Panel,
|
||||||
"DarkSlateGray", "LightSlateGray" ) );
|
QskGradient( QskGradient::Diagonal, "DarkSlateGray", "LightSlateGray" ) );
|
||||||
|
|
||||||
QRectF windowRect( 0, 0, 250, 250 );
|
QRectF windowRect( 0, 0, 250, 250 );
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
#include "QskSubWindowArea.h"
|
#include "QskSubWindowArea.h"
|
||||||
#include "QskSubWindow.h"
|
#include "QskSubWindow.h"
|
||||||
#include "QskGradient.h"
|
|
||||||
#include "QskFunctions.h"
|
#include "QskFunctions.h"
|
||||||
#include "QskEvent.h"
|
#include "QskEvent.h"
|
||||||
|
|
||||||
|
@ -86,8 +85,6 @@ public:
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QskGradient gradient;
|
|
||||||
|
|
||||||
// data about the window being dragged
|
// data about the window being dragged
|
||||||
|
|
||||||
bool isDraggableByHeaderOnly : 1;
|
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 )
|
void QskSubWindowArea::geometryChangeEvent( QskGeometryChangeEvent* event )
|
||||||
{
|
{
|
||||||
if ( event->isResized() )
|
if ( event->isResized() )
|
||||||
|
|
|
@ -16,9 +16,6 @@ class QSK_EXPORT QskSubWindowArea : public QskControl
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
Q_PROPERTY( QskGradient gradient READ gradient
|
|
||||||
WRITE setGradient RESET resetGradient NOTIFY gradientChanged FINAL )
|
|
||||||
|
|
||||||
using Inherited = QskControl;
|
using Inherited = QskControl;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -27,14 +24,6 @@ public:
|
||||||
QskSubWindowArea( QQuickItem* parent = nullptr );
|
QskSubWindowArea( QQuickItem* parent = nullptr );
|
||||||
virtual ~QskSubWindowArea();
|
virtual ~QskSubWindowArea();
|
||||||
|
|
||||||
void setGradient( const QskGradient& gradient );
|
|
||||||
QskGradient gradient() const;
|
|
||||||
void resetGradient();
|
|
||||||
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
|
||||||
void gradientChanged();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void geometryChangeEvent( QskGeometryChangeEvent* ) override;
|
virtual void geometryChangeEvent( QskGeometryChangeEvent* ) override;
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,6 @@
|
||||||
|
|
||||||
#include "QskSubWindowAreaSkinlet.h"
|
#include "QskSubWindowAreaSkinlet.h"
|
||||||
#include "QskSubWindowArea.h"
|
#include "QskSubWindowArea.h"
|
||||||
#include "QskBoxOptions.h"
|
|
||||||
#include "QskBoxNode.h"
|
|
||||||
|
|
||||||
QskSubWindowAreaSkinlet::QskSubWindowAreaSkinlet( QskSkin* skin ):
|
QskSubWindowAreaSkinlet::QskSubWindowAreaSkinlet( QskSkin* skin ):
|
||||||
Inherited( skin )
|
Inherited( skin )
|
||||||
|
@ -22,9 +20,7 @@ QRectF QskSubWindowAreaSkinlet::subControlRect(
|
||||||
const auto area = static_cast< const QskSubWindowArea* >( skinnable );
|
const auto area = static_cast< const QskSubWindowArea* >( skinnable );
|
||||||
|
|
||||||
if ( subControl == QskSubWindowArea::Panel )
|
if ( subControl == QskSubWindowArea::Panel )
|
||||||
{
|
|
||||||
return area->contentsRect();
|
return area->contentsRect();
|
||||||
}
|
|
||||||
|
|
||||||
return Inherited::subControlRect( skinnable, subControl );
|
return Inherited::subControlRect( skinnable, subControl );
|
||||||
}
|
}
|
||||||
|
@ -32,36 +28,13 @@ QRectF QskSubWindowAreaSkinlet::subControlRect(
|
||||||
QSGNode* QskSubWindowAreaSkinlet::updateSubNode(
|
QSGNode* QskSubWindowAreaSkinlet::updateSubNode(
|
||||||
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
|
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
|
||||||
{
|
{
|
||||||
const auto area = static_cast< const QskSubWindowArea* >( skinnable );
|
|
||||||
|
|
||||||
switch( nodeRole )
|
switch( nodeRole )
|
||||||
{
|
{
|
||||||
case PanelRole:
|
case PanelRole:
|
||||||
{
|
return updateBoxNode( skinnable, node, QskSubWindowArea::Panel );
|
||||||
return updatePanelNode( area, node );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
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"
|
#include "moc_QskSubWindowAreaSkinlet.cpp"
|
||||||
|
|
Loading…
Reference in New Issue