Skip to content

Commit 885a303

Browse files
committed
[MSSQL] Add toogle action to browser node to show non spatial tables
1 parent 15e1129 commit 885a303

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

src/providers/mssql/qgsmssqldataitems.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,12 @@ QList<QAction*> QgsMssqlConnectionItem::actions()
306306
{
307307
QList<QAction*> lst;
308308

309+
QAction* actionShowNoGeom = new QAction( tr( "Show non-spatial tables" ), this );
310+
actionShowNoGeom->setCheckable( true );
311+
actionShowNoGeom->setChecked( mAllowGeometrylessTables );
312+
connect( actionShowNoGeom, SIGNAL( toggled(bool) ), this, SLOT( setAllowGeometrylessTables(bool) ) );
313+
lst.append( actionShowNoGeom );
314+
309315
QAction* actionEdit = new QAction( tr( "Edit..." ), this );
310316
connect( actionEdit, SIGNAL( triggered() ), this, SLOT( editConnection() ) );
311317
lst.append( actionEdit );
@@ -317,6 +323,15 @@ QList<QAction*> QgsMssqlConnectionItem::actions()
317323
return lst;
318324
}
319325

326+
void QgsMssqlConnectionItem::setAllowGeometrylessTables( bool allow )
327+
{
328+
mAllowGeometrylessTables = allow;
329+
QString key = "/MSSQL/connections/" + mName;
330+
QSettings settings;
331+
settings.setValue(key + "/allowGeometrylessTables", allow );
332+
refresh();
333+
}
334+
320335
void QgsMssqlConnectionItem::editConnection()
321336
{
322337
QgsMssqlNewConnection nc( NULL, mName );

src/providers/mssql/qgsmssqldataitems.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ class QgsMssqlConnectionItem : public QgsDataCollectionItem
7070
public slots:
7171
void editConnection();
7272
void deleteConnection();
73+
void setAllowGeometrylessTables( bool allow );
7374

7475
void setLayerType( QgsMssqlLayerProperty layerProperty );
7576

0 commit comments

Comments
 (0)