QskDrawerSkinlet introduced
This commit is contained in:
parent
4102276f79
commit
f47e96e9ce
|
@ -40,24 +40,30 @@ namespace
|
||||||
switch( edge )
|
switch( edge )
|
||||||
{
|
{
|
||||||
case Qt::LeftEdge:
|
case Qt::LeftEdge:
|
||||||
content->setBackgroundColor( QskRgb::Tomato );
|
setPanel( QskRgb::Tomato );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::RightEdge:
|
case Qt::RightEdge:
|
||||||
|
setPanel( QskRgb::Orchid );
|
||||||
content->setFixedWidth( 1.5 * size.width() );
|
content->setFixedWidth( 1.5 * size.width() );
|
||||||
content->setBackgroundColor( QskRgb::Orchid );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::TopEdge:
|
case Qt::TopEdge:
|
||||||
content->setBackgroundColor( QskRgb::Chartreuse );
|
setPanel( QskRgb::Chartreuse );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Qt::BottomEdge:
|
case Qt::BottomEdge:
|
||||||
|
setPanel( QskRgb::Wheat );
|
||||||
content->setFixedHeight( 2 * size.height() );
|
content->setFixedHeight( 2 * size.height() );
|
||||||
content->setBackgroundColor( QskRgb::Wheat );
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
void setPanel( const QColor& color )
|
||||||
|
{
|
||||||
|
setGradientHint( Panel, color );
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class DrawerBox : public QskControl
|
class DrawerBox : public QskControl
|
||||||
|
|
|
@ -626,8 +626,11 @@ void Editor::setupDrawerMetrics()
|
||||||
setAnimation( Q::Panel | A::Position, 300, QEasingCurve::OutCubic );
|
setAnimation( Q::Panel | A::Position, 300, QEasingCurve::OutCubic );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setupDrawerColors( QskAspect::Section, const QskFluent2Theme& )
|
void Editor::setupDrawerColors(
|
||||||
|
QskAspect::Section section, const QskFluent2Theme& theme )
|
||||||
{
|
{
|
||||||
|
setGradient( QskDrawer::Panel | section,
|
||||||
|
theme.palette.background.solid.base );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setupFocusIndicatorMetrics()
|
void Editor::setupFocusIndicatorMetrics()
|
||||||
|
|
|
@ -809,6 +809,7 @@ void Editor::setupDrawer()
|
||||||
using Q = QskDrawer;
|
using Q = QskDrawer;
|
||||||
using A = QskAspect;
|
using A = QskAspect;
|
||||||
|
|
||||||
|
setGradient( Q::Panel, m_pal.background );
|
||||||
setAnimation( Q::Panel | A::Position, 300, QEasingCurve::OutCubic );
|
setAnimation( Q::Panel | A::Position, 300, QEasingCurve::OutCubic );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -761,6 +761,7 @@ void Editor::setupDrawer()
|
||||||
using Q = QskDrawer;
|
using Q = QskDrawer;
|
||||||
using A = QskAspect;
|
using A = QskAspect;
|
||||||
|
|
||||||
|
setPanel( Q::Panel, Plain );
|
||||||
setAnimation( Q::Panel | A::Position, 300, QEasingCurve::OutCubic );
|
setAnimation( Q::Panel | A::Position, 300, QEasingCurve::OutCubic );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -176,6 +176,7 @@ list(APPEND HEADERS
|
||||||
controls/QskComboBoxSkinlet.h
|
controls/QskComboBoxSkinlet.h
|
||||||
controls/QskControl.h
|
controls/QskControl.h
|
||||||
controls/QskDrawer.h
|
controls/QskDrawer.h
|
||||||
|
controls/QskDrawerSkinlet.h
|
||||||
controls/QskEvent.h
|
controls/QskEvent.h
|
||||||
controls/QskFlickAnimator.h
|
controls/QskFlickAnimator.h
|
||||||
controls/QskFocusIndicator.h
|
controls/QskFocusIndicator.h
|
||||||
|
@ -279,6 +280,7 @@ list(APPEND SOURCES
|
||||||
controls/QskControlPrivate.cpp
|
controls/QskControlPrivate.cpp
|
||||||
controls/QskDirtyItemFilter.cpp
|
controls/QskDirtyItemFilter.cpp
|
||||||
controls/QskDrawer.cpp
|
controls/QskDrawer.cpp
|
||||||
|
controls/QskDrawerSkinlet.cpp
|
||||||
controls/QskEvent.cpp
|
controls/QskEvent.cpp
|
||||||
controls/QskFlickAnimator.cpp
|
controls/QskFlickAnimator.cpp
|
||||||
controls/QskFocusIndicator.cpp
|
controls/QskFocusIndicator.cpp
|
||||||
|
|
|
@ -460,4 +460,9 @@ QskAspect QskDrawer::fadingAspect() const
|
||||||
return QskDrawer::Panel | QskAspect::Position;
|
return QskDrawer::Panel | QskAspect::Position;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QRectF QskDrawer::layoutRectForSize( const QSizeF& size ) const
|
||||||
|
{
|
||||||
|
return subControlContentsRect( size, Panel );
|
||||||
|
}
|
||||||
|
|
||||||
#include "moc_QskDrawer.cpp"
|
#include "moc_QskDrawer.cpp"
|
||||||
|
|
|
@ -43,6 +43,8 @@ class QSK_EXPORT QskDrawer : public QskPopup
|
||||||
QRectF clipRect() const override;
|
QRectF clipRect() const override;
|
||||||
QskAspect fadingAspect() const override;
|
QskAspect fadingAspect() const override;
|
||||||
|
|
||||||
|
QRectF layoutRectForSize( const QSizeF& ) const override;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void edgeChanged( Qt::Edge );
|
void edgeChanged( Qt::Edge );
|
||||||
void dragMarginChanged( qreal );
|
void dragMarginChanged( qreal );
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#include "QskDrawerSkinlet.h"
|
||||||
|
#include "QskDrawer.h"
|
||||||
|
|
||||||
|
QskDrawerSkinlet::QskDrawerSkinlet( QskSkin* skin )
|
||||||
|
: Inherited( skin )
|
||||||
|
{
|
||||||
|
appendNodeRoles( { PanelRole } );
|
||||||
|
}
|
||||||
|
|
||||||
|
QskDrawerSkinlet::~QskDrawerSkinlet() = default;
|
||||||
|
|
||||||
|
QRectF QskDrawerSkinlet::subControlRect(
|
||||||
|
const QskSkinnable* skinnable, const QRectF& contentsRect,
|
||||||
|
QskAspect::Subcontrol subControl ) const
|
||||||
|
{
|
||||||
|
if ( subControl == QskDrawer::Panel )
|
||||||
|
return contentsRect;
|
||||||
|
|
||||||
|
return Inherited::subControlRect( skinnable, contentsRect, subControl );
|
||||||
|
}
|
||||||
|
|
||||||
|
QSGNode* QskDrawerSkinlet::updateSubNode(
|
||||||
|
const QskSkinnable* skinnable, quint8 nodeRole, QSGNode* node ) const
|
||||||
|
{
|
||||||
|
if ( nodeRole == PanelRole )
|
||||||
|
return updateBoxNode( skinnable, node, QskDrawer::Panel );
|
||||||
|
|
||||||
|
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
||||||
|
}
|
||||||
|
|
||||||
|
QSizeF QskDrawerSkinlet::sizeHint( const QskSkinnable* skinnable,
|
||||||
|
Qt::SizeHint which, const QSizeF& constraint ) const
|
||||||
|
{
|
||||||
|
if ( which == Qt::PreferredSize )
|
||||||
|
return skinnable->strutSizeHint( QskDrawer::Panel );
|
||||||
|
|
||||||
|
return Inherited::sizeHint( skinnable, which, constraint );
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "moc_QskDrawerSkinlet.cpp"
|
|
@ -0,0 +1,40 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* QSkinny - Copyright (C) 2016 Uwe Rathmann
|
||||||
|
* SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
*****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef QSK_DRAWER_SKINLET_H
|
||||||
|
#define QSK_DRAWER_SKINLET_H
|
||||||
|
|
||||||
|
#include "QskPopupSkinlet.h"
|
||||||
|
|
||||||
|
class QSK_EXPORT QskDrawerSkinlet : public QskPopupSkinlet
|
||||||
|
{
|
||||||
|
Q_GADGET
|
||||||
|
|
||||||
|
using Inherited = QskPopupSkinlet;
|
||||||
|
|
||||||
|
public:
|
||||||
|
enum NodeRole
|
||||||
|
{
|
||||||
|
ContentsRole = Inherited::RoleCount,
|
||||||
|
PanelRole,
|
||||||
|
|
||||||
|
RoleCount
|
||||||
|
};
|
||||||
|
|
||||||
|
Q_INVOKABLE QskDrawerSkinlet( QskSkin* = nullptr );
|
||||||
|
~QskDrawerSkinlet() override;
|
||||||
|
|
||||||
|
QRectF subControlRect( const QskSkinnable*,
|
||||||
|
const QRectF&, QskAspect::Subcontrol ) const override;
|
||||||
|
|
||||||
|
QSizeF sizeHint( const QskSkinnable*,
|
||||||
|
Qt::SizeHint, const QSizeF& ) const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
QSGNode* updateSubNode( const QskSkinnable*,
|
||||||
|
quint8 nodeRole, QSGNode* ) const override;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -32,6 +32,9 @@
|
||||||
#include "QskComboBox.h"
|
#include "QskComboBox.h"
|
||||||
#include "QskComboBoxSkinlet.h"
|
#include "QskComboBoxSkinlet.h"
|
||||||
|
|
||||||
|
#include "QskDrawer.h"
|
||||||
|
#include "QskDrawerSkinlet.h"
|
||||||
|
|
||||||
#include "QskFocusIndicator.h"
|
#include "QskFocusIndicator.h"
|
||||||
#include "QskFocusIndicatorSkinlet.h"
|
#include "QskFocusIndicatorSkinlet.h"
|
||||||
|
|
||||||
|
@ -160,6 +163,7 @@ QskSkin::QskSkin( QObject* parent )
|
||||||
declareSkinlet< QskBox, QskBoxSkinlet >();
|
declareSkinlet< QskBox, QskBoxSkinlet >();
|
||||||
declareSkinlet< QskCheckBox, QskCheckBoxSkinlet >();
|
declareSkinlet< QskCheckBox, QskCheckBoxSkinlet >();
|
||||||
declareSkinlet< QskComboBox, QskComboBoxSkinlet >();
|
declareSkinlet< QskComboBox, QskComboBoxSkinlet >();
|
||||||
|
declareSkinlet< QskDrawer, QskDrawerSkinlet >();
|
||||||
declareSkinlet< QskFocusIndicator, QskFocusIndicatorSkinlet >();
|
declareSkinlet< QskFocusIndicator, QskFocusIndicatorSkinlet >();
|
||||||
declareSkinlet< QskGraphicLabel, QskGraphicLabelSkinlet >();
|
declareSkinlet< QskGraphicLabel, QskGraphicLabelSkinlet >();
|
||||||
declareSkinlet< QskListView, QskListViewSkinlet >();
|
declareSkinlet< QskListView, QskListViewSkinlet >();
|
||||||
|
|
Loading…
Reference in New Issue