Skip to content

Commit

Permalink
[ux] Symbology, drag and drop on flat lists: Add comments to clarify …
Browse files Browse the repository at this point in the history
…the approach and perhaps avoid eventual regressions later
  • Loading branch information
gacarrillor authored and github-actions[bot] committed Feb 25, 2025
1 parent 11348b8 commit e5b242d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/gui/symbology/qgscategorizedsymbolrendererwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ QgsRendererCategory QgsCategorizedSymbolRendererModel::category( const QModelInd

Qt::ItemFlags QgsCategorizedSymbolRendererModel::flags( const QModelIndex &index ) const
{
// Flat list, to ease drop handling valid indexes are not dropEnabled
if ( !index.isValid() || !mRenderer )
{
return Qt::ItemIsDropEnabled;
Expand Down Expand Up @@ -399,7 +400,7 @@ QMimeData *QgsCategorizedSymbolRendererModel::mimeData( const QModelIndexList &i
bool QgsCategorizedSymbolRendererModel::dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent )
{
Q_UNUSED( column )
Q_UNUSED( parent ) // Unused because only valid indexes have Qt::ItemIsDropEnabled
Q_UNUSED( parent ) // Unused because only invalid indexes have Qt::ItemIsDropEnabled
if ( action != Qt::MoveAction )
return true;

Expand Down
3 changes: 2 additions & 1 deletion src/gui/symbology/qgsgraduatedsymbolrendererwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ QgsRendererRange QgsGraduatedSymbolRendererModel::rendererRange( const QModelInd

Qt::ItemFlags QgsGraduatedSymbolRendererModel::flags( const QModelIndex &index ) const
{
// Flat list, to ease drop handling valid indexes are not dropEnabled
if ( !index.isValid() )
{
return Qt::ItemIsDropEnabled;
Expand Down Expand Up @@ -307,7 +308,7 @@ QMimeData *QgsGraduatedSymbolRendererModel::mimeData( const QModelIndexList &ind
bool QgsGraduatedSymbolRendererModel::dropMimeData( const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent )
{
Q_UNUSED( column )
Q_UNUSED( parent ) // Unused because only valid indexes have Qt::ItemIsDropEnabled
Q_UNUSED( parent ) // Unused because only invalid indexes have Qt::ItemIsDropEnabled
if ( action != Qt::MoveAction )
return true;

Expand Down

0 comments on commit e5b242d

Please sign in to comment.