Skip to content

Commit

Permalink
Fix mssql browser items not correctly populated before refreshing
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Feb 3, 2016
1 parent 316a941 commit 75fcd2d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/providers/mssql/qgsmssqldataitems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}

Expand Down Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/providers/mssql/qgsmssqldataitems.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ class QgsMssqlConnectionItem : public QgsDataCollectionItem

void refresh() override;

private slots:
void setChildrenAsPopulated();

private:
QString mConnInfo;
QString mService;
Expand Down

0 comments on commit 75fcd2d

Please sign in to comment.