Skip to content

Commit

Permalink
use smaller button, alternate row colors
Browse files Browse the repository at this point in the history
  • Loading branch information
3nids authored and m-kuhn committed Oct 15, 2018
1 parent 8b32aae commit 5a11b22
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
15 changes: 10 additions & 5 deletions src/app/qgsgeometryvalidationdock.cpp
Expand Up @@ -14,7 +14,7 @@ email : matthias@opengis.ch
***************************************************************************/

#include <QButtonGroup>

#include <QToolButton>

#include "qgsgeometryvalidationdock.h"
#include "qgsgeometryvalidationmodel.h"
Expand All @@ -39,6 +39,7 @@ QgsGeometryValidationDock::QgsGeometryValidationDock( const QString &title, QgsM
QFont font = mProblemDescriptionLabel->font();
font.setBold( true );
mProblemDescriptionLabel->setFont( font );
mErrorListView->setAlternatingRowColors( true );

connect( mNextButton, &QPushButton::clicked, this, &QgsGeometryValidationDock::gotoNextError );
connect( mPreviousButton, &QPushButton::clicked, this, &QgsGeometryValidationDock::gotoPreviousError );
Expand Down Expand Up @@ -166,20 +167,24 @@ void QgsGeometryValidationDock::onCurrentErrorChanged( const QModelIndex &curren
QgsGeometryCheckError *error = current.data( QgsGeometryValidationModel::GeometryCheckErrorRole ).value<QgsGeometryCheckError *>();
if ( error )
{
while ( QPushButton *btn = mResolutionWidget->findChild<QPushButton *>() )
delete btn;
const QStringList resolutionMethods = error->check()->resolutionMethods();
QGridLayout *layout = new QGridLayout( mResolutionWidget );
int resolutionIndex = 0;
for ( const QString &resolutionMethod : resolutionMethods )
{
QPushButton *resolveBtn = new QPushButton( resolutionMethod );
QToolButton *resolveBtn = new QToolButton( mResolutionWidget );
resolveBtn->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/algorithms/mAlgorithmCheckGeometry.svg" ) ) );
layout->addWidget( resolveBtn, resolutionIndex, 0 );
QLabel *resolveLabel = new QLabel( resolutionMethod, mResolutionWidget );
resolveLabel->setWordWrap( true );
layout->addWidget( resolveLabel, resolutionIndex, 1 );
connect( resolveBtn, &QPushButton::clicked, this, [resolutionIndex, error, this]()
{
mGeometryValidationService->fixError( error, resolutionIndex );
} );
mResolutionWidget->layout()->addWidget( resolveBtn );
resolutionIndex++;
}
mResolutionWidget->setLayout( layout );
}

bool hasFeature = !FID_IS_NULL( current.data( QgsGeometryValidationModel::ErrorFeatureIdRole ) );
Expand Down
18 changes: 8 additions & 10 deletions src/ui/qgsgeometryvalidationdockbase.ui
Expand Up @@ -71,23 +71,14 @@
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QWidget" name="mResolutionWidget" native="true">
<layout class="QVBoxLayout" name="verticalLayout"/>
</widget>
<widget class="QWidget" name="mResolutionWidget" native="true"/>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QListView" name="mErrorListView"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mValidationRunningLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QToolButton" name="mTopologyChecksPendingButton">
<property name="text">
Expand All @@ -99,6 +90,13 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="mValidationRunningLabel">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
Expand Down

0 comments on commit 5a11b22

Please sign in to comment.