Fixed positioning of tabs when manually reordering with right mouse button
Made 'drop target' animation consistent with where tab is actually dropped Cleanup code. CCBUG: 305443
This commit is contained in:
parent
9adb2d3ed0
commit
e248577c37
1 changed files with 18 additions and 27 deletions
|
@ -1620,7 +1620,8 @@ namespace Oxygen
|
||||||
const int clickedIndex( tabIndexAt( point ) );
|
const int clickedIndex( tabIndexAt( point ) );
|
||||||
_mouseButton = Qt::NoButton;
|
_mouseButton = Qt::NoButton;
|
||||||
if ( tabIndexAt( point ) > -1)
|
if ( tabIndexAt( point ) > -1)
|
||||||
showWindowMenu( widget()->mapToGlobal( event->pos() ), tabId(clickedIndex) );
|
{ showWindowMenu( widget()->mapToGlobal( event->pos() ), tabId(clickedIndex) ); }
|
||||||
|
|
||||||
accepted = true; // displayClientMenu can possibly destroy the deco...
|
accepted = true; // displayClientMenu can possibly destroy the deco...
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1632,8 +1633,7 @@ namespace Oxygen
|
||||||
{
|
{
|
||||||
|
|
||||||
bool accepted( false );
|
bool accepted( false );
|
||||||
if( _mouseButton == event->button() &&
|
if( _mouseButton == event->button() && buttonToWindowOperation( _mouseButton ) != OperationsOp )
|
||||||
buttonToWindowOperation( _mouseButton ) != OperationsOp )
|
|
||||||
{
|
{
|
||||||
|
|
||||||
const QPoint point = event->pos();
|
const QPoint point = event->pos();
|
||||||
|
@ -1755,19 +1755,18 @@ namespace Oxygen
|
||||||
// check if drag enter is allowed
|
// check if drag enter is allowed
|
||||||
if( !event->mimeData()->hasFormat( tabDragMimeType() ) || hideTitleBar() ) return false;
|
if( !event->mimeData()->hasFormat( tabDragMimeType() ) || hideTitleBar() ) return false;
|
||||||
|
|
||||||
//
|
// accept event
|
||||||
event->acceptProposedAction();
|
event->acceptProposedAction();
|
||||||
|
|
||||||
|
// animate
|
||||||
if( event->source() != widget() )
|
if( event->source() != widget() )
|
||||||
{
|
{
|
||||||
|
|
||||||
const QPoint position( event->pos() );
|
_itemData.animate( AnimationEnter, tabIndexAt( event->pos(), true ) );
|
||||||
_itemData.animate( AnimationEnter, tabIndexAt( position, true ) );
|
|
||||||
|
|
||||||
} else if( _itemData.count() > 1 ) {
|
} else if( _itemData.count() > 1 ) {
|
||||||
|
|
||||||
const QPoint position( event->pos() );
|
_itemData.animate( AnimationEnter|AnimationSameTarget, tabIndexAt( event->pos(), true ) );
|
||||||
const int clickedIndex( tabIndexAt( position, false ) );
|
|
||||||
_itemData.animate( AnimationEnter|AnimationSameTarget, clickedIndex );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1791,7 +1790,6 @@ namespace Oxygen
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1802,19 +1800,17 @@ namespace Oxygen
|
||||||
|
|
||||||
// check format
|
// check format
|
||||||
if( !event->mimeData()->hasFormat( tabDragMimeType() ) ) return false;
|
if( !event->mimeData()->hasFormat( tabDragMimeType() ) ) return false;
|
||||||
|
|
||||||
|
// animate
|
||||||
if( event->source() != widget() )
|
if( event->source() != widget() )
|
||||||
{
|
{
|
||||||
|
|
||||||
const QPoint position( event->pos() );
|
_itemData.animate( AnimationMove, tabIndexAt( event->pos(), true ) );
|
||||||
_itemData.animate( AnimationMove, tabIndexAt( position, true ) );
|
|
||||||
|
|
||||||
} else if( _itemData.count() > 1 ) {
|
} else if( _itemData.count() > 1 ) {
|
||||||
|
|
||||||
if( _dragStartTimer.isActive() ) _dragStartTimer.stop();
|
if( _dragStartTimer.isActive() ) _dragStartTimer.stop();
|
||||||
|
_itemData.animate( AnimationMove|AnimationSameTarget, tabIndexAt( event->pos(), true ) );
|
||||||
const QPoint position( event->pos() );
|
|
||||||
const int clickedIndex( tabIndexAt( position, false ) );
|
|
||||||
_itemData.animate( AnimationMove|AnimationSameTarget, clickedIndex );
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1834,20 +1830,15 @@ namespace Oxygen
|
||||||
|
|
||||||
_itemData.setDirty( true );
|
_itemData.setDirty( true );
|
||||||
|
|
||||||
if( widget() != event->source() )
|
if( widget() != event->source() ) setForceActive( true );
|
||||||
setForceActive( true );
|
|
||||||
|
|
||||||
const long source = QString( groupData->data( tabDragMimeType() ) ).toLong();
|
const long source = QString( groupData->data( tabDragMimeType() ) ).toLong();
|
||||||
int clickedIndex( tabIndexAt( point, true ) );
|
const int clickedIndex( tabIndexAt( point, true ) );
|
||||||
if (clickedIndex < 0)
|
if( clickedIndex < 0 ) tab_A_behind_B( source, tabId(_itemData.count()-1) );
|
||||||
tab_A_behind_B(source, tabId(_itemData.count() - 1));
|
else tab_A_before_B( source, tabId(clickedIndex) );
|
||||||
else if (clickedIndex)
|
|
||||||
tab_A_behind_B(source, tabId(clickedIndex));
|
|
||||||
else
|
|
||||||
tab_A_before_B(source, tabId(clickedIndex));
|
|
||||||
|
|
||||||
if( widget() == event->source() )
|
// update title
|
||||||
updateTitleRect();
|
if( widget() == event->source() ) updateTitleRect();
|
||||||
|
|
||||||
_titleAnimationData->reset();
|
_titleAnimationData->reset();
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue