Skip to content

Commit 75fcd2d

Browse files
committedFeb 3, 2016
Fix mssql browser items not correctly populated before refreshing
1 parent 316a941 commit 75fcd2d

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
 

‎src/providers/mssql/qgsmssqldataitems.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ QVector<QgsDataItem*> QgsMssqlConnectionItem::createChildren()
206206
if ( !schemaItem )
207207
{
208208
schemaItem = new QgsMssqlSchemaItem( this, layer.schemaName, mPath + '/' + layer.schemaName );
209+
schemaItem->setState( Populating );
209210
children.append( schemaItem );
210211
}
211212

@@ -246,12 +247,28 @@ QVector<QgsDataItem*> QgsMssqlConnectionItem::createChildren()
246247

247248
// spawn threads (new layers will be added later on)
248249
if ( mColumnTypeThread )
250+
{
251+
connect( mColumnTypeThread, SIGNAL( finished() ), this, SLOT( setChildrenAsPopulated() ) );
249252
mColumnTypeThread->start();
253+
}
254+
else
255+
{
256+
//set all as populated
257+
setChildrenAsPopulated();
258+
}
250259
}
251260

252261
return children;
253262
}
254263

264+
void QgsMssqlConnectionItem::setChildrenAsPopulated()
265+
{
266+
Q_FOREACH ( QgsDataItem *child, mChildren )
267+
{
268+
child->setState( Populated );
269+
}
270+
}
271+
255272
void QgsMssqlConnectionItem::setLayerType( QgsMssqlLayerProperty layerProperty )
256273
{
257274
QgsMssqlSchemaItem *schemaItem = nullptr;

‎src/providers/mssql/qgsmssqldataitems.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,9 @@ class QgsMssqlConnectionItem : public QgsDataCollectionItem
7777

7878
void refresh() override;
7979

80+
private slots:
81+
void setChildrenAsPopulated();
82+
8083
private:
8184
QString mConnInfo;
8285
QString mService;

0 commit comments

Comments
 (0)
Please sign in to comment.