23 #include "qgssettings.h" 
   37   return QStringLiteral( 
"layout_scalebar_check" );
 
   54   QList< QgsLayoutItemScaleBar * > barItems;
 
   58     if ( !bar->linkedMap() )
 
   62       res.
title = QObject::tr( 
"Scalebar is not linked to a map" );
 
   63       const QString name = bar->displayName().toHtmlEscaped();
 
   64       res.
detailedDescription = QObject::tr( 
"The scalebar “%1” is not linked to a map item. This scale will be misleading." ).arg( name );
 
   65       mResults.append( res );
 
   89   return QStringLiteral( 
"layout_northarrow_check" );
 
  103   if ( !layoutContext )
 
  106   QgsSettings settings;
 
  107   const QString defaultPath = settings.value( QStringLiteral( 
"LayoutDesigner/defaultNorthArrow" ), QStringLiteral( 
":/images/north_arrows/layout_default_north_arrow.svg" ), QgsSettings::Gui ).toString();
 
  109   QList< QgsLayoutItemPicture * > pictureItems;
 
  115     if ( !picture->linkedMap() && ( picture->picturePath() == defaultPath || picture->id().contains( QObject::tr( 
"North Arrow" ), Qt::CaseInsensitive ) ) )
 
  119       res.
title = QObject::tr( 
"North arrow is not linked to a map" );
 
  120       const QString name = picture->displayName().toHtmlEscaped();
 
  121       res.
detailedDescription = QObject::tr( 
"The north arrow “%1” is not linked to a map item. The arrow orientation may be misleading." ).arg( name );
 
  122       mResults.append( res );
 
  147   return QStringLiteral( 
"layout_overview_check" );
 
  161   if ( !layoutContext )
 
  164   QList< QgsLayoutItemMap * > mapItems;
 
  168     for ( 
int i = 0; i < map->overviews()->size(); ++i )
 
  175         res.
title = QObject::tr( 
"Overview is not linked to a map" );
 
  176         const QString name = map->displayName().toHtmlEscaped();
 
  177         res.
detailedDescription = QObject::tr( 
"The map “%1” includes an overview (“%2”) which is not linked to a map item." ).arg( name, overview->
name() );
 
  178         mResults.append( res );
 
  204   return QStringLiteral( 
"layout_picture_source_check" );
 
  218   if ( !layoutContext )
 
  221   QList< QgsLayoutItemPicture * > pictureItems;
 
  225     if ( picture->isMissingImage() )
 
  229       res.
title = QObject::tr( 
"Picture source is missing or corrupt" );
 
  230       const QString name = picture->displayName().toHtmlEscaped();
 
  232       const QUrl picUrl = QUrl::fromUserInput( picture->evaluatedPath() );
 
  233       const bool isLocalFile = picUrl.isLocalFile();
 
  235       res.
detailedDescription = QObject::tr( 
"The source for picture “%1” could not be loaded or is corrupt:<p>%2" ).arg( name,
 
  236                                 isLocalFile ? QDir::toNativeSeparators( picture->evaluatedPath() ) : picture->evaluatedPath() );
 
  237       mResults.append( res );
 
@ TypeLayoutCheck
Print layout validity check, triggered on exporting a print layout.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
QString name() const
Returns the friendly display name for the item.
bool enabled() const
Returns whether the item will be drawn.
An individual overview which is drawn above the map content in a QgsLayoutItemMap,...
QgsLayoutItemMap * linkedMap()
Returns the source map to show the overview extent of.
Layout graphical items for displaying a map.
A layout item subclass that displays SVG files or raster format images (jpg, png, ....
A layout item subclass for scale bars.
Layout north arrow validity check.
int checkType() const override
Returns the type of the check.
bool prepareCheck(const QgsValidityCheckContext *context, QgsFeedback *feedback) override
Prepares the check for execution, and returns true if the check can be run.
QString id() const override
Returns the unique ID of the check.
QgsLayoutNorthArrowValidityCheck * create() const override
constructor
QList< QgsValidityCheckResult > runCheck(const QgsValidityCheckContext *context, QgsFeedback *feedback) override
Runs the check and returns a list of results.
Layout overview validity check.
QList< QgsValidityCheckResult > runCheck(const QgsValidityCheckContext *context, QgsFeedback *feedback) override
Runs the check and returns a list of results.
int checkType() const override
Returns the type of the check.
QString id() const override
Returns the unique ID of the check.
QgsLayoutOverviewValidityCheck * create() const override
constructor
bool prepareCheck(const QgsValidityCheckContext *context, QgsFeedback *feedback) override
Prepares the check for execution, and returns true if the check can be run.
Layout picture source validity check.
bool prepareCheck(const QgsValidityCheckContext *context, QgsFeedback *feedback) override
Prepares the check for execution, and returns true if the check can be run.
QString id() const override
Returns the unique ID of the check.
QList< QgsValidityCheckResult > runCheck(const QgsValidityCheckContext *context, QgsFeedback *feedback) override
Runs the check and returns a list of results.
QgsLayoutPictureSourceValidityCheck * create() const override
constructor
int checkType() const override
Returns the type of the check.
Layout scalebar validity check.
QString id() const override
Returns the unique ID of the check.
bool prepareCheck(const QgsValidityCheckContext *context, QgsFeedback *feedback) override
Prepares the check for execution, and returns true if the check can be run.
QList< QgsValidityCheckResult > runCheck(const QgsValidityCheckContext *context, QgsFeedback *feedback) override
Runs the check and returns a list of results.
int checkType() const override
Returns the type of the check.
QgsLayoutScaleBarValidityCheck * create() const override
constructor
Validity check context for print layout validation.
QgsLayout * layout
Pointer to the layout which the check is being run against.
void layoutItems(QList< T * > &itemList) const
Returns a list of layout items of a specific type.
Base class for validity check contexts.
virtual int type() const =0
Returns the context type.
@ TypeLayoutContext
Layout context, see QgsLayoutValidityCheckContext.
Represents an individual result from a validity check run by a QgsAbstractValidityCheck subclass.
@ Warning
Warning only, allow operation to proceed but notify user of result.
QString detailedDescription
Detailed description of the result (translated), giving users enough detail for them to resolve the e...
QString title
A short, translated string summarising the result.