Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add tooltip help to SQL editor and fix uid
  • Loading branch information
Hugo Mercier committed Jan 7, 2016
1 parent 0eb6cca commit 4bb09d0
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 58 deletions.
2 changes: 1 addition & 1 deletion src/providers/virtual/qgsvirtuallayersourceselect.cpp
Expand Up @@ -56,7 +56,7 @@ QgsVirtualLayerSourceSelect::QgsVirtualLayerSourceSelect( QWidget* parent, Qt::W

if ( !def.uid().isEmpty() )
{
mUIDColumnNameRadio->setChecked( true );
mUIDColumnNameChck->setChecked( true );
mUIDField->setText( def.uid() );
}

Expand Down
93 changes: 36 additions & 57 deletions src/providers/virtual/qgsvirtuallayersourceselectbase.ui
Expand Up @@ -58,54 +58,36 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QgsCodeEditorSQL" name="mQueryEdit" native="true"/>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QgsCollapsibleGroupBox" name="mUIDGroup">
<property name="title">
<string>Unique row identifier</string>
</property>
<property name="collapsed">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<widget class="QRadioButton" name="mAutoincrementUIDRadio">
<property name="text">
<string>Autoincrement</string>
</property>
<property name="checked">
<bool>true</bool>
<widget class="QgsCodeEditorSQL" name="mQueryEdit" native="true">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This is the SQL query editor.&lt;/p&gt;&lt;p&gt;Virtual layers rely on SQLite and Spatialite. Any functions from SQLite or Spatialite can then be used in the query.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Special comments:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Because it is not always possible to autodetect the data type of each column in a query, special comments can be used in the query to force a specific type.&lt;/p&gt;&lt;p&gt;Special comments must be placed on the right of a column name and have the form &lt;tt&gt;/*:type*/&lt;/tt&gt; where type can be any of &lt;span style=&quot; font-style:italic;&quot;&gt;int&lt;/span&gt;, &lt;span style=&quot; font-style:italic;&quot;&gt;real&lt;/span&gt; or &lt;span style=&quot; font-style:italic;&quot;&gt;text&lt;/span&gt;. They can also be used to specify the type and SRID of the geometry column with the following syntax: &lt;tt&gt;/*:gtype:srid*/&lt;/tt&gt; where &lt;span style=&quot; font-style:italic;&quot;&gt;gtype&lt;/span&gt; can be &lt;span style=&quot; font-style:italic;&quot;&gt;point&lt;/span&gt;, &lt;span style=&quot; font-style:italic;&quot;&gt;linestring&lt;/span&gt; or &lt;span style=&quot; font-style:italic;&quot;&gt;polygon&lt;/span&gt; (with an optional &lt;span style=&quot; font-style:italic;&quot;&gt;multi&lt;/span&gt; prefix) and &lt;span style=&quot; font-style:italic;&quot;&gt;srid&lt;/span&gt; is an integer identifier.&lt;/p&gt;&lt;p&gt;Example:&lt;/p&gt;&lt;p&gt;&lt;tt&gt;SELECT id + 1 as id /*:int*/, ST_Centroid(geometry) as geom /*:point:4326*/ FROM tab&lt;/tt&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QRadioButton" name="mUIDColumnNameRadio">
<property name="text">
<string>Column name</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="mUIDField">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QCheckBox" name="mUIDColumnNameChck">
<property name="text">
<string>Unique identifier column</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="mUIDField">
<property name="enabled">
<bool>false</bool>
</property>
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QgsCollapsibleGroupBox" name="mGeometryGroup">
<property name="title">
Expand Down Expand Up @@ -276,16 +258,13 @@
</customwidgets>
<tabstops>
<tabstop>mLayerName</tabstop>
<tabstop>mUIDGroup</tabstop>
<tabstop>mGeometryGroup</tabstop>
<tabstop>buttonBox</tabstop>
<tabstop>mGeometryRadio</tabstop>
<tabstop>mGeometryField</tabstop>
<tabstop>mGeometryType</tabstop>
<tabstop>mCRS</tabstop>
<tabstop>mBrowseCRSBtn</tabstop>
<tabstop>mUIDField</tabstop>
<tabstop>mUIDColumnNameRadio</tabstop>
</tabstops>
<resources/>
<connections>
Expand Down Expand Up @@ -322,34 +301,34 @@
</hints>
</connection>
<connection>
<sender>mUIDColumnNameRadio</sender>
<sender>mGeometryRadio</sender>
<signal>toggled(bool)</signal>
<receiver>mUIDField</receiver>
<receiver>mGeometryFrame</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>88</x>
<y>510</y>
<x>36</x>
<y>729</y>
</hint>
<hint type="destinationlabel">
<x>511</x>
<y>510</y>
<x>460</x>
<y>729</y>
</hint>
</hints>
</connection>
<connection>
<sender>mGeometryRadio</sender>
<sender>mUIDColumnNameChck</sender>
<signal>toggled(bool)</signal>
<receiver>mGeometryFrame</receiver>
<receiver>mUIDField</receiver>
<slot>setEnabled(bool)</slot>
<hints>
<hint type="sourcelabel">
<x>36</x>
<y>729</y>
<x>107</x>
<y>431</y>
</hint>
<hint type="destinationlabel">
<x>460</x>
<y>729</y>
<x>543</x>
<y>432</y>
</hint>
</hints>
</connection>
Expand Down

0 comments on commit 4bb09d0

Please sign in to comment.