fading implemented
This commit is contained in:
parent
615fcffe44
commit
4102276f79
|
@ -620,6 +620,10 @@ void Editor::setupDialogButtonBoxColors(
|
||||||
|
|
||||||
void Editor::setupDrawerMetrics()
|
void Editor::setupDrawerMetrics()
|
||||||
{
|
{
|
||||||
|
using Q = QskDrawer;
|
||||||
|
using A = QskAspect;
|
||||||
|
|
||||||
|
setAnimation( Q::Panel | A::Position, 300, QEasingCurve::OutCubic );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setupDrawerColors( QskAspect::Section, const QskFluent2Theme& )
|
void Editor::setupDrawerColors( QskAspect::Section, const QskFluent2Theme& )
|
||||||
|
@ -738,6 +742,7 @@ void Editor::setupListViewColors(
|
||||||
void Editor::setupMenuMetrics()
|
void Editor::setupMenuMetrics()
|
||||||
{
|
{
|
||||||
using Q = QskMenu;
|
using Q = QskMenu;
|
||||||
|
using A = QskAspect;
|
||||||
|
|
||||||
setPadding( Q::Panel, { 4, 6, 4, 6 } );
|
setPadding( Q::Panel, { 4, 6, 4, 6 } );
|
||||||
setBoxBorderMetrics( Q::Panel, 1 );
|
setBoxBorderMetrics( Q::Panel, 1 );
|
||||||
|
@ -751,6 +756,8 @@ void Editor::setupMenuMetrics()
|
||||||
|
|
||||||
setStrutSize( Q::Icon, 12, 12 );
|
setStrutSize( Q::Icon, 12, 12 );
|
||||||
setPadding( Q::Icon, { 8, 8, 0, 8 } );
|
setPadding( Q::Icon, { 8, 8, 0, 8 } );
|
||||||
|
|
||||||
|
setAnimation( Q::Panel | A::Position, 100 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setupMenuColors(
|
void Editor::setupMenuColors(
|
||||||
|
@ -867,8 +874,6 @@ void Editor::setupPopup( const QskFluent2Theme& theme )
|
||||||
|
|
||||||
setHint( Q::Overlay | A::Style, true );
|
setHint( Q::Overlay | A::Style, true );
|
||||||
setGradient( Q::Overlay, pal.background.overlay.defaultColor );
|
setGradient( Q::Overlay, pal.background.overlay.defaultColor );
|
||||||
|
|
||||||
setAnimation( Q::Popup, 150 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setupProgressBarMetrics()
|
void Editor::setupProgressBarMetrics()
|
||||||
|
@ -1874,6 +1879,8 @@ void Editor::setupSwitchButtonColors(
|
||||||
void Editor::setupSubWindow( const QskFluent2Theme& theme )
|
void Editor::setupSubWindow( const QskFluent2Theme& theme )
|
||||||
{
|
{
|
||||||
using Q = QskSubWindow;
|
using Q = QskSubWindow;
|
||||||
|
using A = QskAspect;
|
||||||
|
|
||||||
const auto& pal = theme.palette;
|
const auto& pal = theme.palette;
|
||||||
|
|
||||||
setPadding( Q::Panel, { 0, 31, 0, 0 } );
|
setPadding( Q::Panel, { 0, 31, 0, 0 } );
|
||||||
|
@ -1891,6 +1898,8 @@ void Editor::setupSubWindow( const QskFluent2Theme& theme )
|
||||||
setColor( Q::TitleBarText, pal.fillColor.text.primary );
|
setColor( Q::TitleBarText, pal.fillColor.text.primary );
|
||||||
setAlignment( Q::TitleBarText, Qt::AlignLeft );
|
setAlignment( Q::TitleBarText, Qt::AlignLeft );
|
||||||
setTextOptions( Q::TitleBarText, Qt::ElideRight, QskTextOptions::NoWrap );
|
setTextOptions( Q::TitleBarText, Qt::ElideRight, QskTextOptions::NoWrap );
|
||||||
|
|
||||||
|
setAnimation( Q::Panel | A::Position, 300, QEasingCurve::OutCubic );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setupVirtualKeyboardMetrics()
|
void Editor::setupVirtualKeyboardMetrics()
|
||||||
|
|
|
@ -331,8 +331,6 @@ void Editor::setupPopup()
|
||||||
|
|
||||||
setHint( Q::Overlay | A::Style, true );
|
setHint( Q::Overlay | A::Style, true );
|
||||||
setGradient( Q::Overlay, stateLayerColor( m_pal.outline, 0.8 ) );
|
setGradient( Q::Overlay, stateLayerColor( m_pal.outline, 0.8 ) );
|
||||||
|
|
||||||
setAnimation( Q::Popup, qskDuration );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setupMenu()
|
void Editor::setupMenu()
|
||||||
|
@ -381,6 +379,8 @@ void Editor::setupMenu()
|
||||||
setFontRole( Q::Text, QskMaterial3Skin::M3BodyMedium );
|
setFontRole( Q::Text, QskMaterial3Skin::M3BodyMedium );
|
||||||
|
|
||||||
setAnimation( Q::Cursor | A::Position | A::Metric, 75, QEasingCurve::OutCubic );
|
setAnimation( Q::Cursor | A::Position | A::Metric, 75, QEasingCurve::OutCubic );
|
||||||
|
|
||||||
|
setAnimation( Q::Panel | A::Position, 75 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setupTextLabel()
|
void Editor::setupTextLabel()
|
||||||
|
@ -806,6 +806,10 @@ void Editor::setupDialogButtonBox()
|
||||||
|
|
||||||
void Editor::setupDrawer()
|
void Editor::setupDrawer()
|
||||||
{
|
{
|
||||||
|
using Q = QskDrawer;
|
||||||
|
using A = QskAspect;
|
||||||
|
|
||||||
|
setAnimation( Q::Panel | A::Position, 300, QEasingCurve::OutCubic );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setupSlider()
|
void Editor::setupSlider()
|
||||||
|
@ -1255,6 +1259,7 @@ void Editor::setupSubWindow()
|
||||||
for ( auto subControl : { Q::Panel, Q::TitleBarPanel, Q::TitleBarText } )
|
for ( auto subControl : { Q::Panel, Q::TitleBarPanel, Q::TitleBarText } )
|
||||||
setAnimation( subControl | A::Color, qskDuration );
|
setAnimation( subControl | A::Color, qskDuration );
|
||||||
|
|
||||||
|
setAnimation( Q::Panel | A::Position, qskDuration, QEasingCurve::OutCubic );
|
||||||
}
|
}
|
||||||
|
|
||||||
QskMaterial3Theme::QskMaterial3Theme( QskSkin::ColorScheme colorScheme )
|
QskMaterial3Theme::QskMaterial3Theme( QskSkin::ColorScheme colorScheme )
|
||||||
|
|
|
@ -410,8 +410,6 @@ void Editor::setupPopup()
|
||||||
|
|
||||||
setHint( Q::Overlay | A::Style, true );
|
setHint( Q::Overlay | A::Style, true );
|
||||||
setGradient( Q::Overlay, qRgba( 220, 220, 220, 150 ) );
|
setGradient( Q::Overlay, qRgba( 220, 220, 220, 150 ) );
|
||||||
|
|
||||||
setAnimation( Q::Popup, 200 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setupMenu()
|
void Editor::setupMenu()
|
||||||
|
@ -449,6 +447,7 @@ void Editor::setupMenu()
|
||||||
setGraphicRole( Q::Icon | Q::Selected, CursorSymbol );
|
setGraphicRole( Q::Icon | Q::Selected, CursorSymbol );
|
||||||
|
|
||||||
setAnimation( Q::Cursor | A::Position | A::Metric, 75, QEasingCurve::OutCubic );
|
setAnimation( Q::Cursor | A::Position | A::Metric, 75, QEasingCurve::OutCubic );
|
||||||
|
setAnimation( Q::Panel | A::Position, 100 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setupTextLabel()
|
void Editor::setupTextLabel()
|
||||||
|
@ -759,6 +758,10 @@ void Editor::setupDialogButtonBox()
|
||||||
|
|
||||||
void Editor::setupDrawer()
|
void Editor::setupDrawer()
|
||||||
{
|
{
|
||||||
|
using Q = QskDrawer;
|
||||||
|
using A = QskAspect;
|
||||||
|
|
||||||
|
setAnimation( Q::Panel | A::Position, 300, QEasingCurve::OutCubic );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setupTabButton()
|
void Editor::setupTabButton()
|
||||||
|
@ -1120,8 +1123,12 @@ void Editor::setupSubWindow()
|
||||||
|
|
||||||
setAlignment( Q::TitleBarText, Qt::AlignLeft | Qt::AlignVCenter );
|
setAlignment( Q::TitleBarText, Qt::AlignLeft | Qt::AlignVCenter );
|
||||||
|
|
||||||
|
#if 1
|
||||||
for ( auto subControl : { Q::Panel, Q::TitleBarPanel, Q::TitleBarText } )
|
for ( auto subControl : { Q::Panel, Q::TitleBarPanel, Q::TitleBarText } )
|
||||||
setAnimation( subControl | A::Color, qskDuration );
|
setAnimation( subControl | A::Color, qskDuration );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
setAnimation( Q::Panel | A::Position, qskDuration, QEasingCurve::OutCubic );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::setupSpinBox()
|
void Editor::setupSpinBox()
|
||||||
|
|
|
@ -19,6 +19,8 @@ QSK_QT_PRIVATE_BEGIN
|
||||||
#include <private/qquickitemchangelistener_p.h>
|
#include <private/qquickitemchangelistener_p.h>
|
||||||
QSK_QT_PRIVATE_END
|
QSK_QT_PRIVATE_END
|
||||||
|
|
||||||
|
QSK_SUBCONTROL( QskDrawer, Panel )
|
||||||
|
|
||||||
static inline qreal qskDefaultDragMargin()
|
static inline qreal qskDefaultDragMargin()
|
||||||
{
|
{
|
||||||
// a skin hint ???
|
// a skin hint ???
|
||||||
|
@ -79,7 +81,7 @@ static inline QRectF qskAlignedToEdge(
|
||||||
|
|
||||||
static QPointF qskDrawerTranslation( const QskDrawer* drawer, const QSizeF& size )
|
static QPointF qskDrawerTranslation( const QskDrawer* drawer, const QSizeF& size )
|
||||||
{
|
{
|
||||||
const auto ratio = 1.0 - drawer->transitioningFactor();
|
const auto ratio = 1.0 - drawer->fadingFactor();
|
||||||
|
|
||||||
auto dx = 0.0;
|
auto dx = 0.0;
|
||||||
auto dy = 0.0;
|
auto dy = 0.0;
|
||||||
|
@ -170,7 +172,7 @@ namespace
|
||||||
bool isAcceptedPos( const QPointF& pos ) const override
|
bool isAcceptedPos( const QPointF& pos ) const override
|
||||||
{
|
{
|
||||||
auto drawer = qobject_cast< const QskDrawer* >( targetItem() );
|
auto drawer = qobject_cast< const QskDrawer* >( targetItem() );
|
||||||
if ( drawer->isTransitioning() )
|
if ( drawer->isFading() )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
auto rect = qskItemRect( watchedItem() );
|
auto rect = qskItemRect( watchedItem() );
|
||||||
|
@ -255,8 +257,7 @@ QskDrawer::QskDrawer( Qt::Edge edge, QQuickItem* parentItem )
|
||||||
setAutoLayoutChildren( true );
|
setAutoLayoutChildren( true );
|
||||||
setInteractive( true );
|
setInteractive( true );
|
||||||
|
|
||||||
connect( this, &QskPopup::transitioningChanged,
|
connect( this, &QskPopup::fadingChanged, this, &QQuickItem::setClip );
|
||||||
this, &QQuickItem::setClip );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QskDrawer::~QskDrawer()
|
QskDrawer::~QskDrawer()
|
||||||
|
@ -393,12 +394,12 @@ void QskDrawer::updateResources()
|
||||||
|
|
||||||
void QskDrawer::updateNode( QSGNode* node )
|
void QskDrawer::updateNode( QSGNode* node )
|
||||||
{
|
{
|
||||||
if ( isTransitioning() && clip() )
|
if ( isFading() && clip() )
|
||||||
{
|
{
|
||||||
if ( auto clipNode = QQuickItemPrivate::get( this )->clipNode() )
|
if ( auto clipNode = QQuickItemPrivate::get( this )->clipNode() )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
The clipRect is changing while transitioning. Couldn't
|
The clipRect is changing while fading. Couldn't
|
||||||
find a way how to trigger updates - maybe be enabling/disabling
|
find a way how to trigger updates - maybe be enabling/disabling
|
||||||
the clip. So we do the updates manually. TODO ...
|
the clip. So we do the updates manually. TODO ...
|
||||||
*/
|
*/
|
||||||
|
@ -416,7 +417,7 @@ void QskDrawer::updateNode( QSGNode* node )
|
||||||
|
|
||||||
QRectF QskDrawer::clipRect() const
|
QRectF QskDrawer::clipRect() const
|
||||||
{
|
{
|
||||||
if ( isTransitioning() && parentItem() )
|
if ( isFading() && parentItem() )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
We might not fit into our parent and our children not
|
We might not fit into our parent and our children not
|
||||||
|
@ -454,4 +455,9 @@ QRectF QskDrawer::clipRect() const
|
||||||
return Inherited::clipRect();
|
return Inherited::clipRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QskAspect QskDrawer::fadingAspect() const
|
||||||
|
{
|
||||||
|
return QskDrawer::Panel | QskAspect::Position;
|
||||||
|
}
|
||||||
|
|
||||||
#include "moc_QskDrawer.cpp"
|
#include "moc_QskDrawer.cpp"
|
||||||
|
|
|
@ -23,6 +23,8 @@ class QSK_EXPORT QskDrawer : public QskPopup
|
||||||
WRITE setInteractive NOTIFY interactiveChanged )
|
WRITE setInteractive NOTIFY interactiveChanged )
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
QSK_SUBCONTROLS( Panel );
|
||||||
|
|
||||||
QskDrawer( QQuickItem* = nullptr );
|
QskDrawer( QQuickItem* = nullptr );
|
||||||
QskDrawer( Qt::Edge, QQuickItem* = nullptr );
|
QskDrawer( Qt::Edge, QQuickItem* = nullptr );
|
||||||
|
|
||||||
|
@ -39,6 +41,7 @@ class QSK_EXPORT QskDrawer : public QskPopup
|
||||||
qreal dragMargin() const;
|
qreal dragMargin() const;
|
||||||
|
|
||||||
QRectF clipRect() const override;
|
QRectF clipRect() const override;
|
||||||
|
QskAspect fadingAspect() const override;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void edgeChanged( Qt::Edge );
|
void edgeChanged( Qt::Edge );
|
||||||
|
|
|
@ -22,7 +22,6 @@ QSK_QT_PRIVATE_BEGIN
|
||||||
#include <private/qquickitem_p.h>
|
#include <private/qquickitem_p.h>
|
||||||
QSK_QT_PRIVATE_END
|
QSK_QT_PRIVATE_END
|
||||||
|
|
||||||
QSK_SUBCONTROL( QskMenu, Overlay )
|
|
||||||
QSK_SUBCONTROL( QskMenu, Panel )
|
QSK_SUBCONTROL( QskMenu, Panel )
|
||||||
QSK_SUBCONTROL( QskMenu, Segment )
|
QSK_SUBCONTROL( QskMenu, Segment )
|
||||||
QSK_SUBCONTROL( QskMenu, Cursor )
|
QSK_SUBCONTROL( QskMenu, Cursor )
|
||||||
|
@ -72,10 +71,10 @@ QskMenu::QskMenu( QQuickItem* parent )
|
||||||
initSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed );
|
initSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed );
|
||||||
|
|
||||||
// we hide the focus indicator while sliding
|
// we hide the focus indicator while sliding
|
||||||
connect( this, &QskPopup::transitioningChanged,
|
connect( this, &QskPopup::fadingChanged,
|
||||||
this, &QskControl::focusIndicatorRectChanged );
|
this, &QskControl::focusIndicatorRectChanged );
|
||||||
|
|
||||||
connect( this, &QskPopup::transitioningChanged,
|
connect( this, &QskPopup::fadingChanged,
|
||||||
this, &QQuickItem::setClip );
|
this, &QQuickItem::setClip );
|
||||||
|
|
||||||
connect( this, &QskPopup::opened, this,
|
connect( this, &QskPopup::opened, this,
|
||||||
|
@ -90,7 +89,7 @@ QskMenu::~QskMenu()
|
||||||
|
|
||||||
QRectF QskMenu::clipRect() const
|
QRectF QskMenu::clipRect() const
|
||||||
{
|
{
|
||||||
if ( isTransitioning() )
|
if ( isFading() )
|
||||||
{
|
{
|
||||||
constexpr qreal d = 1e6;
|
constexpr qreal d = 1e6;
|
||||||
return QRectF( -d, m_data->origin.y() - y(), 2.0 * d, d );
|
return QRectF( -d, m_data->origin.y() - y(), 2.0 * d, d );
|
||||||
|
@ -283,23 +282,23 @@ QString QskMenu::triggeredText() const
|
||||||
|
|
||||||
void QskMenu::updateResources()
|
void QskMenu::updateResources()
|
||||||
{
|
{
|
||||||
if ( isTransitioning() )
|
qreal dy = 0.0;
|
||||||
{
|
if ( isFading() )
|
||||||
const auto dy = ( 1.0 - transitioningFactor() ) * height();
|
dy = ( 1.0 - fadingFactor() ) * height();
|
||||||
setPosition( m_data->origin.x(), m_data->origin.y() - dy );
|
|
||||||
}
|
setPosition( m_data->origin.x(), m_data->origin.y() - dy );
|
||||||
|
|
||||||
Inherited::updateResources();
|
Inherited::updateResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskMenu::updateNode( QSGNode* node )
|
void QskMenu::updateNode( QSGNode* node )
|
||||||
{
|
{
|
||||||
if ( isTransitioning() && clip() )
|
if ( isFading() && clip() )
|
||||||
{
|
{
|
||||||
if ( auto clipNode = QQuickItemPrivate::get( this )->clipNode() )
|
if ( auto clipNode = QQuickItemPrivate::get( this )->clipNode() )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
The clipRect is changing while transitioning. Couldn't
|
The clipRect is changing while fading. Couldn't
|
||||||
find a way how to trigger updates - maybe be enabling/disabling
|
find a way how to trigger updates - maybe be enabling/disabling
|
||||||
the clip. So we do the updates manually. TODO ...
|
the clip. So we do the updates manually. TODO ...
|
||||||
*/
|
*/
|
||||||
|
@ -500,7 +499,7 @@ void QskMenu::aboutToShow()
|
||||||
|
|
||||||
QRectF QskMenu::focusIndicatorRect() const
|
QRectF QskMenu::focusIndicatorRect() const
|
||||||
{
|
{
|
||||||
if ( isTransitioning() )
|
if ( isFading() )
|
||||||
return QRectF();
|
return QRectF();
|
||||||
|
|
||||||
if( currentIndex() >= 0 )
|
if( currentIndex() >= 0 )
|
||||||
|
@ -544,6 +543,11 @@ void QskMenu::trigger( int index )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QskAspect QskMenu::fadingAspect() const
|
||||||
|
{
|
||||||
|
return QskMenu::Panel | QskAspect::Position;
|
||||||
|
}
|
||||||
|
|
||||||
int QskMenu::exec()
|
int QskMenu::exec()
|
||||||
{
|
{
|
||||||
(void) execPopup();
|
(void) execPopup();
|
||||||
|
|
|
@ -37,7 +37,7 @@ class QSK_EXPORT QskMenu : public QskPopup
|
||||||
using Inherited = QskPopup;
|
using Inherited = QskPopup;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QSK_SUBCONTROLS( Overlay, Panel, Segment, Cursor, Text, Icon, Separator )
|
QSK_SUBCONTROLS( Panel, Segment, Cursor, Text, Icon, Separator )
|
||||||
QSK_STATES( Selected, Pressed )
|
QSK_STATES( Selected, Pressed )
|
||||||
|
|
||||||
QskMenu( QQuickItem* parentItem = nullptr );
|
QskMenu( QQuickItem* parentItem = nullptr );
|
||||||
|
@ -82,6 +82,7 @@ class QSK_EXPORT QskMenu : public QskPopup
|
||||||
bool isPressed() const;
|
bool isPressed() const;
|
||||||
|
|
||||||
QRectF clipRect() const override;
|
QRectF clipRect() const override;
|
||||||
|
QskAspect fadingAspect() const override;
|
||||||
|
|
||||||
Q_INVOKABLE int exec();
|
Q_INVOKABLE int exec();
|
||||||
|
|
||||||
|
|
|
@ -19,16 +19,10 @@ QSK_QT_PRIVATE_BEGIN
|
||||||
#include <private/qquickitem_p.h>
|
#include <private/qquickitem_p.h>
|
||||||
QSK_QT_PRIVATE_END
|
QSK_QT_PRIVATE_END
|
||||||
|
|
||||||
QSK_SUBCONTROL( QskPopup, Popup )
|
|
||||||
QSK_SUBCONTROL( QskPopup, Overlay )
|
QSK_SUBCONTROL( QskPopup, Overlay )
|
||||||
|
|
||||||
QSK_SYSTEM_STATE( QskPopup, Closed, QskAspect::FirstSystemState << 1 )
|
QSK_SYSTEM_STATE( QskPopup, Closed, QskAspect::FirstSystemState << 1 )
|
||||||
|
|
||||||
static QskAspect qskTransitioningAspect()
|
|
||||||
{
|
|
||||||
return QskPopup::Popup | QskAspect::Metric;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void qskSetFocus( QQuickItem* item, bool on )
|
static void qskSetFocus( QQuickItem* item, bool on )
|
||||||
{
|
{
|
||||||
if ( item->window() == nullptr )
|
if ( item->window() == nullptr )
|
||||||
|
@ -83,11 +77,11 @@ static bool qskReplayMousePress()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void qskStartTransition( QskPopup* popup, bool on )
|
static void qskStartFading( QskPopup* popup, bool on )
|
||||||
{
|
{
|
||||||
const auto aspect = qskTransitioningAspect();
|
const auto aspect = popup->fadingAspect();
|
||||||
|
|
||||||
auto hint = popup->animationHint( aspect.subControl() );
|
auto hint = popup->animationHint( aspect );
|
||||||
|
|
||||||
if ( hint.isValid() )
|
if ( hint.isValid() )
|
||||||
{
|
{
|
||||||
|
@ -240,11 +234,11 @@ void QskPopup::setOpen( bool on )
|
||||||
else
|
else
|
||||||
Q_EMIT closed();
|
Q_EMIT closed();
|
||||||
|
|
||||||
qskStartTransition( this, on );
|
qskStartFading( this, on );
|
||||||
|
|
||||||
if ( isTransitioning() )
|
if ( isFading() )
|
||||||
{
|
{
|
||||||
Q_EMIT transitioningChanged( true );
|
Q_EMIT fadingChanged( true );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -263,14 +257,19 @@ bool QskPopup::isOpen() const
|
||||||
return !hasSkinState( QskPopup::Closed );
|
return !hasSkinState( QskPopup::Closed );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool QskPopup::isTransitioning() const
|
QskAspect QskPopup::fadingAspect() const
|
||||||
{
|
{
|
||||||
return runningHintAnimator( qskTransitioningAspect() ) != nullptr;
|
return QskAspect();
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal QskPopup::transitioningFactor() const
|
bool QskPopup::isFading() const
|
||||||
{
|
{
|
||||||
if ( auto animator = runningHintAnimator( qskTransitioningAspect() ) )
|
return runningHintAnimator( fadingAspect() ) != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
qreal QskPopup::fadingFactor() const
|
||||||
|
{
|
||||||
|
if ( auto animator = runningHintAnimator( fadingAspect() ) )
|
||||||
return animator->currentValue().value< qreal >();
|
return animator->currentValue().value< qreal >();
|
||||||
|
|
||||||
return isOpen() ? 1.0 : 0.0;
|
return isOpen() ? 1.0 : 0.0;
|
||||||
|
@ -336,7 +335,7 @@ bool QskPopup::isTransitionAccepted( QskAspect aspect ) const
|
||||||
if ( ( aspect.value() == 0 ) )
|
if ( ( aspect.value() == 0 ) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if ( aspect.subControl() == effectiveSubcontrol( QskPopup::Popup ) )
|
if ( aspect.subControl() == effectiveSubcontrol( fadingAspect().subControl() ) )
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if ( aspect.subControl() == effectiveSubcontrol( QskPopup::Overlay ) )
|
if ( aspect.subControl() == effectiveSubcontrol( QskPopup::Overlay ) )
|
||||||
|
@ -487,7 +486,7 @@ bool QskPopup::event( QEvent* event )
|
||||||
const auto animatorEvent = static_cast< QskAnimatorEvent* >( event );
|
const auto animatorEvent = static_cast< QskAnimatorEvent* >( event );
|
||||||
|
|
||||||
if ( ( animatorEvent->state() == QskAnimatorEvent::Terminated )
|
if ( ( animatorEvent->state() == QskAnimatorEvent::Terminated )
|
||||||
&& ( animatorEvent->aspect() == qskTransitioningAspect() ) )
|
&& ( animatorEvent->aspect() == fadingAspect() ) )
|
||||||
{
|
{
|
||||||
if ( !isOpen() )
|
if ( !isOpen() )
|
||||||
{
|
{
|
||||||
|
@ -497,7 +496,7 @@ bool QskPopup::event( QEvent* event )
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_EMIT transitioningChanged( false );
|
Q_EMIT fadingChanged( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -645,7 +644,7 @@ int QskPopup::execPopup()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
connect( popup, &QObject::destroyed, this, &EventLoop::reject );
|
connect( popup, &QObject::destroyed, this, &EventLoop::reject );
|
||||||
connect( popup, &QskPopup::transitioningChanged, this, &EventLoop::maybeQuit );
|
connect( popup, &QskPopup::fadingChanged, this, &EventLoop::maybeQuit );
|
||||||
connect( popup, &QskPopup::openChanged, this, &EventLoop::maybeQuit );
|
connect( popup, &QskPopup::openChanged, this, &EventLoop::maybeQuit );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -660,7 +659,7 @@ int QskPopup::execPopup()
|
||||||
{
|
{
|
||||||
if ( auto popup = qobject_cast< const QskPopup* >( parent() ) )
|
if ( auto popup = qobject_cast< const QskPopup* >( parent() ) )
|
||||||
{
|
{
|
||||||
if ( popup->isOpen() || popup->isTransitioning() )
|
if ( popup->isOpen() || popup->isFading() )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -668,7 +667,7 @@ int QskPopup::execPopup()
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if ( isOpen() || isTransitioning() )
|
if ( isOpen() || isFading() )
|
||||||
{
|
{
|
||||||
qWarning() << "QskPopup::exec: popup is already opened";
|
qWarning() << "QskPopup::exec: popup is already opened";
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -14,7 +14,7 @@ class QSK_EXPORT QskPopup : public QskControl
|
||||||
|
|
||||||
Q_PROPERTY( bool open READ isOpen WRITE setOpen NOTIFY openChanged )
|
Q_PROPERTY( bool open READ isOpen WRITE setOpen NOTIFY openChanged )
|
||||||
Q_PROPERTY( bool modal READ isModal WRITE setModal NOTIFY modalChanged )
|
Q_PROPERTY( bool modal READ isModal WRITE setModal NOTIFY modalChanged )
|
||||||
Q_PROPERTY( bool transitioning READ isTransitioning NOTIFY transitioningChanged )
|
Q_PROPERTY( bool fading READ isFading NOTIFY fadingChanged )
|
||||||
|
|
||||||
Q_PROPERTY( bool overlay READ hasOverlay
|
Q_PROPERTY( bool overlay READ hasOverlay
|
||||||
WRITE setOverlay RESET resetOverlay NOTIFY overlayChanged )
|
WRITE setOverlay RESET resetOverlay NOTIFY overlayChanged )
|
||||||
|
@ -24,7 +24,7 @@ class QSK_EXPORT QskPopup : public QskControl
|
||||||
using Inherited = QskControl;
|
using Inherited = QskControl;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QSK_SUBCONTROLS( Popup, Overlay )
|
QSK_SUBCONTROLS( Overlay )
|
||||||
QSK_STATES( Closed )
|
QSK_STATES( Closed )
|
||||||
|
|
||||||
enum PopupFlag
|
enum PopupFlag
|
||||||
|
@ -56,12 +56,13 @@ class QSK_EXPORT QskPopup : public QskControl
|
||||||
void setPriority( uint );
|
void setPriority( uint );
|
||||||
uint priority() const;
|
uint priority() const;
|
||||||
|
|
||||||
bool isTransitioning() const;
|
|
||||||
qreal transitioningFactor() const;
|
|
||||||
|
|
||||||
bool isOpen() const;
|
bool isOpen() const;
|
||||||
bool isClosed() const;
|
bool isClosed() const;
|
||||||
|
|
||||||
|
bool isFading() const;
|
||||||
|
qreal fadingFactor() const;
|
||||||
|
virtual QskAspect fadingAspect() const;
|
||||||
|
|
||||||
virtual QRectF overlayRect() const;
|
virtual QRectF overlayRect() const;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
|
@ -75,7 +76,7 @@ class QSK_EXPORT QskPopup : public QskControl
|
||||||
void opened();
|
void opened();
|
||||||
void closed();
|
void closed();
|
||||||
void openChanged( bool );
|
void openChanged( bool );
|
||||||
void transitioningChanged( bool );
|
void fadingChanged( bool );
|
||||||
|
|
||||||
void modalChanged( bool );
|
void modalChanged( bool );
|
||||||
void overlayChanged( bool );
|
void overlayChanged( bool );
|
||||||
|
|
|
@ -50,7 +50,7 @@ QSGNode* QskPopupSkinlet::updateOverlayNode(
|
||||||
{
|
{
|
||||||
using Q = QskPopup;
|
using Q = QskPopup;
|
||||||
|
|
||||||
const auto factor = popup->transitioningFactor();
|
const auto factor = popup->fadingFactor();
|
||||||
if ( factor <= 0.0 )
|
if ( factor <= 0.0 )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
|
|
|
@ -255,8 +255,13 @@ void QskSubWindow::itemChange( QQuickItem::ItemChange change,
|
||||||
|
|
||||||
void QskSubWindow::updateResources()
|
void QskSubWindow::updateResources()
|
||||||
{
|
{
|
||||||
setOpacity( transitioningFactor() );
|
setOpacity( fadingFactor() );
|
||||||
Inherited::updateResources();
|
Inherited::updateResources();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QskAspect QskSubWindow::fadingAspect() const
|
||||||
|
{
|
||||||
|
return QskSubWindow::Panel | QskAspect::Position;
|
||||||
|
}
|
||||||
|
|
||||||
#include "moc_QskSubWindow.cpp"
|
#include "moc_QskSubWindow.cpp"
|
||||||
|
|
|
@ -83,6 +83,7 @@ class QSK_EXPORT QskSubWindow : public QskPopup
|
||||||
QRectF titleBarRect() const;
|
QRectF titleBarRect() const;
|
||||||
|
|
||||||
QRectF layoutRectForSize( const QSizeF& ) const override;
|
QRectF layoutRectForSize( const QSizeF& ) const override;
|
||||||
|
QskAspect fadingAspect() const override;
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void decorationsChanged( Decorations );
|
void decorationsChanged( Decorations );
|
||||||
|
|
|
@ -98,10 +98,10 @@ QSGNode* QskSubWindowSkinlet::updateSubNode(
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
Overloading QskPopupSkinlet: as the opacity of the subwindow already
|
Overloading QskPopupSkinlet: as the opacity of the subwindow already
|
||||||
depends on the transitioningFactor we do not want the additional opacity
|
depends on the fadingFactor we do not want the additional opacity
|
||||||
adjustments for the overlay node.
|
adjustments for the overlay node.
|
||||||
Maybe we should have a flag that indicates if the popup does
|
Maybe we should have a flag that indicates if the popup does
|
||||||
opacity or geometry transitions, when opening/closing TODO ...
|
opacity or geometry transitions, when fading TODO ...
|
||||||
*/
|
*/
|
||||||
updateBoxNode( subWindow, node, Q::Overlay );
|
updateBoxNode( subWindow, node, Q::Overlay );
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue