Skip to content
Permalink
Browse files

Paste as - new memory layer name dialog

Save as dialog collapsible OGR options
  • Loading branch information
blazek committed Jul 3, 2013
1 parent 8d3199f commit fa668030081f0ef1261746c9570788255c8e02c0
Showing with 129 additions and 23 deletions.
  1. +2 −0 src/app/ogr/qgsvectorlayersaveasdialog.cpp
  2. +14 −0 src/app/qgisapp.cpp
  3. +113 −23 src/ui/qgsvectorlayersaveasdialogbase.ui
@@ -15,6 +15,7 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include "qgslogger.h"
#include "qgsvectorlayersaveasdialog.h"
#include "qgsgenericprojectionselector.h"
#include "qgsvectordataprovider.h"
@@ -51,6 +52,7 @@ void QgsVectorLayerSaveAsDialog::setup()
setupUi( this );
QSettings settings;
restoreGeometry( settings.value( "/Windows/VectorLayerSaveAs/geometry" ).toByteArray() );

QMap<QString, QString> map = QgsVectorFileWriter::ogrDriverList();
mFormatComboBox->blockSignals( true );
for ( QMap< QString, QString>::const_iterator it = map.constBegin(); it != map.constEnd(); ++it )
@@ -5568,9 +5568,23 @@ void QgisApp::pasteAsNewMemoryVector()
{
if ( mMapCanvas && mMapCanvas->isDrawing() ) return;

bool ok;
QString defaultName = tr( "Pasted" );
QString layerName = QInputDialog::getText( this, tr( "New memory layer name" ),
tr( "Layer name" ), QLineEdit::Normal,
defaultName, &ok );
if ( !ok ) return;

if ( layerName.isEmpty() )
{
layerName = defaultName;
}

QgsVectorLayer * layer = pasteToNewMemoryVector();
if ( !layer ) return;

layer->setLayerName( layerName );

mMapCanvas->freeze();

QgsMapLayerRegistry::instance()->addMapLayer( layer );
@@ -7,13 +7,22 @@
<x>0</x>
<y>0</y>
<width>383</width>
<height>496</height>
<height>444</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>Save vector layer as...</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="sizeConstraint">
<enum>QLayout::SetMinAndMaxSize</enum>
</property>
<item row="1" column="1">
<widget class="QLineEdit" name="leFilename">
<property name="enabled">
@@ -104,7 +113,7 @@
</property>
</widget>
</item>
<item row="10" column="0" colspan="3">
<item row="12" column="0" colspan="3">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -118,16 +127,90 @@
<widget class="QComboBox" name="mFormatComboBox"/>
</item>
<item row="9" column="0" colspan="3">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<widget class="QgsCollapsibleGroupBox" name="mOgrOptionsGroupBox" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="title" stdset="0">
<string>OGR creation options</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
<widget class="QTextEdit" name="mOgrDatasourceOptions"/>
<widget class="QTextEdit" name="mOgrDatasourceOptions">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QTextEdit" name="mOgrLayerOptions"/>
<widget class="QTextEdit" name="mOgrLayerOptions">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
</size>
</property>
<property name="baseSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_5">
@@ -149,23 +232,6 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="mSkipAttributeCreation">
<property name="toolTip">
<string>This allows one to surpress attribute creation as some OGR drivers (eg. DGN, DXF) don't support it.</string>
</property>
<property name="text">
<string>Skip attribute creation</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QCheckBox" name="mAddToCanvas">
<property name="text">
<string>Add saved file to map</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@@ -189,8 +255,32 @@
</property>
</widget>
</item>
<item row="11" column="0">
<widget class="QCheckBox" name="mAddToCanvas">
<property name="text">
<string>Add saved file to map</string>
</property>
</widget>
</item>
<item row="10" column="0">
<widget class="QCheckBox" name="mSkipAttributeCreation">
<property name="toolTip">
<string>This allows one to surpress attribute creation as some OGR drivers (eg. DGN, DXF) don't support it.</string>
</property>
<property name="text">
<string>Skip attribute creation</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QgsCollapsibleGroupBox</class>
<extends>QWidget</extends>
<header>qgscollapsiblegroupbox.h</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>mFormatComboBox</tabstop>
<tabstop>leFilename</tabstop>

0 comments on commit fa66803

Please sign in to comment.
You can’t perform that action at this time.