@@ -76,7 +76,9 @@ QgsGeometryCheckerResultTab::QgsGeometryCheckerResultTab( QgisInterface* iface,
76
76
77
77
ui.progressBarFixErrors ->setVisible ( false );
78
78
ui.tableWidgetErrors ->horizontalHeader ()->setSortIndicator ( 0 , Qt::AscendingOrder );
79
+ // Not sure why, but this is needed...
79
80
ui.tableWidgetErrors ->setSortingEnabled ( true );
81
+ ui.tableWidgetErrors ->setSortingEnabled ( false );
80
82
}
81
83
82
84
QgsGeometryCheckerResultTab::~QgsGeometryCheckerResultTab ()
@@ -88,8 +90,9 @@ QgsGeometryCheckerResultTab::~QgsGeometryCheckerResultTab()
88
90
qDeleteAll ( mCurrentRubberBands );
89
91
}
90
92
91
- void QgsGeometryCheckerResultTab::showCheckMessages ()
93
+ void QgsGeometryCheckerResultTab::finalize ()
92
94
{
95
+ ui.tableWidgetErrors ->setSortingEnabled ( true );
93
96
if ( !mChecker ->getMessages ().isEmpty () )
94
97
{
95
98
QDialog dialog;
@@ -107,11 +110,6 @@ void QgsGeometryCheckerResultTab::showCheckMessages()
107
110
108
111
void QgsGeometryCheckerResultTab::addError ( QgsGeometryCheckError *error )
109
112
{
110
- // Disable sorting to prevent crashes: if i.e. sorting by col 0, as soon as the item(row, 0)
111
- // is set, the row is potentially moved due to sorting, and subsequent item(row, col) reference wrong
112
- // item
113
- ui.tableWidgetErrors ->setSortingEnabled ( false );
114
-
115
113
int row = ui.tableWidgetErrors ->rowCount ();
116
114
int prec = 7 - std::floor ( qMax ( 0 ., std::log10 ( qMax ( error->location ().x (), error->location ().y () ) ) ) );
117
115
QString posStr = QString ( " %1, %2" ).arg ( error->location ().x (), 0 , ' f' , prec ).arg ( error->location ().y (), 0 , ' f' , prec );
@@ -144,8 +142,6 @@ void QgsGeometryCheckerResultTab::addError( QgsGeometryCheckError *error )
144
142
ui.labelErrorCount ->setText ( tr ( " Total errors: %1, fixed errors: %2" ).arg ( mErrorCount ).arg ( mFixedCount ) );
145
143
mStatistics .newErrors .insert ( error );
146
144
mErrorMap .insert ( error, QPersistentModelIndex ( ui.tableWidgetErrors ->model ()->index ( row, 0 ) ) );
147
-
148
- ui.tableWidgetErrors ->setSortingEnabled ( true );
149
145
}
150
146
151
147
void QgsGeometryCheckerResultTab::updateError ( QgsGeometryCheckError *error, bool statusChanged )
0 commit comments