Skip to content

Commit 5c6ddba

Browse files
committed
append required date format to field label in attribute dialog
1 parent 7587972 commit 5c6ddba

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/gui/qgsattributedialog.cpp

+7
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
177177
{
178178
//show attribute alias if available
179179
QString myFieldName = vl->attributeDisplayName( fldIdx );
180+
// by default (until user defined alias) append date format
181+
// (validator does not allow to enter a value in wrong format)
182+
const QgsField &myField = theFields[fldIdx];
183+
if ( myField.type() == QVariant::Date && vl->attributeAlias( fldIdx ).isEmpty() )
184+
{
185+
myFieldName += " (" + vl->dateFormat( fldIdx ) + ")";
186+
}
180187

181188
QWidget *myWidget = QgsAttributeEditor::createAttributeEditor( 0, 0, vl, fldIdx, myAttributes[fldIdx], mProxyWidgets );
182189
if ( !myWidget )

0 commit comments

Comments
 (0)