Skip to content

Commit

Permalink
Show tooltips in sql results window
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Mar 21, 2023
1 parent 4985633 commit 1a29880
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/core/qgsqueryresultmodel.cpp
Expand Up @@ -14,6 +14,7 @@
* *
***************************************************************************/
#include "qgsqueryresultmodel.h"
#include "qgsexpression.h"

const int QgsQueryResultModel::FETCH_MORE_ROWS_COUNT = 400;

Expand Down Expand Up @@ -115,7 +116,7 @@ QVariant QgsQueryResultModel::data( const QModelIndex &index, int role ) const

switch ( role )
{
case Qt::DisplayRole:
case Qt::DisplayRole:
{
const QList<QVariant> result = mRows.at( index.row() );
if ( index.column() < result.count( ) )
Expand All @@ -124,6 +125,17 @@ QVariant QgsQueryResultModel::data( const QModelIndex &index, int role ) const
}
break;
}

case Qt::ToolTipRole:
{
const QList<QVariant> result = mRows.at( index.row() );
if ( index.column() < result.count( ) )
{
const QVariant value = result.at( index.column() );
return QgsExpression::formatPreviewString( value, true, 255 );
}
break;
}
}
return QVariant();
}
Expand Down

0 comments on commit 1a29880

Please sign in to comment.