[QGIS Commit] r12165 - in trunk/qgis: python/core src/app src/core src/ui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Tue Nov 17 13:47:48 EST 2009


Author: jef
Date: 2009-11-17 13:47:47 -0500 (Tue, 17 Nov 2009)
New Revision: 12165

Modified:
   trunk/qgis/python/core/qgsvectorlayer.sip
   trunk/qgis/src/app/qgsattributeeditor.cpp
   trunk/qgis/src/app/qgsattributetypedialog.cpp
   trunk/qgis/src/app/qgsvectorlayerproperties.cpp
   trunk/qgis/src/core/qgsvectorlayer.h
   trunk/qgis/src/ui/qgsattributetypeedit.ui
Log:
add support for multiline edit widget

Modified: trunk/qgis/python/core/qgsvectorlayer.sip
===================================================================
--- trunk/qgis/python/core/qgsvectorlayer.sip	2009-11-17 16:08:09 UTC (rev 12164)
+++ trunk/qgis/python/core/qgsvectorlayer.sip	2009-11-17 18:47:47 UTC (rev 12165)
@@ -16,7 +16,9 @@
     CheckBox,    /* @note added in 1.4 */
     FileName,
     Enumeration, /* @note added in 1.4 */
-    Immutable    /* @note added in 1.4 */
+    Immutable,   /* @note added in 1.4 */
+    Hidden,      /* @note added in 1.4 */
+    TextEdit     /* @note added in 1.4 */
   };
    
   struct RangeData {

Modified: trunk/qgis/src/app/qgsattributeeditor.cpp
===================================================================
--- trunk/qgis/src/app/qgsattributeeditor.cpp	2009-11-17 16:08:09 UTC (rev 12164)
+++ trunk/qgis/src/app/qgsattributeeditor.cpp	2009-11-17 18:47:47 UTC (rev 12165)
@@ -242,7 +242,7 @@
       if ( editor )
         cb = qobject_cast<QCheckBox*>( editor );
       else
-        cb = new QCheckBox();
+        cb = new QCheckBox( parent );
 
       if ( cb )
       {
@@ -254,8 +254,8 @@
     // fall-through
 
     case QgsVectorLayer::LineEdit:
+    case QgsVectorLayer::TextEdit:
     case QgsVectorLayer::UniqueValuesEditable:
-    default:
     {
       QLineEdit *le = NULL;
       QTextEdit *te = NULL;
@@ -267,6 +267,10 @@
         te = qobject_cast<QTextEdit *>( editor );
         pte = qobject_cast<QPlainTextEdit *>( editor );
       }
+      else if ( editType == QgsVectorLayer::TextEdit )
+      {
+        pte = new QPlainTextEdit( parent );
+      }
       else
       {
         le = new QLineEdit( parent );

Modified: trunk/qgis/src/app/qgsattributetypedialog.cpp
===================================================================
--- trunk/qgis/src/app/qgsattributetypedialog.cpp	2009-11-17 16:08:09 UTC (rev 12164)
+++ trunk/qgis/src/app/qgsattributetypedialog.cpp	2009-11-17 18:47:47 UTC (rev 12165)
@@ -249,6 +249,9 @@
       setPage( 9 );
       break;
 
+    case QgsVectorLayer::TextEdit:
+      setPage( 10 );
+
     case QgsVectorLayer::LineEdit:
       setPage( 0 );
       break;
@@ -459,6 +462,7 @@
   //store data to output variables
   switch ( selectionComboBox->currentIndex() )
   {
+    default:
     case 0:
       mEditType = QgsVectorLayer::LineEdit;
       break;
@@ -530,8 +534,9 @@
     case 9:
       mEditType = QgsVectorLayer::CheckBox;
       break;
-    default:
-      mEditType = QgsVectorLayer::LineEdit;
+    case 10:
+      mEditType = QgsVectorLayer::TextEdit;
+      break;
   }
 
   QDialog::accept();

Modified: trunk/qgis/src/app/qgsvectorlayerproperties.cpp
===================================================================
--- trunk/qgis/src/app/qgsvectorlayerproperties.cpp	2009-11-17 16:08:09 UTC (rev 12164)
+++ trunk/qgis/src/app/qgsvectorlayerproperties.cpp	2009-11-17 18:47:47 UTC (rev 12165)
@@ -579,6 +579,7 @@
   editTypeMap.insert( QgsVectorLayer::Immutable, tr( "Immutable" ) );
   editTypeMap.insert( QgsVectorLayer::Hidden, tr( "Hidden" ) );
   editTypeMap.insert( QgsVectorLayer::CheckBox, tr( "Checkbox" ) );
+  editTypeMap.insert( QgsVectorLayer::TextEdit, tr( "Text edit" ) );
 }
 
 QString QgsVectorLayerProperties::editTypeButtonText( QgsVectorLayer::EditType type )

Modified: trunk/qgis/src/core/qgsvectorlayer.h
===================================================================
--- trunk/qgis/src/core/qgsvectorlayer.h	2009-11-17 16:08:09 UTC (rev 12164)
+++ trunk/qgis/src/core/qgsvectorlayer.h	2009-11-17 18:47:47 UTC (rev 12165)
@@ -55,12 +55,12 @@
 
 class QgsLabelingEngineInterface
 {
-public:
-  virtual ~QgsLabelingEngineInterface() {}
-  virtual int prepareLayer(QgsVectorLayer* layer, int& attrIndex) = 0;
-  virtual void registerFeature(QgsVectorLayer* layer, QgsFeature& feat) = 0;
-  //void calculateLabeling() = 0;
-  //void drawLabeling(QgsRenderContext& context) = 0;
+  public:
+    virtual ~QgsLabelingEngineInterface() {}
+    virtual int prepareLayer( QgsVectorLayer* layer, int& attrIndex ) = 0;
+    virtual void registerFeature( QgsVectorLayer* layer, QgsFeature& feat ) = 0;
+    //void calculateLabeling() = 0;
+    //void drawLabeling(QgsRenderContext& context) = 0;
 };
 
 
@@ -86,7 +86,8 @@
       FileName,
       Enumeration,
       Immutable,   /*The attribute value should not be changed in the attribute form*/
-      Hidden       /*The attribute value should not be shown in the attribute form @added in 1.4 */
+      Hidden,      /*The attribute value should not be shown in the attribute form @added in 1.4 */
+      TextEdit     /*multiline edit @added in 1.4*/
     };
 
     struct RangeData
@@ -176,15 +177,15 @@
 
     /** Sets the renderer. If a renderer is already present, it is deleted */
     void setRenderer( QgsRenderer * r );
-    
+
     /** Return renderer V2. Added in QGIS 1.4 */
     QgsFeatureRendererV2* rendererV2();
     /** Set renderer V2. Added in QGIS 1.4 */
-    void setRendererV2(QgsFeatureRendererV2* r);
+    void setRendererV2( QgsFeatureRendererV2* r );
     /** Return whether using renderer V2. Added in QGIS 1.4 */
     bool isUsingRendererV2();
     /** set whether to use renderer V2 for drawing. Added in QGIS 1.4 */
-    void setUsingRendererV2(bool usingRendererV2);
+    void setUsingRendererV2( bool usingRendererV2 );
 
     /** Draw layer with renderer V2. Added in QGIS 1.4 */
     void drawRendererV2( QgsRenderContext& rendererContext, bool labeling );
@@ -362,7 +363,7 @@
     bool hasLabelsEnabled( void ) const;
 
     /** Assign a custom labeling engine with layer. Added in v1.4 */
-    void setLabelingEngine(QgsLabelingEngineInterface* engine);
+    void setLabelingEngine( QgsLabelingEngineInterface* engine );
 
     /** Returns true if the provider is in editing mode */
     virtual bool isEditable() const;
@@ -477,10 +478,10 @@
 
     /**set edit type*/
     void setEditType( int idx, EditType edit );
- 
+
     /** set string representing 'true' for a checkbox (added in 1.4) */
     void setCheckedState( int idx, QString checked, QString notChecked );
-    
+
     /** return string representing 'true' for a checkbox (added in 1.4) */
     QPair<QString, QString> checkedState( int idx );
 
@@ -736,10 +737,10 @@
 
     /** Renderer object which holds the information about how to display the features */
     QgsRenderer *mRenderer;
-    
+
     /** Renderer V2 */
     QgsFeatureRendererV2 *mRendererV2;
-    
+
     /** whether to use V1 or V2 renderer */
     bool mUsingRendererV2;
 
@@ -769,7 +770,7 @@
     QMap< QString, EditType > mEditTypes;
     QMap< QString, QMap<QString, QVariant> > mValueMaps;
     QMap< QString, RangeData > mRanges;
-    QMap< QString, QPair<QString,QString> > mCheckedStates;
+    QMap< QString, QPair<QString, QString> > mCheckedStates;
     QString mEditForm;
 
     bool mFetching;

Modified: trunk/qgis/src/ui/qgsattributetypeedit.ui
===================================================================
--- trunk/qgis/src/ui/qgsattributetypeedit.ui	2009-11-17 16:08:09 UTC (rev 12164)
+++ trunk/qgis/src/ui/qgsattributetypeedit.ui	2009-11-17 18:47:47 UTC (rev 12165)
@@ -66,6 +66,11 @@
        <string>Checkbox</string>
       </property>
      </item>
+     <item>
+      <property name="text">
+       <string>Text edit</string>
+      </property>
+     </item>
     </widget>
    </item>
    <item>
@@ -77,7 +82,7 @@
       </sizepolicy>
      </property>
      <property name="currentIndex">
-      <number>9</number>
+      <number>0</number>
      </property>
      <widget class="QWidget" name="lineEditPage">
       <layout class="QVBoxLayout" name="verticalLayout_1">
@@ -544,6 +549,33 @@
        </item>
       </layout>
      </widget>
+     <widget class="QWidget" name="textEditPage">
+      <layout class="QVBoxLayout" name="verticalLayout_25">
+       <item>
+        <widget class="QLabel" name="hiddenLabel_3">
+         <property name="text">
+          <string>A text edit field that accepts multiple lines will be used.</string>
+         </property>
+         <property name="wordWrap">
+          <bool>true</bool>
+         </property>
+        </widget>
+       </item>
+       <item>
+        <spacer name="verticalSpacer_17">
+         <property name="orientation">
+          <enum>Qt::Vertical</enum>
+         </property>
+         <property name="sizeHint" stdset="0">
+          <size>
+           <width>20</width>
+           <height>302</height>
+          </size>
+         </property>
+        </spacer>
+       </item>
+      </layout>
+     </widget>
     </widget>
    </item>
    <item>



More information about the QGIS-commit mailing list