Skip to content

Commit 49b3cee

Browse files
committedOct 23, 2017
[Geometry checker] Various ui improvements
1 parent 374e186 commit 49b3cee

File tree

2 files changed

+18
-12
lines changed

2 files changed

+18
-12
lines changed
 

‎src/plugins/geometry_checker/ui/qgsgeometrycheckerresulttab.cpp‎

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ QgsGeometryCheckerResultTab::QgsGeometryCheckerResultTab( QgisInterface *iface,
9898

9999
ui.progressBarFixErrors->setVisible( false );
100100
ui.tableWidgetErrors->horizontalHeader()->setSortIndicator( 0, Qt::AscendingOrder );
101+
ui.tableWidgetErrors->resizeColumnToContents( 0 );
102+
ui.tableWidgetErrors->resizeColumnToContents( 1 );
103+
ui.tableWidgetErrors->horizontalHeader()->setResizeMode( 2, QHeaderView::Stretch );
104+
ui.tableWidgetErrors->horizontalHeader()->setResizeMode( 3, QHeaderView::Stretch );
105+
ui.tableWidgetErrors->horizontalHeader()->setResizeMode( 4, QHeaderView::Stretch );
106+
ui.tableWidgetErrors->horizontalHeader()->setResizeMode( 5, QHeaderView::Stretch );
101107
// Not sure why, but this is needed...
102108
ui.tableWidgetErrors->setSortingEnabled( true );
103109
ui.tableWidgetErrors->setSortingEnabled( false );
@@ -398,7 +404,7 @@ void QgsGeometryCheckerResultTab::highlightErrors( bool current )
398404
void QgsGeometryCheckerResultTab::onSelectionChanged( const QItemSelection &newSel, const QItemSelection &/*oldSel*/ )
399405
{
400406
QModelIndex idx = ui.tableWidgetErrors->currentIndex();
401-
if ( idx.isValid() && !ui.tableWidgetErrors->isRowHidden( idx.row() ) && ui.tableWidgetErrors->selectionModel()->selectedIndexes().contains( idx ) )
407+
if ( idx.isValid() && !ui.tableWidgetErrors->isRowHidden( idx.row() ) && newSel.contains( idx ) )
402408
{
403409
highlightErrors();
404410
}
@@ -484,6 +490,7 @@ void QgsGeometryCheckerResultTab::fixErrors( bool prompt )
484490
connect( &fixdialog, &QgsGeometryCheckerFixDialog::currentErrorChanged, this, &QgsGeometryCheckerResultTab::highlightError );
485491
connect( &fixdialog, &QDialog::finished, &loop, &QEventLoop::quit );
486492
fixdialog.show();
493+
fixdialog.move( window()->frameGeometry().topLeft() + window()->rect().center() - fixdialog.rect().center() );
487494
parentWidget()->parentWidget()->parentWidget()->setEnabled( false );
488495
loop.exec();
489496
parentWidget()->parentWidget()->parentWidget()->setEnabled( true );
@@ -512,13 +519,10 @@ void QgsGeometryCheckerResultTab::fixErrors( bool prompt )
512519

513520
if ( mStatistics.itemCount() > 0 )
514521
{
522+
parentWidget()->parentWidget()->parentWidget()->setEnabled( false );
515523
QgsGeometryCheckerFixSummaryDialog summarydialog( mStatistics, mChecker, mIface->mainWindow() );
516-
QEventLoop loop;
517524
connect( &summarydialog, &QgsGeometryCheckerFixSummaryDialog::errorSelected, this, &QgsGeometryCheckerResultTab::highlightError );
518-
connect( &summarydialog, &QDialog::finished, &loop, &QEventLoop::quit );
519-
summarydialog.show();
520-
parentWidget()->parentWidget()->parentWidget()->setEnabled( false );
521-
loop.exec();
525+
summarydialog.exec();
522526
parentWidget()->parentWidget()->parentWidget()->setEnabled( true );
523527
}
524528
mCloseable = true;
@@ -546,9 +550,9 @@ void QgsGeometryCheckerResultTab::setDefaultResolutionMethods()
546550

547551
QVBoxLayout *layout = new QVBoxLayout( &dialog );
548552

549-
scrollArea->setFrameShape( QFrame::NoFrame );
550-
layout->setContentsMargins( 0, 0, 0, 0 );
551553
QgsGeometryCheckerUtils::VScrollArea *scrollArea = new QgsGeometryCheckerUtils::VScrollArea( &dialog );
554+
layout->setContentsMargins( 6, 6, 6, 6 );
555+
layout->addWidget( new QLabel( tr( "Select default error resolutions:" ) ) );
552556
layout->addWidget( scrollArea );
553557

554558
QWidget *scrollAreaContents = new QWidget( scrollArea );
@@ -577,6 +581,7 @@ void QgsGeometryCheckerResultTab::setDefaultResolutionMethods()
577581

578582
scrollAreaLayout->addWidget( groupBox );
579583
}
584+
scrollAreaLayout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Preferred, QSizePolicy::Expanding ) );
580585
scrollArea->setWidget( scrollAreaContents );
581586

582587
QDialogButtonBox *buttonBox = new QDialogButtonBox( QDialogButtonBox::Ok, Qt::Horizontal, &dialog );

‎src/plugins/geometry_checker/ui/qgsgeometrycheckfixdialog.cpp‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,29 +41,30 @@ QgsGeometryCheckerFixDialog::QgsGeometryCheckerFixDialog( QgsGeometryChecker *ch
4141
setWindowTitle( tr( "Fix Errors" ) );
4242

4343
QGridLayout *layout = new QGridLayout();
44-
layout->setContentsMargins( 4, 4, 4, 4 );
44+
layout->setContentsMargins( 6, 6, 6, 6 );
4545
setLayout( layout );
4646

4747
mResolutionsBox = new QGroupBox();
4848
mResolutionsBox->setFlat( true );
4949
mResolutionsBox->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
5050
layout->addWidget( mResolutionsBox, 0, 0, 1, 2 );
51+
layout->addItem( new QSpacerItem( 1, 1, QSizePolicy::Preferred, QSizePolicy::Expanding ), 1, 0, 1, 2 );
5152

5253
mStatusLabel = new QLabel();
53-
layout->addWidget( mStatusLabel, 1, 0, 1, 2 );
54+
layout->addWidget( mStatusLabel, 2, 0, 1, 2 );
5455

5556
mButtonBox = new QDialogButtonBox( QDialogButtonBox::Abort, Qt::Horizontal );
5657
mNextBtn = mButtonBox->addButton( tr( "Next" ), QDialogButtonBox::ActionRole );
5758
mFixBtn = mButtonBox->addButton( tr( "Fix" ), QDialogButtonBox::ActionRole );
5859
mSkipBtn = mButtonBox->addButton( tr( "Skip" ), QDialogButtonBox::ActionRole );
5960
mNextBtn->setAutoDefault( true );
6061
mFixBtn->setAutoDefault( true );
61-
layout->addWidget( mButtonBox, 2, 0, 1, 1 );
62+
layout->addWidget( mButtonBox, 3, 0, 1, 1 );
6263

6364
mProgressBar = new QProgressBar();
6465
mProgressBar->setRange( 0, errors.size() );
6566
mProgressBar->setValue( 0 );
66-
layout->addWidget( mProgressBar, 2, 1, 1, 1 );
67+
layout->addWidget( mProgressBar, 3, 1, 1, 1 );
6768

6869
mRadioGroup = new QButtonGroup( this );
6970

0 commit comments

Comments
 (0)
Please sign in to comment.