Fix mssql browser items not correctly populated before refreshing

This commit is contained in:
Nyall Dawson 2016-02-03 16:31:16 +11:00
parent 316a941f43
commit 75fcd2d0d2
2 changed files with 20 additions and 0 deletions

View File

@ -206,6 +206,7 @@ QVector<QgsDataItem*> QgsMssqlConnectionItem::createChildren()
if ( !schemaItem )
{
schemaItem = new QgsMssqlSchemaItem( this, layer.schemaName, mPath + '/' + layer.schemaName );
schemaItem->setState( Populating );
children.append( schemaItem );
}
@ -246,12 +247,28 @@ QVector<QgsDataItem*> QgsMssqlConnectionItem::createChildren()
// spawn threads (new layers will be added later on)
if ( mColumnTypeThread )
{
connect( mColumnTypeThread, SIGNAL( finished() ), this, SLOT( setChildrenAsPopulated() ) );
mColumnTypeThread->start();
}
else
{
//set all as populated
setChildrenAsPopulated();
}
}
return children;
}
void QgsMssqlConnectionItem::setChildrenAsPopulated()
{
Q_FOREACH ( QgsDataItem *child, mChildren )
{
child->setState( Populated );
}
}
void QgsMssqlConnectionItem::setLayerType( QgsMssqlLayerProperty layerProperty )
{
QgsMssqlSchemaItem *schemaItem = nullptr;

View File

@ -77,6 +77,9 @@ class QgsMssqlConnectionItem : public QgsDataCollectionItem
void refresh() override;
private slots:
void setChildrenAsPopulated();
private:
QString mConnInfo;
QString mService;