Skip to content

Commit

Permalink
Add ui for configuring html items
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 24, 2017
1 parent 584cbd0 commit 83ee649
Show file tree
Hide file tree
Showing 8 changed files with 912 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/app/CMakeLists.txt
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions src/app/layout/qgslayoutapputils.cpp
Expand Up @@ -35,6 +35,7 @@
#include "qgslayoutlegendwidget.h"
#include "qgslayoutframe.h"
#include "qgslayoutitemhtml.h"
#include "qgslayouthtmlwidget.h"
#include "qgisapp.h"
#include "qgsmapcanvas.h"

Expand Down Expand Up @@ -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() );

Expand Down

0 comments on commit 83ee649

Please sign in to comment.