Skip to content

Commit 51d8286

Browse files
committed
Tooltips for PG options in source select dialog
1 parent ad544a2 commit 51d8286

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/providers/postgres/qgspgtablemodel.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,11 @@ QgsPgTableModel::QgsPgTableModel()
3535
headerLabels << tr( "SRID" );
3636
headerLabels << tr( "Feature id" );
3737
headerLabels << tr( "Select at id" );
38-
headerLabels << tr( "Check pk unicity" );
38+
headerLabels << tr( "Check PK unicity" );
3939
headerLabels << tr( "Sql" );
4040
setHorizontalHeaderLabels( headerLabels );
41+
setHeaderData( 8, Qt::Orientation::Horizontal, tr( "Disable 'Fast Access to Features at ID' capability to force keeping the attribute table in memory (e.g. in case of expensive views)." ), Qt::ToolTipRole );
42+
setHeaderData( 9, Qt::Orientation::Horizontal, tr( "Enable check for primary key unicity when loading the features. This may slow down loading for large tables." ), Qt::ToolTipRole );
4143
}
4244

4345
void QgsPgTableModel::addTableEntry( const QgsPostgresLayerProperty &layerProperty )
@@ -121,12 +123,12 @@ void QgsPgTableModel::addTableEntry( const QgsPostgresLayerProperty &layerProper
121123
QStandardItem *selItem = new QStandardItem( QString() );
122124
selItem->setFlags( selItem->flags() | Qt::ItemIsUserCheckable );
123125
selItem->setCheckState( Qt::Checked );
124-
selItem->setToolTip( tr( "Disable 'Fast Access to Features at ID' capability to force keeping the attribute table in memory (e.g. in case of expensive views)." ) );
126+
selItem->setToolTip( headerData( 8, Qt::Orientation::Horizontal, Qt::ToolTipRole ).toString() );
125127

126128
QStandardItem *checkPkUnicityItem = new QStandardItem( QString() );
127129
checkPkUnicityItem->setFlags( checkPkUnicityItem->flags() | Qt::ItemIsUserCheckable );
128130
checkPkUnicityItem->setCheckState( Qt::Unchecked );
129-
checkPkUnicityItem->setToolTip( tr( "Enable check for primary key unicity when loading the features. This may slow down loading for large tables." ) );
131+
checkPkUnicityItem->setToolTip( headerData( 9, Qt::Orientation::Horizontal, Qt::ToolTipRole ).toString() );
130132

131133
QStandardItem *sqlItem = new QStandardItem( layerProperty.sql );
132134

@@ -152,7 +154,7 @@ void QgsPgTableModel::addTableEntry( const QgsPostgresLayerProperty &layerProper
152154
else
153155
item->setFlags( item->flags() & ~Qt::ItemIsSelectable );
154156

155-
if ( tip.isEmpty() )
157+
if ( tip.isEmpty() && item != checkPkUnicityItem && item != selItem )
156158
{
157159
item->setToolTip( QString() );
158160
}

0 commit comments

Comments
 (0)