Skip to content
Permalink
Browse files

fix #4969

  • Loading branch information
jef-n committed Jun 18, 2012
1 parent d133099 commit 8eb323af13c0d949e6711eac04f553ba2e0848a8
Showing with 6 additions and 23 deletions.
  1. +6 −23 src/providers/postgres/qgspgtablemodel.cpp
@@ -90,22 +90,13 @@ void QgsPgTableModel::addTableEntry( QgsPostgresLayerProperty layerProperty )
QStandardItem *sridItem = new QStandardItem( layerProperty.srid );
sridItem->setEditable( false );

QString pkText, pkCol = "";
if ( layerProperty.pkCols.size() == 0 )
QString pkCol = "";
if ( layerProperty.pkCols.size() > 0 )
{
pkText = "";
}
else
{
if ( layerProperty.pkCols.size() > 1 )
{
pkText = tr( "Select..." );
}

pkCol = layerProperty.pkCols[0];
}

QStandardItem *pkItem = new QStandardItem( pkText );
QStandardItem *pkItem = new QStandardItem( pkCol );
if ( layerProperty.pkCols.size() > 1 )
pkItem->setFlags( pkItem->flags() | Qt::ItemIsEditable );
else
@@ -133,15 +124,11 @@ void QgsPgTableModel::addTableEntry( QgsPostgresLayerProperty layerProperty )
bool detailsFromThread = wkbType == QGis::WKBUnknown ||
( wkbType != QGis::WKBNoGeometry && layerProperty.srid.isEmpty() );

if ( detailsFromThread || pkText == tr( "Select..." ) )
if ( detailsFromThread )
{
Qt::ItemFlags flags = Qt::ItemIsSelectable;
if ( detailsFromThread )
flags |= Qt::ItemIsEnabled;

foreach( QStandardItem *item, childItemList )
{
item->setFlags( item->flags() & ~flags );
item->setFlags( item->flags() & ~( Qt::ItemIsSelectable | Qt::ItemIsEnabled ) );
}
}

@@ -274,13 +261,9 @@ void QgsPgTableModel::setGeometryTypesForTable( QgsPostgresLayerProperty layerPr

row[ dbtmSrid ]->setText( sridList.at( 0 ) );

Qt::ItemFlags flags = Qt::ItemIsEnabled;
if ( layerProperty.pkCols.size() < 2 )
flags |= Qt::ItemIsSelectable;

foreach( QStandardItem *item, row )
{
item->setFlags( item->flags() | flags );
item->setFlags( item->flags() | Qt::ItemIsSelectable | Qt::ItemIsEnabled );
}

for ( int j = 1; j < typeList.size(); j++ )

0 comments on commit 8eb323a

Please sign in to comment.
You can’t perform that action at this time.