Skip to content
Permalink
Browse files

add support for multiline edit widget

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12165 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Nov 17, 2009
1 parent 7ea8e7e commit 907ff17c69d7909e6531317de4079ab413220ec7
@@ -16,7 +16,9 @@ public:
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 {
@@ -242,7 +242,7 @@ QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *ed
if ( editor )
cb = qobject_cast<QCheckBox*>( editor );
else
cb = new QCheckBox();
cb = new QCheckBox( parent );

if ( cb )
{
@@ -254,8 +254,8 @@ QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *ed
// fall-through

case QgsVectorLayer::LineEdit:
case QgsVectorLayer::TextEdit:
case QgsVectorLayer::UniqueValuesEditable:
default:
{
QLineEdit *le = NULL;
QTextEdit *te = NULL;
@@ -267,6 +267,10 @@ QWidget *QgsAttributeEditor::createAttributeEditor( QWidget *parent, QWidget *ed
te = qobject_cast<QTextEdit *>( editor );
pte = qobject_cast<QPlainTextEdit *>( editor );
}
else if ( editType == QgsVectorLayer::TextEdit )
{
pte = new QPlainTextEdit( parent );
}
else
{
le = new QLineEdit( parent );
@@ -249,6 +249,9 @@ void QgsAttributeTypeDialog::setPageForEditType( QgsVectorLayer::EditType editTy
setPage( 9 );
break;

case QgsVectorLayer::TextEdit:
setPage( 10 );

case QgsVectorLayer::LineEdit:
setPage( 0 );
break;
@@ -459,6 +462,7 @@ void QgsAttributeTypeDialog::accept()
//store data to output variables
switch ( selectionComboBox->currentIndex() )
{
default:
case 0:
mEditType = QgsVectorLayer::LineEdit;
break;
@@ -530,8 +534,9 @@ void QgsAttributeTypeDialog::accept()
case 9:
mEditType = QgsVectorLayer::CheckBox;
break;
default:
mEditType = QgsVectorLayer::LineEdit;
case 10:
mEditType = QgsVectorLayer::TextEdit;
break;
}

QDialog::accept();
@@ -579,6 +579,7 @@ void QgsVectorLayerProperties::setupEditTypes()
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 )
@@ -55,12 +55,12 @@ typedef QSet<int> QgsAttributeIds;

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 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
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 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer

/** 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 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
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 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer

/**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 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer

/** 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 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
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;
@@ -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>

0 comments on commit 907ff17

Please sign in to comment.