mirror of
https://github.com/qgis/QGIS.git
synced 2025-12-06 00:03:16 -05:00
More framework
This commit is contained in:
parent
7fdc80496c
commit
58e52ed9de
@ -38,11 +38,6 @@ The caller takes responsibility for deleting the returned object.
|
||||
virtual QIcon icon() const;
|
||||
|
||||
|
||||
public slots:
|
||||
|
||||
virtual void refresh();
|
||||
|
||||
|
||||
protected:
|
||||
virtual void draw( QgsLayoutItemRenderContext &context );
|
||||
|
||||
|
||||
@ -46,10 +46,6 @@ class CORE_EXPORT QgsLayoutItemElevationProfile: public QgsLayoutItem
|
||||
int type() const override;
|
||||
QIcon icon() const override;
|
||||
|
||||
public slots:
|
||||
|
||||
void refresh() override;
|
||||
|
||||
protected:
|
||||
void draw( QgsLayoutItemRenderContext &context ) override;
|
||||
bool writePropertiesToElement( QDomElement &element, QDomDocument &document, const QgsReadWriteContext &context ) const override;
|
||||
|
||||
@ -31,10 +31,7 @@
|
||||
#include "qgslayoutitemtexttable.h"
|
||||
#include "qgslayoutframe.h"
|
||||
#include "qgslayoutitemmarker.h"
|
||||
#include "qgsgloweffect.h"
|
||||
#include "qgseffectstack.h"
|
||||
#include "qgsvectorlayer.h"
|
||||
#include "qgssymbol.h"
|
||||
#include "qgslayoutitemelevationprofile.h"
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
@ -82,6 +79,8 @@ bool QgsLayoutItemRegistry::populate()
|
||||
addLayoutItemType( new QgsLayoutItemMetadata( LayoutPolygon, QObject::tr( "Polygon" ), QObject::tr( "Polygons" ), QgsLayoutItemPolygon::create ) );
|
||||
addLayoutItemType( new QgsLayoutItemMetadata( LayoutPolyline, QObject::tr( "Polyline" ), QObject::tr( "Polylines" ), QgsLayoutItemPolyline::create ) );
|
||||
|
||||
addLayoutItemType( new QgsLayoutItemMetadata( LayoutElevationProfile, QObject::tr( "Elevation Profile" ), QObject::tr( "Elevation Profiles" ), QgsLayoutItemElevationProfile::create ) );
|
||||
|
||||
addLayoutMultiFrameType( new QgsLayoutMultiFrameMetadata( LayoutHtml, QObject::tr( "HTML" ), QgsLayoutItemHtml::create ) );
|
||||
addLayoutMultiFrameType( new QgsLayoutMultiFrameMetadata( LayoutAttributeTable, QObject::tr( "Attribute Table" ), QgsLayoutItemAttributeTable::create ) );
|
||||
addLayoutMultiFrameType( new QgsLayoutMultiFrameMetadata( LayoutTextTable, QObject::tr( "Text Table" ), QgsLayoutItemTextTable::create ) );
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
#include "qgslayoutpicturewidget.h"
|
||||
#include "qgslayoutitempicture.h"
|
||||
#include "qgslayoutitemlabel.h"
|
||||
#include "qgslayoutitemelevationprofile.h"
|
||||
#include "qgslayoutlabelwidget.h"
|
||||
#include "qgslayoutitemlegend.h"
|
||||
#include "qgslayoutitemscalebar.h"
|
||||
@ -518,4 +519,37 @@ void QgsLayoutGuiUtils::registerGuiForKnownItemTypes( QgsMapCanvas *mapCanvas )
|
||||
return f;
|
||||
} );
|
||||
registry->addLayoutItemGuiMetadata( manualTableItemMetadata.release() );
|
||||
|
||||
|
||||
// elevation profile item
|
||||
|
||||
auto elevationProfileItemMetadata = std::make_unique< QgsLayoutItemGuiMetadata >( QgsLayoutItemRegistry::LayoutElevationProfile, QObject::tr( "Elevation Profile" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionLabel.svg" ) ),
|
||||
[ = ]( QgsLayoutItem * item )->QgsLayoutItemBaseWidget *
|
||||
{
|
||||
return nullptr; //return new QgsLayoutLabelWidget( qobject_cast< QgsLayoutItemLabel * >( item ) );
|
||||
}, createRubberBand );
|
||||
elevationProfileItemMetadata->setItemCreationFunction( [ = ]( QgsLayout * layout )->QgsLayoutItem *
|
||||
{
|
||||
std::unique_ptr< QgsLayoutItemElevationProfile > profileItem = std::make_unique< QgsLayoutItemElevationProfile >( layout );
|
||||
|
||||
#if 0
|
||||
//set default table fonts from settings
|
||||
QgsSettings settings;
|
||||
const QString defaultFontString = settings.value( QStringLiteral( "LayoutDesigner/defaultFont" ), QVariant(), QgsSettings::Gui ).toString();
|
||||
if ( !defaultFontString.isEmpty() )
|
||||
{
|
||||
QgsTextFormat format;
|
||||
QFont f = format.font();
|
||||
f.setFamily( defaultFontString );
|
||||
format.setFont( f );
|
||||
tableMultiFrame->setContentTextFormat( format );
|
||||
f.setBold( true );
|
||||
format.setFont( f );
|
||||
tableMultiFrame->setHeaderTextFormat( format );
|
||||
}
|
||||
#endif
|
||||
return profileItem.release();
|
||||
} );
|
||||
registry->addLayoutItemGuiMetadata( elevationProfileItemMetadata.release() );
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user