Skip to content
Permalink
Browse files

use smaller button, alternate row colors

  • Loading branch information
3nids authored and m-kuhn committed Oct 1, 2018
1 parent 8b32aae commit 5a11b22d370ddd0ca37e902c83d0462bd3a0dc26
Showing with 18 additions and 15 deletions.
  1. +10 −5 src/app/qgsgeometryvalidationdock.cpp
  2. +8 −10 src/ui/qgsgeometryvalidationdockbase.ui
@@ -14,7 +14,7 @@ email : matthias@opengis.ch
***************************************************************************/

#include <QButtonGroup>

#include <QToolButton>

#include "qgsgeometryvalidationdock.h"
#include "qgsgeometryvalidationmodel.h"
@@ -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 );
@@ -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 ) );
@@ -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">
@@ -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>

0 comments on commit 5a11b22

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