added a 50ms timer when creating drag to force animation when dragMove and dragLeave events are lost
svn path=/trunk/KDE/kdebase/workspace/; revision=1049358
This commit is contained in:
parent
d5cf53c828
commit
51374ce5db
2 changed files with 31 additions and 2 deletions
|
@ -1474,6 +1474,7 @@ namespace Oxygen
|
|||
// because overlapping pixmap and pointer slows down the pixmap alot.
|
||||
drag->setHotSpot( QPoint( event->pos().x() - geometry.left(), -1 ) );
|
||||
|
||||
dragStartTimer_.start( 50, this );
|
||||
drag->exec( Qt::MoveAction );
|
||||
|
||||
// detach tab from window
|
||||
|
@ -1534,6 +1535,7 @@ namespace Oxygen
|
|||
if( itemData_.animationType() & AnimationSameTarget )
|
||||
{
|
||||
|
||||
if( dragStartTimer_.isActive() ) dragStartTimer_.stop();
|
||||
itemData_.animate( AnimationTypes(AnimationLeave|AnimationSameTarget), sourceItem_ );
|
||||
|
||||
} else if( itemData_.animated() ) {
|
||||
|
@ -1562,6 +1564,8 @@ namespace Oxygen
|
|||
|
||||
} else if( itemData_.count() > 1 ) {
|
||||
|
||||
if( dragStartTimer_.isActive() ) dragStartTimer_.stop();
|
||||
|
||||
QPoint position( event->pos() );
|
||||
int itemClicked( OxygenClient::itemClicked( position, false ) );
|
||||
itemData_.animate( AnimationTypes( AnimationMove|AnimationSameTarget ), itemClicked );
|
||||
|
@ -1612,6 +1616,21 @@ namespace Oxygen
|
|||
|
||||
}
|
||||
|
||||
//_____________________________________________________________
|
||||
void OxygenClient::timerEvent( QTimerEvent* event )
|
||||
{
|
||||
|
||||
if( event->timerId() != dragStartTimer_.timerId() )
|
||||
{ return KCommonDecorationUnstable::timerEvent( event ); }
|
||||
|
||||
dragStartTimer_.stop();
|
||||
|
||||
// do nothing if there is only one tab
|
||||
if( itemData_.count() > 1 )
|
||||
{ itemData_.animate( AnimationTypes( AnimationLeave|AnimationSameTarget ), sourceItem_ ); }
|
||||
|
||||
}
|
||||
|
||||
//_____________________________________________________________
|
||||
bool OxygenClient::closeItem( const OxygenButton* button )
|
||||
{
|
||||
|
|
|
@ -35,7 +35,8 @@
|
|||
|
||||
#include <kcommondecoration.h>
|
||||
#include <QtCore/QTimeLine>
|
||||
#include <QtCore/QSharedPointer>
|
||||
#include <QBasicTimer>
|
||||
#include <QTimerEvent>
|
||||
|
||||
namespace Oxygen
|
||||
{
|
||||
|
@ -183,7 +184,6 @@ namespace Oxygen
|
|||
void setForceActive( bool value )
|
||||
{ forceActive_ = value; }
|
||||
|
||||
|
||||
//!@name event filters
|
||||
//@{
|
||||
|
||||
|
@ -211,6 +211,9 @@ namespace Oxygen
|
|||
//! drop event
|
||||
virtual bool dropEvent( QDropEvent* );
|
||||
|
||||
//! timer event
|
||||
virtual void timerEvent( QTimerEvent* );
|
||||
|
||||
//@}
|
||||
|
||||
//!@name rendering methods (called in paintEvent)
|
||||
|
@ -382,6 +385,13 @@ namespace Oxygen
|
|||
//! drag start point
|
||||
QPoint dragPoint_;
|
||||
|
||||
//! drag start timer.
|
||||
/*!
|
||||
it is needed to activate animations when this was not done via either
|
||||
dragMoveEvent or dragLeaveEvent
|
||||
*/
|
||||
QBasicTimer dragStartTimer_;
|
||||
|
||||
};
|
||||
|
||||
//!@name utility functions
|
||||
|
|
Loading…
Reference in a new issue