Skip to content
Permalink
Browse files

Use 'report' text instead of 'atlas' when inside a report designer

  • Loading branch information
nyalldawson committed Jan 2, 2018
1 parent 5d64f3c commit d2c880af50ca83748089fb4896d95028922b8327
@@ -90,6 +90,14 @@ updated to match ``item``'s properties.

If false is returned, then the widget could not be successfully updated
to show the properties of ``item``.
%End

virtual void setReportTypeString( const QString &string );
%Docstring
Sets the ``string`` to use to describe the current report type (e.g.
"atlas" or "report").
Subclasses which display this text to users should override this
and update their widget labels accordingly.
%End

protected:
@@ -145,6 +145,11 @@ QgsLayoutAttributeTableWidget::QgsLayoutAttributeTableWidget( QgsLayoutFrame *fr
connect( mContentFontToolButton, &QgsFontButton::changed, this, &QgsLayoutAttributeTableWidget::contentFontChanged );
}

void QgsLayoutAttributeTableWidget::setReportTypeString( const QString &string )
{
mIntersectAtlasCheckBox->setText( tr( "Show only features intersecting %1 feature" ).arg( string ) );
}

bool QgsLayoutAttributeTableWidget::setNewItem( QgsLayoutItem *item )
{
QgsLayoutFrame *frame = qobject_cast< QgsLayoutFrame * >( item );
@@ -30,6 +30,8 @@ class QgsLayoutAttributeTableWidget: public QgsLayoutItemBaseWidget, private Ui:
public:
QgsLayoutAttributeTableWidget( QgsLayoutFrame *frame );

void setReportTypeString( const QString &string ) override;

protected:

bool setNewItem( QgsLayoutItem *item ) override;
@@ -889,6 +889,7 @@ void QgsLayoutDesignerDialog::showItemOptions( QgsLayoutItem *item, bool bringPa
if ( ! widget )
return;

widget->setReportTypeString( reportTypeString() );

if ( QgsLayoutPagePropertiesWidget *ppWidget = qobject_cast< QgsLayoutPagePropertiesWidget * >( widget.get() ) )
connect( ppWidget, &QgsLayoutPagePropertiesWidget::pageOrientationChanged, this, &QgsLayoutDesignerDialog::pageOrientationChanged );
@@ -3961,6 +3962,14 @@ QPrinter *QgsLayoutDesignerDialog::printer()
return mPrinter.get();
}

QString QgsLayoutDesignerDialog::reportTypeString()
{
if ( atlas() )
return tr( "atlas" );
else
return tr( "report" );
}

void QgsLayoutDesignerDialog::selectItems( const QList<QgsLayoutItem *> items )
{
for ( QGraphicsItem *item : items )
@@ -478,6 +478,7 @@ class QgsLayoutDesignerDialog: public QMainWindow, private Ui::QgsLayoutDesigner

void setPrinterPageOrientation( QgsLayoutItemPage::Orientation orientation );
QPrinter *printer();
QString reportTypeString();
};

#endif // QGSLAYOUTDESIGNERDIALOG_H
@@ -922,6 +922,12 @@ void QgsLayoutLegendWidget::updateLegend()
}
}

void QgsLayoutLegendWidget::setReportTypeString( const QString &string )
{
mFilterLegendByAtlasCheckBox->setText( tr( "Only show items inside current %1 feature" ).arg( string ) );
mFilterLegendByAtlasCheckBox->setToolTip( tr( "Filter out legend elements that lie outside the current %1 feature." ).arg( string ) );
}

bool QgsLayoutLegendWidget::setNewItem( QgsLayoutItem *item )
{
if ( item->type() != QgsLayoutItemRegistry::LayoutLegend )
@@ -39,6 +39,7 @@ class QgsLayoutLegendWidget: public QgsLayoutItemBaseWidget, private Ui::QgsLayo
void updateLegend();

QgsLayoutItemLegend *legend() { return mLegend; }
void setReportTypeString( const QString &string ) override;

protected:

@@ -155,6 +155,12 @@ QgsLayoutMapWidget::QgsLayoutMapWidget( QgsLayoutItemMap *item )
blockAllSignals( false );
}

void QgsLayoutMapWidget::setReportTypeString( const QString &string )
{
mAtlasCheckBox->setTitle( tr( "Controlled by %1" ).arg( string ) );
mAtlasPredefinedScaleRadio->setToolTip( tr( "Use one of the predefined scales of the project where the %1 feature best fits." ).arg( string ) );
}

bool QgsLayoutMapWidget::setNewItem( QgsLayoutItem *item )
{
if ( item->type() != QgsLayoutItemRegistry::LayoutMap )
@@ -37,6 +37,8 @@ class QgsLayoutMapWidget: public QgsLayoutItemBaseWidget, private Ui::QgsLayoutM
public:
explicit QgsLayoutMapWidget( QgsLayoutItemMap *item );

void setReportTypeString( const QString &string ) override;

public slots:
void mScaleLineEdit_editingFinished();
void mSetToMapCanvasExtentButton_clicked();
@@ -154,6 +154,10 @@ bool QgsLayoutItemBaseWidget::setItem( QgsLayoutItem *item )
return false;
}

void QgsLayoutItemBaseWidget::setReportTypeString( const QString & )
{
}

void QgsLayoutItemBaseWidget::registerDataDefinedButton( QgsPropertyOverrideButton *button, QgsLayoutObject::DataDefinedProperty property )
{
mConfigObject->initializeDataDefinedButton( button, property );
@@ -134,6 +134,14 @@ class GUI_EXPORT QgsLayoutItemBaseWidget: public QgsPanelWidget
*/
bool setItem( QgsLayoutItem *item );

/**
* Sets the \a string to use to describe the current report type (e.g.
* "atlas" or "report").
* Subclasses which display this text to users should override this
* and update their widget labels accordingly.
*/
virtual void setReportTypeString( const QString &string );

protected:

/**

0 comments on commit d2c880a

Please sign in to comment.
You can’t perform that action at this time.