36 return QStringLiteral(
"layout_scalebar_check" );
53 QList< QgsLayoutItemScaleBar * > barItems;
57 if ( !bar->linkedMap() )
61 res.
title = QObject::tr(
"Scalebar is not linked to a map" );
62 const QString name = bar->displayName().toHtmlEscaped();
63 res.
detailedDescription = QObject::tr(
"The scalebar “%1” is not linked to a map item. This scale will be misleading." ).arg( name );
64 mResults.append( res );
88 return QStringLiteral(
"layout_northarrow_check" );
102 if ( !layoutContext )
106 const QString defaultPath = settings.
value( QStringLiteral(
"LayoutDesigner/defaultNorthArrow" ), QStringLiteral(
":/images/north_arrows/layout_default_north_arrow.svg" ),
QgsSettings::Gui ).toString();
108 QList< QgsLayoutItemPicture * > pictureItems;
114 if ( !picture->linkedMap() && ( picture->picturePath() == defaultPath || picture->id().contains( QObject::tr(
"North Arrow" ), Qt::CaseInsensitive ) ) )
118 res.
title = QObject::tr(
"North arrow is not linked to a map" );
119 const QString name = picture->displayName().toHtmlEscaped();
120 res.
detailedDescription = QObject::tr(
"The north arrow “%1” is not linked to a map item. The arrow orientation may be misleading." ).arg( name );
121 mResults.append( res );
146 return QStringLiteral(
"layout_overview_check" );
160 if ( !layoutContext )
163 QList< QgsLayoutItemMap * > mapItems;
167 for (
int i = 0; i < map->overviews()->size(); ++i )
174 res.
title = QObject::tr(
"Overview is not linked to a map" );
175 const QString name = map->displayName().toHtmlEscaped();
176 res.
detailedDescription = QObject::tr(
"The map “%1” includes an overview (“%2”) which is not linked to a map item." ).arg( name, overview->
name() );
177 mResults.append( res );
203 return QStringLiteral(
"layout_picture_source_check" );
217 if ( !layoutContext )
220 QList< QgsLayoutItemPicture * > pictureItems;
224 if ( picture->isMissingImage() )
228 res.
title = QObject::tr(
"Picture source is missing or corrupt" );
229 const QString name = picture->displayName().toHtmlEscaped();
231 const QUrl picUrl = QUrl::fromUserInput( picture->evaluatedPath() );
232 const bool isLocalFile = picUrl.isLocalFile();
234 res.
detailedDescription = QObject::tr(
"The source for picture “%1” could not be loaded or is corrupt:<p>%2" ).arg( name,
235 isLocalFile ? QDir::toNativeSeparators( picture->evaluatedPath() ) : picture->evaluatedPath() );
236 mResults.append( res );
Validity check context for print layout validation.
Layout north arrow validity check.
int checkType() const override
Returns the type of the check.
QList< QgsValidityCheckResult > runCheck(const QgsValidityCheckContext *context, QgsFeedback *feedback) override
Runs the check and returns a list of results.
Represents an individual result from a validity check run by a QgsAbstractValidityCheck subclass...
An individual overview which is drawn above the map content in a QgsLayoutItemMap, and shows the extent of another QgsLayoutItemMap.
QString detailedDescription
Detailed description of the result (translated), giving users enough detail for them to resolve the e...
Layout picture source validity check.
This class is a composition of two QSettings instances:
QList< QgsValidityCheckResult > runCheck(const QgsValidityCheckContext *context, QgsFeedback *feedback) override
Runs the check and returns a list of results.
Layout overview validity check.
QgsLayoutPictureSourceValidityCheck * create() const override
constructor
virtual int type() const =0
Returns the context type.
Warning only, allow operation to proceed but notify user of result.
QVariant value(const QString &key, const QVariant &defaultValue=QVariant(), Section section=NoSection) const
Returns the value for setting key.
QgsLayoutScaleBarValidityCheck * create() const override
constructor
A layout item subclass that displays SVG files or raster format images (jpg, png, ...
int checkType() const override
Returns the type of the 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.
Layout scalebar validity check.
Base class for feedback objects to be used for cancellation of something running in a worker thread...
void layoutItems(QList< T *> &itemList) const
Returns a list of layout items of a specific type.
Layout graphical items for displaying a map.
QString id() const override
Returns the unique ID of the check.
QgsLayout * layout
Pointer to the layout which the check is being run against.
bool enabled() const
Returns whether the item will be drawn.
bool prepareCheck(const QgsValidityCheckContext *context, QgsFeedback *feedback) override
Prepares the check for execution, and returns true if the check can be run.
QgsLayoutNorthArrowValidityCheck * 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.
QString id() const override
Returns the unique ID of the check.
QString id() const override
Returns the unique ID of the check.
QgsLayoutOverviewValidityCheck * create() const override
constructor
Print layout validity check, triggered on exporting a print layout.
bool prepareCheck(const QgsValidityCheckContext *context, QgsFeedback *feedback) override
Prepares the check for execution, and returns true if the check can be run.
int checkType() const override
Returns the type of the check.
Layout context, see QgsLayoutValidityCheckContext.
int checkType() const override
Returns the type of the check.
A layout item subclass for scale bars.
Base class for validity check contexts.
QList< QgsValidityCheckResult > runCheck(const QgsValidityCheckContext *context, QgsFeedback *feedback) override
Runs the check and returns a list of results.
QString name() const
Returns the friendly display name for the item.
QList< QgsValidityCheckResult > runCheck(const QgsValidityCheckContext *context, QgsFeedback *feedback) override
Runs the check and returns a list of results.
QString title
A short, translated string summarising the result.
QgsLayoutItemMap * linkedMap()
Returns the source map to show the overview extent of.