transitioning for QskSubWindow added
This commit is contained in:
parent
6a11179cc9
commit
615fcffe44
|
@ -72,13 +72,13 @@ QskMenu::QskMenu( QQuickItem* parent )
|
|||
initSizePolicy( QskSizePolicy::Fixed, QskSizePolicy::Fixed );
|
||||
|
||||
// we hide the focus indicator while sliding
|
||||
connect( this, &QskMenu::transitioningChanged,
|
||||
connect( this, &QskPopup::transitioningChanged,
|
||||
this, &QskControl::focusIndicatorRectChanged );
|
||||
|
||||
connect( this, &QskPopup::transitioningChanged,
|
||||
this, &QQuickItem::setClip );
|
||||
|
||||
connect( this, &QskMenu::opened, this,
|
||||
connect( this, &QskPopup::opened, this,
|
||||
[this]() { m_data->triggeredIndex = -1; } );
|
||||
|
||||
setAcceptHoverEvents( true );
|
||||
|
@ -283,11 +283,13 @@ QString QskMenu::triggeredText() const
|
|||
|
||||
void QskMenu::updateResources()
|
||||
{
|
||||
const auto size = sizeConstraint();
|
||||
const auto dy = ( 1.0 - transitioningFactor() ) * size.height();
|
||||
if ( isTransitioning() )
|
||||
{
|
||||
const auto dy = ( 1.0 - transitioningFactor() ) * height();
|
||||
setPosition( m_data->origin.x(), m_data->origin.y() - dy );
|
||||
}
|
||||
|
||||
setGeometry( m_data->origin.x(), m_data->origin.y() - dy,
|
||||
size.width(), size.height() );
|
||||
Inherited::updateResources();
|
||||
}
|
||||
|
||||
void QskMenu::updateNode( QSGNode* node )
|
||||
|
@ -485,6 +487,8 @@ void QskMenu::mouseReleaseEvent( QMouseEvent* event )
|
|||
|
||||
void QskMenu::aboutToShow()
|
||||
{
|
||||
setSize( sizeConstraint() );
|
||||
|
||||
if ( m_data->currentIndex < 0 )
|
||||
{
|
||||
if ( !m_data->actions.isEmpty() )
|
||||
|
|
|
@ -253,4 +253,10 @@ void QskSubWindow::itemChange( QQuickItem::ItemChange change,
|
|||
}
|
||||
}
|
||||
|
||||
void QskSubWindow::updateResources()
|
||||
{
|
||||
setOpacity( transitioningFactor() );
|
||||
Inherited::updateResources();
|
||||
}
|
||||
|
||||
#include "moc_QskSubWindow.cpp"
|
||||
|
|
|
@ -95,6 +95,8 @@ class QSK_EXPORT QskSubWindow : public QskPopup
|
|||
bool event( QEvent* ) override;
|
||||
|
||||
void updateLayout() override;
|
||||
void updateResources() override;
|
||||
|
||||
QSizeF layoutSizeHint( Qt::SizeHint, const QSizeF& ) const override;
|
||||
|
||||
void itemChange( QQuickItem::ItemChange,
|
||||
|
|
|
@ -94,6 +94,18 @@ QSGNode* QskSubWindowSkinlet::updateSubNode(
|
|||
|
||||
return nullptr;
|
||||
}
|
||||
case OverlayRole:
|
||||
{
|
||||
/*
|
||||
Overloading QskPopupSkinlet: as the opacity of the subwindow already
|
||||
depends on the transitioningFactor we do not want the additional opacity
|
||||
adjustments for the overlay node.
|
||||
Maybe we should have a flag that indicates if the popup does
|
||||
opacity or geometry transitions, when opening/closing TODO ...
|
||||
*/
|
||||
updateBoxNode( subWindow, node, Q::Overlay );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return Inherited::updateSubNode( skinnable, nodeRole, node );
|
||||
|
|
|
@ -77,6 +77,7 @@ static void qskSetupSubWindow(
|
|||
const QString& title, QskDialog::Actions actions,
|
||||
QskDialog::Action defaultAction, QskDialogSubWindow* subWindow )
|
||||
{
|
||||
subWindow->setPopupFlag( QskPopup::DeleteOnClose );
|
||||
subWindow->setModal( true );
|
||||
subWindow->setWindowTitle( title );
|
||||
subWindow->setDialogActions( actions );
|
||||
|
@ -128,14 +129,14 @@ static QskDialog::Action qskMessageSubWindow(
|
|||
const QString& text, int symbolType, QskDialog::Actions actions,
|
||||
QskDialog::Action defaultAction )
|
||||
{
|
||||
QskMessageSubWindow subWindow( window->contentItem() );
|
||||
subWindow.setSymbolType( symbolType );
|
||||
subWindow.setText( text );
|
||||
auto subWindow = new QskMessageSubWindow( window->contentItem() );
|
||||
subWindow->setSymbolType( symbolType );
|
||||
subWindow->setText( text );
|
||||
|
||||
qskSetupSubWindow( title, actions, defaultAction, &subWindow );
|
||||
( void ) subWindow.exec();
|
||||
qskSetupSubWindow( title, actions, defaultAction, subWindow );
|
||||
( void ) subWindow->exec();
|
||||
|
||||
auto clickedAction = subWindow.clickedAction();
|
||||
auto clickedAction = subWindow->clickedAction();
|
||||
if ( clickedAction == QskDialog::NoAction )
|
||||
{
|
||||
// dialog might have been closed by the window menu
|
||||
|
@ -172,16 +173,16 @@ static QString qskSelectSubWindow(
|
|||
QskDialog::Actions actions, QskDialog::Action defaultAction,
|
||||
const QStringList& entries, int selectedRow )
|
||||
{
|
||||
QskSelectionSubWindow subWindow( window->contentItem() );
|
||||
subWindow.setInfoText( text );
|
||||
subWindow.setEntries( entries );
|
||||
subWindow.setSelectedRow( selectedRow );
|
||||
auto subWindow = new QskSelectionSubWindow( window->contentItem() );
|
||||
subWindow->setInfoText( text );
|
||||
subWindow->setEntries( entries );
|
||||
subWindow->setSelectedRow( selectedRow );
|
||||
|
||||
QString selectedEntry;
|
||||
|
||||
qskSetupSubWindow( title, actions, defaultAction, &subWindow );
|
||||
if ( subWindow.exec() == QskDialog::Accepted )
|
||||
selectedEntry = subWindow.selectedEntry();
|
||||
qskSetupSubWindow( title, actions, defaultAction, subWindow );
|
||||
if ( subWindow->exec() == QskDialog::Accepted )
|
||||
selectedEntry = subWindow->selectedEntry();
|
||||
|
||||
return selectedEntry;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue