Skip to content

Commit

Permalink
Start porting item properties widget
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Nov 7, 2017
1 parent d3836e5 commit b2414d8
Show file tree
Hide file tree
Showing 15 changed files with 4,629 additions and 7 deletions.
6 changes: 6 additions & 0 deletions python/core/layout/qgslayoutitem.sip
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ class QgsLayoutItem : QgsLayoutObject, QGraphicsRectItem, QgsLayoutUndoObjectInt
enum UndoCommand
{
UndoIncrementalMove,
UndoStrokeColor,
UndoStrokeWidth,
UndoBackgroundColor,
UndoOpacity,
UndoSetId,
UndoRotation,
};

explicit QgsLayoutItem( QgsLayout *layout, bool manageZValue = true );
Expand Down
7 changes: 7 additions & 0 deletions python/core/layout/qgslayoutobject.sip
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,13 @@ class QgsLayoutObject: QObject, QgsExpressionContextGenerator
Refreshes the object, causing a recalculation of any property overrides.
%End

signals:

void changed();
%Docstring
Emitted when the object's properties change.
%End

protected:

bool writeObjectPropertiesToElement( QDomElement &parentElement, QDomDocument &document, const QgsReadWriteContext &context ) const;
Expand Down
37 changes: 37 additions & 0 deletions python/gui/layout/qgslayoutitemwidget.sip
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,43 @@ class QgsLayoutItemBaseWidget: QgsPanelWidget

};


class QgsLayoutItemPropertiesWidget: QWidget
{
%Docstring
A widget for controlling the common properties of layout items (e.g. position and size, background, stroke, frame).
This widget can be embedded into other layout item widgets.
.. versionadded:: 3.0
%End

%TypeHeaderCode
#include "qgslayoutitemwidget.h"
%End
public:
QgsLayoutItemPropertiesWidget( QWidget *parent, QgsLayoutItem *item );

QgsLayoutItem::ReferencePoint positionMode() const;
%Docstring
:rtype: QgsLayoutItem.ReferencePoint
%End

void showBackgroundGroup( bool showGroup );

void showFrameGroup( bool showGroup );

protected slots:
void initializeDataDefinedButtons();
%Docstring
Initializes data defined buttons to current atlas coverage layer
%End
void populateDataDefinedButtons();
%Docstring
Sets data defined button state to match item
%End

};


/************************************************************************
* This file has been generated automatically from *
* *
Expand Down
2 changes: 2 additions & 0 deletions src/app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ SET(QGIS_APP_SRCS
layout/qgslayoutdesignerdialog.cpp
layout/qgslayoutguidewidget.cpp
layout/qgslayoutappmenuprovider.cpp
layout/qgslayoutmapwidget.cpp
layout/qgslayoutpagepropertieswidget.cpp
layout/qgslayoutpropertieswidget.cpp

Expand Down Expand Up @@ -373,6 +374,7 @@ SET (QGIS_APP_MOC_HDRS
layout/qgslayoutappmenuprovider.h
layout/qgslayoutdesignerdialog.h
layout/qgslayoutguidewidget.h
layout/qgslayoutmapwidget.h
layout/qgslayoutpagepropertieswidget.h
layout/qgslayoutpropertieswidget.h

Expand Down
8 changes: 7 additions & 1 deletion src/app/layout/qgslayoutapputils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include "qgslayoutitemguiregistry.h"
#include "qgslayoutitemregistry.h"
#include "qgslayoutviewrubberband.h"
#include "qgslayoutmapwidget.h"
#include "qgslayoutitemmap.h"

void QgsLayoutAppUtils::registerGuiForKnownItemTypes()
{
Expand All @@ -40,7 +42,11 @@ void QgsLayoutAppUtils::registerGuiForKnownItemTypes()

registry->addLayoutItemGuiMetadata( new QgsLayoutItemGuiMetadata( QgsLayoutItemRegistry::LayoutItem + 1002, QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddLabel.svg" ) ), nullptr, createRubberBand ) );

registry->addLayoutItemGuiMetadata( new QgsLayoutItemGuiMetadata( QgsLayoutItemRegistry::LayoutMap, QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddMap.svg" ) ), nullptr, createRubberBand ) );
registry->addLayoutItemGuiMetadata( new QgsLayoutItemGuiMetadata( QgsLayoutItemRegistry::LayoutMap, QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddMap.svg" ) ),
[ = ]( QgsLayoutItem * item )->QgsLayoutItemBaseWidget *
{
return new QgsLayoutMapWidget( qobject_cast< QgsLayoutItemMap * >( item ) );
}, createRubberBand ) );

registry->addLayoutItemGuiMetadata( new QgsLayoutItemGuiMetadata( QgsLayoutItemRegistry::LayoutRectangle, QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddBasicRectangle.svg" ) ), nullptr, createRubberBand, QStringLiteral( "shapes" ) ) );
registry->addLayoutItemGuiMetadata( new QgsLayoutItemGuiMetadata( QgsLayoutItemRegistry::LayoutEllipse, QgsApplication::getThemeIcon( QStringLiteral( "/mActionAddBasicCircle.svg" ) ), nullptr, createEllipseBand, QStringLiteral( "shapes" ) ) );
Expand Down
Loading

0 comments on commit b2414d8

Please sign in to comment.