Skip to content
Permalink
Browse files

[Geometry checker] Add layer column to fix summary dialog tables

  • Loading branch information
manisandro committed Jun 28, 2017
1 parent e0caef9 commit 374e1865566a5f9880a42d5a2da9ff4235e72bec
@@ -70,25 +70,26 @@ void QgsGeometryCheckerFixSummaryDialog::addError( QTableWidget *table, QgsGeome

int row = table->rowCount();
table->insertRow( row );
table->setItem( row, 0, new QTableWidgetItem( mChecker->getContext()->featurePools[error->layerId()]->getLayer()->name() ) );
QTableWidgetItem *idItem = new QTableWidgetItem();
idItem->setData( Qt::EditRole, error->featureId() != FEATUREID_NULL ? QVariant( error->featureId() ) : QVariant() );
idItem->setData( Qt::UserRole, QVariant::fromValue( reinterpret_cast<void *>( error ) ) );
table->setItem( row, 0, idItem );
table->setItem( row, 1, new QTableWidgetItem( error->description() ) );
table->setItem( row, 2, new QTableWidgetItem( posStr ) );
table->setItem( row, 1, idItem );
table->setItem( row, 2, new QTableWidgetItem( error->description() ) );
table->setItem( row, 3, new QTableWidgetItem( posStr ) );
QTableWidgetItem *valueItem = new QTableWidgetItem();
valueItem->setData( Qt::EditRole, error->value() );
table->setItem( row, 3, valueItem );
table->setItem( row, 4, valueItem );
table->item( row, 0 )->setData( Qt::UserRole, QVariant::fromValue( reinterpret_cast<void *>( error ) ) );
QTextStream( stdout ) << "Set data: " << row << " = " << error << endl;
}

void QgsGeometryCheckerFixSummaryDialog::setupTable( QTableWidget *table )
{
table->resizeColumnToContents( 0 );
table->horizontalHeader()->setSectionResizeMode( 1, QHeaderView::Stretch );
table->horizontalHeader()->setSectionResizeMode( 2, QHeaderView::Stretch );
table->horizontalHeader()->setSectionResizeMode( 3, QHeaderView::Stretch );
table->horizontalHeader()->setSectionResizeMode( 4, QHeaderView::Stretch );

table->resizeColumnToContents( 1 );
table->horizontalHeader()->setResizeMode( 2, QHeaderView::Stretch );
table->horizontalHeader()->setResizeMode( 3, QHeaderView::Stretch );
table->horizontalHeader()->setResizeMode( 4, QHeaderView::Stretch );
table->setEditTriggers( QAbstractItemView::NoEditTriggers );
table->setSelectionBehavior( QAbstractItemView::SelectRows );
table->setSelectionMode( QAbstractItemView::SingleSelection );
@@ -101,15 +102,18 @@ void QgsGeometryCheckerFixSummaryDialog::setupTable( QTableWidget *table )

void QgsGeometryCheckerFixSummaryDialog::onTableSelectionChanged( const QItemSelection &newSel, const QItemSelection & /*oldSel*/ )
{
const QAbstractItemModel *model = qobject_cast<QItemSelectionModel *>( QObject::sender() )->model();
QItemSelectionModel *selModel = qobject_cast<QItemSelectionModel *>( QObject::sender() );
const QAbstractItemModel *model = selModel->model();

for ( QTableWidget *table : QList<QTableWidget *>() << ui.tableWidgetFixedErrors << ui.tableWidgetNewErrors << ui.tableWidgetNotFixed << ui.tableWidgetObsoleteErrors )
if ( table->model() != model )
for ( QTableWidget *table : {ui.tableWidgetFixedErrors, ui.tableWidgetNewErrors, ui.tableWidgetNotFixed, ui.tableWidgetObsoleteErrors} )
{
if ( table->selectionModel() != selModel )
{
table->selectionModel()->blockSignals( true );
table->clearSelection();
table->selectionModel()->blockSignals( false );
}
}

if ( !newSel.isEmpty() && !newSel.first().indexes().isEmpty() )
{
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>442</height>
<width>501</width>
<height>547</height>
</rect>
</property>
<property name="windowTitle">
@@ -43,6 +43,11 @@
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Layer</string>
</property>
</column>
<column>
<property name="text">
<string>Object ID</string>
@@ -100,6 +105,11 @@
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Layer</string>
</property>
</column>
<column>
<property name="text">
<string>Object ID</string>
@@ -157,6 +167,11 @@
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Layer</string>
</property>
</column>
<column>
<property name="text">
<string>Object ID</string>
@@ -214,6 +229,11 @@
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Layer</string>
</property>
</column>
<column>
<property name="text">
<string>Object ID</string>

0 comments on commit 374e186

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