Skip to content
Permalink
Browse files

Add ui for configuring html items

  • Loading branch information
nyalldawson committed Nov 24, 2017
1 parent 584cbd0 commit 83ee6498fada4b0d3049354560de9070ea5fa548
@@ -180,6 +180,7 @@ SET(QGIS_APP_SRCS
layout/qgslayoutapputils.cpp
layout/qgslayoutdesignerdialog.cpp
layout/qgslayoutguidewidget.cpp
layout/qgslayouthtmlwidget.cpp
layout/qgslayoutitemslistview.cpp
layout/qgslayoutappmenuprovider.cpp
layout/qgslayoutlabelwidget.cpp
@@ -389,6 +390,7 @@ SET (QGIS_APP_MOC_HDRS
layout/qgslayoutappmenuprovider.h
layout/qgslayoutdesignerdialog.h
layout/qgslayoutguidewidget.h
layout/qgslayouthtmlwidget.h
layout/qgslayoutitemslistview.h
layout/qgslayoutlabelwidget.h
layout/qgslayoutlegendwidget.h
@@ -35,6 +35,7 @@
#include "qgslayoutlegendwidget.h"
#include "qgslayoutframe.h"
#include "qgslayoutitemhtml.h"
#include "qgslayouthtmlwidget.h"
#include "qgisapp.h"
#include "qgsmapcanvas.h"

@@ -207,15 +208,17 @@ void QgsLayoutAppUtils::registerGuiForKnownItemTypes()
auto htmlItemMetadata = qgis::make_unique< QgsLayoutItemGuiMetadata >( QgsLayoutItemRegistry::LayoutHtml, QObject::tr( "HTML" ), QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddHtml.svg" ) ),
[ = ]( QgsLayoutItem * item )->QgsLayoutItemBaseWidget *
{
return nullptr; //new QgsLayoutMapWidget( qobject_cast< QgsLayoutItemMap * >( item ) );
return new QgsLayoutHtmlWidget( qobject_cast< QgsLayoutFrame * >( item ) );
}, createRubberBand );
htmlItemMetadata->setItemCreationFunction( [ = ]( QgsLayout * layout )->QgsLayoutItem*
{
std::unique_ptr< QgsLayoutItemHtml > htmlMultiFrame = qgis::make_unique< QgsLayoutItemHtml >( layout );
QgsLayoutItemHtml *html = htmlMultiFrame.get();
layout->addMultiFrame( htmlMultiFrame.release() );
std::unique_ptr< QgsLayoutFrame > frame = qgis::make_unique< QgsLayoutFrame >( layout, html );
return frame.release();
QgsLayoutFrame *f = frame.get();
html->addFrame( frame.release() );
return f;
} );
registry->addLayoutItemGuiMetadata( htmlItemMetadata.release() );

0 comments on commit 83ee649

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