Address Nyall's comments

This commit is contained in:
Alessandro Pasotti 2022-03-11 12:03:19 +01:00 committed by Nyall Dawson
parent 66322f4c7f
commit f6b99b2b4a
7 changed files with 109 additions and 72 deletions

View File

@ -219,7 +219,6 @@ Contains settings for how a map layer will be labeled.
PositionX,
PositionY,
PositionPoint,
CurvedOffset,
Hali,
Vali,
Rotation,

View File

@ -858,10 +858,10 @@ bool QgsMapToolLabel::currentLabelDataDefinedPosition( double &x, bool &xSuccess
return true;
}
bool QgsMapToolLabel::currentLabelDataDefinedCurvedOffset( double &offset, bool &offsetSuccess, int &curvedOffsetCol ) const
bool QgsMapToolLabel::currentLabelDataDefinedLineAnchorPercent( double &offset, bool &lineAnchorPercentSuccess, int &lineAnchorPercentCol ) const
{
offsetSuccess = false;
lineAnchorPercentSuccess = false;
QgsVectorLayer *vlayer = mCurrentLabel.layer;
QgsFeatureId featureId = mCurrentLabel.pos.featureId;
@ -870,7 +870,7 @@ bool QgsMapToolLabel::currentLabelDataDefinedCurvedOffset( double &offset, bool
return false;
}
if ( !labelOffsettable( vlayer, mCurrentLabel.settings, curvedOffsetCol ) )
if ( !labelAnchorPercentMovable( vlayer, mCurrentLabel.settings, lineAnchorPercentCol ) )
{
return false;
}
@ -881,11 +881,11 @@ bool QgsMapToolLabel::currentLabelDataDefinedCurvedOffset( double &offset, bool
return false;
}
if ( mCurrentLabel.settings.dataDefinedProperties().isActive( QgsPalLayerSettings::CurvedOffset ) )
if ( mCurrentLabel.settings.dataDefinedProperties().isActive( QgsPalLayerSettings::LineAnchorPercent ) )
{
QgsAttributes attributes = f.attributes();
if ( !attributes.at( curvedOffsetCol ).isNull() )
offset = attributes.at( curvedOffsetCol ).toDouble( &offsetSuccess );
if ( !attributes.at( lineAnchorPercentCol ).isNull() )
offset = attributes.at( lineAnchorPercentCol ).toDouble( &lineAnchorPercentSuccess );
}
return true;
@ -967,24 +967,24 @@ bool QgsMapToolLabel::changeCurrentLabelDataDefinedPosition( const QVariant &x,
return true;
}
bool QgsMapToolLabel::changeCurrentLabelDataDefinedCurvedOffset( const QVariant &offset )
bool QgsMapToolLabel::changeCurrentLabelDataDefinedLineAnchorPercent( const QVariant &lineAnchorPercent )
{
if ( mCurrentLabel.settings.dataDefinedProperties().isActive( QgsPalLayerSettings::CurvedOffset ) )
if ( mCurrentLabel.settings.dataDefinedProperties().isActive( QgsPalLayerSettings::LineAnchorPercent ) )
{
PropertyStatus status = PropertyStatus::DoesNotExist;
const QString curvedOffsetColName = dataDefinedColumnName( QgsPalLayerSettings::CurvedOffset, mCurrentLabel.settings, mCurrentLabel.layer, status );
const int curvedOffsetCol = mCurrentLabel.layer->fields().lookupField( curvedOffsetColName );
const QString lineAnchorPercentColName = dataDefinedColumnName( QgsPalLayerSettings::LineAnchorPercent, mCurrentLabel.settings, mCurrentLabel.layer, status );
const int lineAnchorPercentCol = mCurrentLabel.layer->fields().lookupField( lineAnchorPercentColName );
if ( !mCurrentLabel.layer->changeAttributeValue( mCurrentLabel.pos.featureId, curvedOffsetCol, offset ) )
if ( !mCurrentLabel.layer->changeAttributeValue( mCurrentLabel.pos.featureId, lineAnchorPercentCol, lineAnchorPercent ) )
return false;
}
else
{
PropertyStatus status = PropertyStatus::DoesNotExist;
const QString curvedOffsetColName = dataDefinedColumnName( QgsPalLayerSettings::PositionX, mCurrentLabel.settings, mCurrentLabel.layer, status );
const int curvedOffsetCol = mCurrentLabel.layer->fields().lookupField( curvedOffsetColName );
const QString lineAnchorPercentColName = dataDefinedColumnName( QgsPalLayerSettings::PositionX, mCurrentLabel.settings, mCurrentLabel.layer, status );
const int lineAnchorPercentCol = mCurrentLabel.layer->fields().lookupField( lineAnchorPercentColName );
if ( !mCurrentLabel.layer->changeAttributeValue( mCurrentLabel.pos.featureId, curvedOffsetCol, offset ) )
if ( !mCurrentLabel.layer->changeAttributeValue( mCurrentLabel.pos.featureId, lineAnchorPercentCol, lineAnchorPercent ) )
return false;
}
@ -1124,15 +1124,15 @@ bool QgsMapToolLabel::labelMoveable( QgsVectorLayer *vlayer, const QgsPalLayerSe
return false;
}
bool QgsMapToolLabel::labelOffsettable( QgsVectorLayer *vlayer, const QgsPalLayerSettings &settings, int &curvedOffsetCol ) const
bool QgsMapToolLabel::labelAnchorPercentMovable( QgsVectorLayer *vlayer, const QgsPalLayerSettings &settings, int &lineAnchorPercentCol ) const
{
curvedOffsetCol = -1;
if ( settings.dataDefinedProperties().isActive( QgsPalLayerSettings::CurvedOffset ) )
lineAnchorPercentCol = -1;
if ( settings.dataDefinedProperties().isActive( QgsPalLayerSettings::LineAnchorPercent ) )
{
PropertyStatus status = PropertyStatus::DoesNotExist;
QString pointColName = dataDefinedColumnName( QgsPalLayerSettings::CurvedOffset, settings, vlayer, status );
curvedOffsetCol = vlayer->fields().lookupField( pointColName );
if ( curvedOffsetCol >= 0 )
QString pointColName = dataDefinedColumnName( QgsPalLayerSettings::LineAnchorPercent, settings, vlayer, status );
lineAnchorPercentCol = vlayer->fields().lookupField( pointColName );
if ( lineAnchorPercentCol >= 0 )
return true;
}
return false;

View File

@ -203,14 +203,14 @@ class APP_EXPORT QgsMapToolLabel: public QgsMapToolAdvancedDigitizing
bool currentLabelDataDefinedPosition( double &x, bool &xSuccess, double &y, bool &ySuccess, int &xCol, int &yCol, int &pointCol ) const;
/**
* Gets data defined curved offset of current label
* \param offset out: data defined curved offset
* Gets data defined line anchor percent of current label
* \param offset out: data defined line anchor percent
* \param offsetSuccess out: FALSE if attribute value is NULL
* \param curvedOffsetCol out: index of the curved offset column
* \param lineAnchorPercentCol out: index of the line anchor percent column
* \returns FALSE if layer does not have data defined label curved offset enabled
* \since QGIS 3.26
*/
bool currentLabelDataDefinedCurvedOffset( double &offset, bool &offsetSuccess, int &curvedOffsetCol ) const;
bool currentLabelDataDefinedLineAnchorPercent( double &lineAnchorPercent, bool &lineAnchorPercentSuccess, int &lineAnchorPercentOffsetCol ) const;
/**
* Returns data defined rotation of current label
@ -224,7 +224,6 @@ class APP_EXPORT QgsMapToolLabel: public QgsMapToolAdvancedDigitizing
/**
* Change the data defined position of current label
* \param rCol out: index of the rotation column
* \param x data defined x-coordinate
* \param y data defined y-coordinate
* \returns TRUE if data defined position could be changed
@ -232,12 +231,11 @@ class APP_EXPORT QgsMapToolLabel: public QgsMapToolAdvancedDigitizing
bool changeCurrentLabelDataDefinedPosition( const QVariant &x, const QVariant &y );
/**
* Change the data defined curve offset current label
* \param curvedOffsetCol out: index of the curved offset
* \param x data defined offset
* Change the data defined line anchor percent of current label
* \param anchorPercent data defined line anchor percent
* \returns TRUE if data defined curved offset could be changed
*/
bool changeCurrentLabelDataDefinedCurvedOffset( const QVariant &offset );
bool changeCurrentLabelDataDefinedLineAnchorPercent( const QVariant &lineAnchorPercent );
/**
* Returns data defined show/hide of a feature.
@ -258,7 +256,7 @@ class APP_EXPORT QgsMapToolLabel: public QgsMapToolAdvancedDigitizing
bool isPinned();
bool labelMoveable( QgsVectorLayer *vlayer, const QgsPalLayerSettings &settings, int &xCol, int &yCol, int &pointCol ) const;
bool labelOffsettable( QgsVectorLayer *vlayer, const QgsPalLayerSettings &settings, int &curvedOffsetCol ) const;
bool labelAnchorPercentMovable( QgsVectorLayer *vlayer, const QgsPalLayerSettings &settings, int &lineAnchorPercentCol ) const;
bool createAuxiliaryFields( QgsPalIndexes &palIndexes );
bool createAuxiliaryFields( LabelDetails &details, QgsPalIndexes &palIndexes ) const;

View File

@ -34,7 +34,7 @@ QgsMapToolMoveLabel::QgsMapToolMoveLabel( QgsMapCanvas *canvas, QgsAdvancedDigit
mPalProperties << QgsPalLayerSettings::PositionX;
mPalProperties << QgsPalLayerSettings::PositionY;
mPalProperties << QgsPalLayerSettings::CurvedOffset;
mPalProperties << QgsPalLayerSettings::LineAnchorPercent;
mDiagramProperties << QgsDiagramLayerSettings::PositionX;
mDiagramProperties << QgsDiagramLayerSettings::PositionY;
@ -64,8 +64,8 @@ void QgsMapToolMoveLabel::cadCanvasMoveEvent( QgsMapMouseEvent *e )
{
const QgsPointXY pointMapCoords = e->mapPoint();
bool isCurved { mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::Curved };
if ( isCurved )
bool isCurvedOrLine { mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::Curved || mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::Line };
if ( isCurvedOrLine )
{
// Determine the closest point on the feature
const QgsFeatureId featureId = mCurrentLabel.pos.featureId;
@ -76,7 +76,7 @@ void QgsMapToolMoveLabel::cadCanvasMoveEvent( QgsMapMouseEvent *e )
if ( feature.geometry().distance( pointMapGeometry ) / mCanvas->mapUnitsPerPixel() > 100.0 )
{
mCurrentLabel.settings.placement = QgsPalLayerSettings::Placement::Horizontal;
isCurved = false;
isCurvedOrLine = false;
mOffsetFromLineStartRubberBand->hide();
}
else
@ -87,7 +87,7 @@ void QgsMapToolMoveLabel::cadCanvasMoveEvent( QgsMapMouseEvent *e )
}
}
if ( isCurved )
if ( isCurvedOrLine )
{
mLabelRubberBand->hide();
mFixPointRubberBand->hide();
@ -218,27 +218,27 @@ void QgsMapToolMoveLabel::cadCanvasPressEvent( QgsMapMouseEvent *e )
return;
}
int xCol = -1, yCol = -1, pointCol = -1, curvedOffsetCol = -1;
int xCol = -1, yCol = -1, pointCol = -1, lineAnchorPercentCol = -1;
const bool isCurved { mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::Curved };
bool isCurvedOrLine { mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::Curved || mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::Line };
if ( isCurved && !mCurrentLabel.pos.isDiagram && !labelOffsettable( vlayer, mCurrentLabel.settings, pointCol ) )
if ( isCurvedOrLine && !mCurrentLabel.pos.isDiagram && !labelAnchorPercentMovable( vlayer, mCurrentLabel.settings, pointCol ) )
{
QgsPalIndexes indexes;
if ( createAuxiliaryFields( indexes ) )
return;
if ( !labelOffsettable( vlayer, mCurrentLabel.settings, pointCol ) )
if ( !labelAnchorPercentMovable( vlayer, mCurrentLabel.settings, pointCol ) )
{
PropertyStatus status = PropertyStatus::DoesNotExist;
QString offsetColName = dataDefinedColumnName( QgsPalLayerSettings::CurvedOffset, mCurrentLabel.settings, vlayer, status );
QString offsetColName = dataDefinedColumnName( QgsPalLayerSettings::LineAnchorPercent, mCurrentLabel.settings, vlayer, status );
if ( pointCol < 0 )
QgisApp::instance()->messageBar()->pushWarning( tr( "Move Label" ), tr( "The label offset column “%1” does not exist in the layer" ).arg( offsetColName ) );
return;
}
curvedOffsetCol = indexes[ QgsPalLayerSettings::CurvedOffset ];
lineAnchorPercentCol = indexes[ QgsPalLayerSettings::LineAnchorPercent ];
}
else if ( !mCurrentLabel.pos.isDiagram && !labelMoveable( vlayer, mCurrentLabel.settings, xCol, yCol, pointCol ) )
@ -285,10 +285,10 @@ void QgsMapToolMoveLabel::cadCanvasPressEvent( QgsMapMouseEvent *e )
yCol = indexes[ QgsDiagramLayerSettings::PositionY ];
}
if ( ( isCurved && curvedOffsetCol >= 0 ) || ( xCol >= 0 && yCol >= 0 ) )
if ( ( isCurvedOrLine && lineAnchorPercentCol >= 0 ) || ( xCol >= 0 && yCol >= 0 ) )
{
const bool usesAuxFields =
( isCurved && curvedOffsetCol >= 0 && vlayer->fields().fieldOrigin( curvedOffsetCol ) == QgsFields::OriginJoin ) ||
( isCurvedOrLine && lineAnchorPercentCol >= 0 && vlayer->fields().fieldOrigin( lineAnchorPercentCol ) == QgsFields::OriginJoin ) ||
( vlayer->fields().fieldOrigin( xCol ) == QgsFields::OriginJoin && vlayer->fields().fieldOrigin( yCol ) == QgsFields::OriginJoin );
if ( !usesAuxFields && !vlayer->isEditable() )
{
@ -353,17 +353,17 @@ void QgsMapToolMoveLabel::cadCanvasPressEvent( QgsMapMouseEvent *e )
int xCol = -1;
int yCol = -1;
int pointCol = -1;
int curvedOffsetCol = -1;
int lineAnchorPercentCol = -1;
double xPosOrig = 0;
double yPosOrig = 0;
double curvedOffsetOrig = 0;
double lineAnchorPercentOrig = 0;
bool xSuccess = false;
bool ySuccess = false;
bool curvedOffsetSuccess = false;
bool lineAnchorPercentSuccess = false;
const bool isCurved { mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::Curved };
bool isCurvedOrLine { mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::Curved || mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::Line };
if ( !isCalloutMove && isCurved && !currentLabelDataDefinedCurvedOffset( curvedOffsetOrig, curvedOffsetSuccess, curvedOffsetCol ) )
if ( !isCalloutMove && isCurvedOrLine && !currentLabelDataDefinedLineAnchorPercent( lineAnchorPercentOrig, lineAnchorPercentSuccess, lineAnchorPercentCol ) )
{
return;
}
@ -377,18 +377,18 @@ void QgsMapToolMoveLabel::cadCanvasPressEvent( QgsMapMouseEvent *e )
}
// Handle curved offset
if ( isCurved )
if ( isCurvedOrLine )
{
const QgsFeature feature { mCurrentLabel.layer->getFeature( featureId ) };
const QgsGeometry pointMapGeometry { QgsGeometry::fromPointXY( releaseCoords ) };
const QgsGeometry anchorPoint { feature.geometry().nearestPoint( pointMapGeometry ) };
const double offset { feature.geometry().lineLocatePoint( anchorPoint ) };
const double offset { feature.geometry().lineLocatePoint( anchorPoint ) / feature.geometry().length() };
vlayer->beginEditCommand( tr( "Moved curved label offset" ) + QStringLiteral( " '%1'" ).arg( currentLabelText( 24 ) ) );
bool success = false;
if ( mCurrentLabel.settings.dataDefinedProperties().isActive( QgsPalLayerSettings::CurvedOffset ) )
if ( mCurrentLabel.settings.dataDefinedProperties().isActive( QgsPalLayerSettings::LineAnchorPercent ) )
{
success = changeCurrentLabelDataDefinedCurvedOffset( offset );
success = changeCurrentLabelDataDefinedLineAnchorPercent( offset );
}
if ( !success )
@ -399,6 +399,19 @@ void QgsMapToolMoveLabel::cadCanvasPressEvent( QgsMapMouseEvent *e )
vlayer->endEditCommand();
}
}
else
{
// Set positions to NULL
if ( currentLabelDataDefinedPosition( xPosOrig, xSuccess, yPosOrig, ySuccess, xCol, yCol, pointCol ) )
{
changeCurrentLabelDataDefinedPosition( QVariant(), QVariant() );
vlayer->changeAttributeValue( featureId, xCol, QVariant() );
vlayer->changeAttributeValue( featureId, yCol, QVariant() );
// TODO: Do we need to check for success here? The layer was already checked for editable state.
}
vlayer->endEditCommand();
vlayer->triggerRepaint();
}
}
else
{
@ -440,6 +453,7 @@ void QgsMapToolMoveLabel::cadCanvasPressEvent( QgsMapMouseEvent *e )
&& mCurrentLabel.settings.dataDefinedProperties().isActive( QgsPalLayerSettings::PositionPoint ) )
{
success = changeCurrentLabelDataDefinedPosition( xPosNew, yPosNew );
changeCurrentLabelDataDefinedLineAnchorPercent( QVariant() );
}
else
{
@ -561,6 +575,7 @@ void QgsMapToolMoveLabel::keyReleaseEvent( QKeyEvent *e )
// delete the stored label/callout position
const bool isCalloutMove = !mCurrentCallout.layerID.isEmpty();
const bool isCurvedOrLine { mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::Curved || mCurrentLabel.settings.placement == QgsPalLayerSettings::Placement::Line };
QgsVectorLayer *vlayer = !isCalloutMove ? mCurrentLabel.layer : qobject_cast< QgsVectorLayer * >( QgsMapTool::layer( mCurrentCallout.layerID ) );
const QgsFeatureId featureId = !isCalloutMove ? mCurrentLabel.pos.featureId : mCurrentCallout.featureId;
if ( vlayer )
@ -568,12 +583,19 @@ void QgsMapToolMoveLabel::keyReleaseEvent( QKeyEvent *e )
int xCol = -1;
int yCol = -1;
int pointCol = -1;
int lineAnchorPercentCol = -1;
double xPosOrig = 0;
double yPosOrig = 0;
double lineAnchorPercentOrig = 0;
bool lineAnchorPercentSuccess = false;
bool xSuccess = false;
bool ySuccess = false;
if ( !isCalloutMove && !currentLabelDataDefinedPosition( xPosOrig, xSuccess, yPosOrig, ySuccess, xCol, yCol, pointCol ) )
if ( !isCalloutMove && isCurvedOrLine && ! currentLabelDataDefinedLineAnchorPercent( lineAnchorPercentOrig, lineAnchorPercentSuccess, lineAnchorPercentCol ) )
{
break;
}
else if ( !isCalloutMove && !currentLabelDataDefinedPosition( xPosOrig, xSuccess, yPosOrig, ySuccess, xCol, yCol, pointCol ) )
{
break;
}
@ -582,28 +604,48 @@ void QgsMapToolMoveLabel::keyReleaseEvent( QKeyEvent *e )
break;
}
vlayer->beginEditCommand( !isCalloutMove ? tr( "Delete Label Position" ) + QStringLiteral( " '%1'" ).arg( currentLabelText( 24 ) ) : tr( "Delete Callout Position" ) );
bool success = vlayer->changeAttributeValue( featureId, xCol, QVariant() );
success = vlayer->changeAttributeValue( featureId, yCol, QVariant() ) && success;
if ( !success )
if ( !isCalloutMove && isCurvedOrLine )
{
// if the edit command fails, it's likely because the label x/y is being stored in a physical field (not a auxiliary one!)
// and the layer isn't in edit mode
if ( !vlayer->isEditable() )
vlayer->beginEditCommand( tr( "Delete Label Anchor Percent '%1'" ).arg( currentLabelText( 24 ) ) );
bool success = vlayer->changeAttributeValue( featureId, lineAnchorPercentCol, QVariant() );
if ( !success )
{
if ( !isCalloutMove )
QgisApp::instance()->messageBar()->pushWarning( tr( "Delete Label Position" ), tr( "Layer “%1” must be editable in order to remove stored label positions" ).arg( vlayer->name() ) );
// if the edit command fails, it's likely because the label anchor percent is being stored in a physical field (not a auxiliary one!)
// and the layer isn't in edit mode
if ( !vlayer->isEditable() )
{
QgisApp::instance()->messageBar()->pushWarning( tr( "Delete Label Anchor Percent" ), tr( "Layer “%1” must be editable in order to remove stored label anchor percent" ).arg( vlayer->name() ) );
}
else
QgisApp::instance()->messageBar()->pushWarning( tr( "Delete Callout Position" ), tr( "Layer “%1” must be editable in order to remove stored callout positions" ).arg( vlayer->name() ) );
{
QgisApp::instance()->messageBar()->pushWarning( tr( "Delete Label Label Anchor Percent" ), tr( "Error encountered while removing stored label anchor percent" ) );
}
}
else
}
else
{
vlayer->beginEditCommand( !isCalloutMove ? tr( "Delete Label Position" ) + QStringLiteral( " '%1'" ).arg( currentLabelText( 24 ) ) : tr( "Delete Callout Position" ) );
bool success = vlayer->changeAttributeValue( featureId, xCol, QVariant() );
success = vlayer->changeAttributeValue( featureId, yCol, QVariant() ) && success;
if ( !success )
{
if ( !isCalloutMove )
QgisApp::instance()->messageBar()->pushWarning( tr( "Delete Label Position" ), tr( "Error encountered while removing stored label position" ) );
// if the edit command fails, it's likely because the label x/y is being stored in a physical field (not a auxiliary one!)
// and the layer isn't in edit mode
if ( !vlayer->isEditable() )
{
if ( !isCalloutMove )
QgisApp::instance()->messageBar()->pushWarning( tr( "Delete Label Position" ), tr( "Layer “%1” must be editable in order to remove stored label positions" ).arg( vlayer->name() ) );
else
QgisApp::instance()->messageBar()->pushWarning( tr( "Delete Callout Position" ), tr( "Layer “%1” must be editable in order to remove stored callout positions" ).arg( vlayer->name() ) );
}
else
QgisApp::instance()->messageBar()->pushWarning( tr( "Delete Callout Position" ), tr( "Error encountered while removing stored callout position" ) );
{
if ( !isCalloutMove )
QgisApp::instance()->messageBar()->pushWarning( tr( "Delete Label Position" ), tr( "Error encountered while removing stored label position" ) );
else
QgisApp::instance()->messageBar()->pushWarning( tr( "Delete Callout Position" ), tr( "Error encountered while removing stored callout position" ) );
}
}
}
vlayer->endEditCommand();
deleteRubberBands();

View File

@ -248,7 +248,6 @@ void QgsPalLayerSettings::initPropertyDefinitions()
{ QgsPalLayerSettings::PositionX, QgsPropertyDefinition( "PositionX", QObject::tr( "Position (X)" ), QgsPropertyDefinition::Double, origin ) },
{ QgsPalLayerSettings::PositionY, QgsPropertyDefinition( "PositionY", QObject::tr( "Position (Y)" ), QgsPropertyDefinition::Double, origin ) },
{ QgsPalLayerSettings::PositionPoint, QgsPropertyDefinition( "PositionPoint", QgsPropertyDefinition::DataTypeString, QObject::tr( "Position (point)" ), QObject::tr( "A point geometry" ), origin ) },
{ QgsPalLayerSettings::CurvedOffset, QgsPropertyDefinition( "CurvedOffset", QgsPropertyDefinition::DataTypeString, QObject::tr( "Offset from the line start" ), QObject::tr( "double [0.0-line lenght]" ), origin ) },
{ QgsPalLayerSettings::Hali, QgsPropertyDefinition( "Hali", QgsPropertyDefinition::DataTypeString, QObject::tr( "Horizontal alignment" ), QObject::tr( "string " ) + "[<b>Left</b>|<b>Center</b>|<b>Right</b>]", origin ) },
{
QgsPalLayerSettings::Vali, QgsPropertyDefinition( "Vali", QgsPropertyDefinition::DataTypeString, QObject::tr( "Vertical alignment" ), QObject::tr( "string " ) + QStringLiteral( "[<b>Bottom</b>|<b>Base</b>|<br>"

View File

@ -322,7 +322,6 @@ class CORE_EXPORT QgsPalLayerSettings
PositionX = 9, //!< X-coordinate data defined label position
PositionY = 10, //!< Y-coordinate data defined label position
PositionPoint = 114, //!< Point-coordinate data defined label position
CurvedOffset = 116, //!< Offset from start for curved lines (since QGIS 3.26)
Hali = 11, //!< Horizontal alignment for data defined label position (Left, Center, Right)
Vali = 12, //!< Vertical alignment for data defined label position (Bottom, Base, Half, Cap, Top)
Rotation = 14, //!< Label rotation (deprecated, for old project compatibility only)

View File

@ -811,7 +811,7 @@ void QgsTextFormatWidget::populateDataDefinedButtons()
registerDataDefinedButton( mCoordXDDBtn, QgsPalLayerSettings::PositionX );
registerDataDefinedButton( mCoordYDDBtn, QgsPalLayerSettings::PositionY );
registerDataDefinedButton( mCoordPointDDBtn, QgsPalLayerSettings::PositionPoint );
registerDataDefinedButton( mCurvedLineOffsetDDBtn, QgsPalLayerSettings::CurvedOffset );
registerDataDefinedButton( mCurvedLineOffsetDDBtn, QgsPalLayerSettings::LineAnchorPercent );
registerDataDefinedButton( mCoordAlignmentHDDBtn, QgsPalLayerSettings::Hali );
registerDataDefinedButton( mCoordAlignmentVDDBtn, QgsPalLayerSettings::Vali );
registerDataDefinedButton( mCoordRotationDDBtn, QgsPalLayerSettings::LabelRotation );