Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #2647 from mhugo/vlayer_gui
Virtual layers GUI integration
  • Loading branch information
Hugo Mercier committed Jan 11, 2016
2 parents be5d657 + bbf2137 commit 70f26b6
Show file tree
Hide file tree
Showing 21 changed files with 1,222 additions and 20 deletions.
1 change: 1 addition & 0 deletions images/images.qrc
Expand Up @@ -128,6 +128,7 @@
<file>themes/default/mActionAddWfsLayer.svg</file>
<file>themes/default/mActionAddWmsLayer.svg</file>
<file>themes/default/mActionAddDelimitedTextLayer.svg</file>
<file>themes/default/mActionAddVirtualLayer.svg</file>
<file>themes/default/mActionAlignBottom.png</file>
<file>themes/default/mActionAlignHCenter.png</file>
<file>themes/default/mActionAlignLeft.png</file>
Expand Down
276 changes: 276 additions & 0 deletions images/themes/default/mActionAddVirtualLayer.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions python/core/core.sip
Expand Up @@ -145,6 +145,7 @@
%Include qgsvisibilitypresetcollection.sip
%Include qgslayerdefinition.sip
%Include qgsvirtuallayerdefinition.sip
%Include qgsvirtuallayerdefinitionutils.sip
%Include qgsxmlutils.sip

%Include auth/qgsauthcertutils.sip
Expand Down
7 changes: 7 additions & 0 deletions python/core/layertree/qgslayertreeutils.sip
Expand Up @@ -44,4 +44,11 @@ class QgsLayerTreeUtils
static QString legendFilterByExpression( const QgsLayerTreeLayer& layer, bool* enabled = 0 );
//! Test if one of the layers in a group has an expression filter
static bool hasLegendFilterExpression( const QgsLayerTreeGroup& group );

//! Insert a QgsMapLayer just below another one
//! @param group the tree group where layers are (can be the root group)
//! @param refLayer the reference layer
//! @param layerToInsert the new layer to insert just below the reference layer
//! @returns the new tree layer
static QgsLayerTreeLayer* insertLayerBelow( QgsLayerTreeGroup* group, const QgsMapLayer* refLayer, QgsMapLayer* layerToInsert );
};
12 changes: 12 additions & 0 deletions python/core/qgsvirtuallayerdefinitionutils.sip
@@ -0,0 +1,12 @@
/**
* Utils class for QgsVirtualLayerDefinition
*/
class QgsVirtualLayerDefinitionUtils
{
%TypeHeaderCode
#include <qgsvirtuallayerdefinitionutils.h>
%End
public:
//! Get a virtual layer definition from a vector layer where vector joins are replaced by SQL LEFT JOINs
static QgsVirtualLayerDefinition fromJoinedLayer( QgsVectorLayer* joinedLayer );
};
9 changes: 4 additions & 5 deletions python/plugins/db_manager/db_plugins/vlayers/connector.py
Expand Up @@ -413,15 +413,14 @@ def getSqlDictionary(self):
from .sql_dictionary import getSqlDictionary
sql_dict = getSqlDictionary()

if True:
items = []
for tbl in self.getTables():
items.append(tbl[1]) # table name
items = []
for tbl in self.getTables():
items.append(tbl[1]) # table name

for fld in self.getTableFields((None, tbl[1])):
items.append(fld[1]) # field name

sql_dict["identifier"] = items
sql_dict["identifier"] = items
return sql_dict

def getQueryBuilderDictionary(self):
Expand Down

0 comments on commit 70f26b6

Please sign in to comment.