[MSSQL] Add toogle action to browser node to show non spatial tables

This commit is contained in:
Nathan Woodrow 2014-05-21 12:05:33 +10:00
parent 15e1129bb1
commit 885a303109
2 changed files with 16 additions and 0 deletions

View File

@ -306,6 +306,12 @@ QList<QAction*> QgsMssqlConnectionItem::actions()
{
QList<QAction*> lst;
QAction* actionShowNoGeom = new QAction( tr( "Show non-spatial tables" ), this );
actionShowNoGeom->setCheckable( true );
actionShowNoGeom->setChecked( mAllowGeometrylessTables );
connect( actionShowNoGeom, SIGNAL( toggled(bool) ), this, SLOT( setAllowGeometrylessTables(bool) ) );
lst.append( actionShowNoGeom );
QAction* actionEdit = new QAction( tr( "Edit..." ), this );
connect( actionEdit, SIGNAL( triggered() ), this, SLOT( editConnection() ) );
lst.append( actionEdit );
@ -317,6 +323,15 @@ QList<QAction*> QgsMssqlConnectionItem::actions()
return lst;
}
void QgsMssqlConnectionItem::setAllowGeometrylessTables( bool allow )
{
mAllowGeometrylessTables = allow;
QString key = "/MSSQL/connections/" + mName;
QSettings settings;
settings.setValue(key + "/allowGeometrylessTables", allow );
refresh();
}
void QgsMssqlConnectionItem::editConnection()
{
QgsMssqlNewConnection nc( NULL, mName );

View File

@ -70,6 +70,7 @@ class QgsMssqlConnectionItem : public QgsDataCollectionItem
public slots:
void editConnection();
void deleteConnection();
void setAllowGeometrylessTables( bool allow );
void setLayerType( QgsMssqlLayerProperty layerProperty );