// TOP FIXED WIDGET ------------------------------------
pLabelFixed->setFixedHeight( 50 );
pLabelFixed->setFixedWidth(500);
pLabelFixed
->setFrameStyle
( QFrame::StyledPanel );
// BOTTOM VARIABLE -------------------------------------
pLabelVariable
->setFrameStyle
( QFrame::StyledPanel );
pLabelVariable->resize(500, 0);
// WHOLE WIDGET ---------------------------------------
pWidget->setFixedWidth( 500 );
pLayout->setMargin(0);
pLayout->setSpacing(0);
pLayout->addWidget(pLabelVariable);
pLayout->addWidget(pLabelFixed);
pWidget->setLayout(pLayout);
pWidget->move( pos );
pWidget->show();
// ANIMATIONS ------------------------------------------
QPropertyAnimation* pAni = new QPropertyAnimation( pLabelVariable, "minimumHeight" );
pAni->setStartValue( 0 );
pAni->setEndValue( 50 );
pAni->setDuration( 1000 );
pAni->start();
QPropertyAnimation* pAni2 = new QPropertyAnimation( pWidget, "geometry" );
pAni2->setDuration( 1000 );
pAni2->start();
// TOP FIXED WIDGET ------------------------------------
QLabel* pLabelFixed = new QLabel( "fixed" );
pLabelFixed->setFixedHeight( 50 );
pLabelFixed->setFixedWidth(500);
pLabelFixed->setFrameStyle( QFrame::StyledPanel );
// BOTTOM VARIABLE -------------------------------------
QLabel* pLabelVariable = new QLabel( "variable" );
pLabelVariable->setFrameStyle( QFrame::StyledPanel );
pLabelVariable->resize(500, 0);
// WHOLE WIDGET ---------------------------------------
QWidget* pWidget = new QWidget( NULL, Qt::Popup );
pWidget->setFixedWidth( 500 );
QVBoxLayout* pLayout = new QVBoxLayout();
pLayout->setMargin(0);
pLayout->setSpacing(0);
pLayout->addWidget(pLabelVariable);
pLayout->addWidget(pLabelFixed);
pWidget->setLayout(pLayout);
QPoint pos( 500,500 );
pWidget->move( pos );
pWidget->show();
// ANIMATIONS ------------------------------------------
QPropertyAnimation* pAni = new QPropertyAnimation( pLabelVariable, "minimumHeight" );
pAni->setStartValue( 0 );
pAni->setEndValue( 50 );
pAni->setDuration( 1000 );
pAni->start();
QPropertyAnimation* pAni2 = new QPropertyAnimation( pWidget, "geometry" );
pAni2->setStartValue( QRect( QPoint(500,500), QSize(500,50) ) );
pAni2->setEndValue( QRect( QPoint(500,450), QSize(500,100) ) );
pAni2->setDuration( 1000 );
pAni2->start();
To copy to clipboard, switch view to plain text mode
Bookmarks