@ -185,10 +185,11 @@ namespace AzToolsFramework
void AssetBrowserTreeView : : rowsAboutToBeRemoved ( const QModelIndex & parent , int start , int end )
void AssetBrowserTreeView : : rowsAboutToBeRemoved ( const QModelIndex & parent , int start , int end )
{
{
// if selected entry is being removed, clear selection so not to select (and attempt to preview) other entries potentially marked for deletion
// if selected entry is being removed, clear selection so not to select (and attempt to preview) other entries potentially
if ( selectionModel ( ) & & selectionModel ( ) - > selectedIndexes ( ) . size ( ) = = 1 )
// marked for deletion
if ( selectionModel ( ) & & selectedIndexes ( ) . size ( ) = = 1 )
{
{
QModelIndex selectedIndex = select ionModel( ) - > select edIndexes( ) . first ( ) ;
QModelIndex selectedIndex = select edIndexes( ) . first ( ) ;
QModelIndex parentSelectedIndex = selectedIndex . parent ( ) ;
QModelIndex parentSelectedIndex = selectedIndex . parent ( ) ;
if ( parentSelectedIndex = = parent & & selectedIndex . row ( ) > = start & & selectedIndex . row ( ) < = end )
if ( parentSelectedIndex = = parent & & selectedIndex . row ( ) > = start & & selectedIndex . row ( ) < = end )
{
{
@ -198,6 +199,14 @@ namespace AzToolsFramework
QTreeView : : rowsAboutToBeRemoved ( parent , start , end ) ;
QTreeView : : rowsAboutToBeRemoved ( parent , start , end ) ;
}
}
// Item data for hidden columns normally isn't copied by Qt during drag-and-drop (see QTBUG-30242).
// However, for the AssetBrowser, the hidden columns should get copied. By overriding selectedIndexes() to
// include all selected indices, not just the visible ones, we can get the behavior we're looking for.
QModelIndexList AssetBrowserTreeView : : selectedIndexes ( ) const
{
return selectionModel ( ) - > selectedIndexes ( ) ;
}
void AssetBrowserTreeView : : SetThumbnailContext ( const char * thumbnailContext ) const
void AssetBrowserTreeView : : SetThumbnailContext ( const char * thumbnailContext ) const
{
{
m_delegate - > SetThumbnailContext ( thumbnailContext ) ;
m_delegate - > SetThumbnailContext ( thumbnailContext ) ;