mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-23 00:04:25 -04:00
Start implementing an add item tool
This commit is contained in:
parent
25034979e3
commit
a6ccd63bc8
@ -277,6 +277,7 @@
|
|||||||
%Include layout/qgslayoutdesignerinterface.sip
|
%Include layout/qgslayoutdesignerinterface.sip
|
||||||
%Include layout/qgslayoutview.sip
|
%Include layout/qgslayoutview.sip
|
||||||
%Include layout/qgslayoutviewtool.sip
|
%Include layout/qgslayoutviewtool.sip
|
||||||
|
%Include layout/qgslayoutviewtooladditem.sip
|
||||||
%Include locator/qgslocator.sip
|
%Include locator/qgslocator.sip
|
||||||
%Include locator/qgslocatorfilter.sip
|
%Include locator/qgslocatorfilter.sip
|
||||||
%Include locator/qgslocatorwidget.sip
|
%Include locator/qgslocatorwidget.sip
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
%ModuleHeaderCode
|
||||||
|
#include <qgslayoutviewtooladditem.h>
|
||||||
|
%End
|
||||||
|
|
||||||
class QgsLayoutViewTool : QObject
|
class QgsLayoutViewTool : QObject
|
||||||
{
|
{
|
||||||
%Docstring
|
%Docstring
|
||||||
@ -23,8 +27,8 @@ class QgsLayoutViewTool : QObject
|
|||||||
%End
|
%End
|
||||||
|
|
||||||
%ConvertToSubClassCode
|
%ConvertToSubClassCode
|
||||||
if ( dynamic_cast<QgsMapToolZoom *>( sipCpp ) != NULL )
|
if ( dynamic_cast<QgsLayoutViewToolAddItem *>( sipCpp ) != NULL )
|
||||||
sipType = sipType_QgsMapToolZoom;
|
sipType = sipType_QgsLayoutViewToolAddItem;
|
||||||
else
|
else
|
||||||
sipType = NULL;
|
sipType = NULL;
|
||||||
%End
|
%End
|
||||||
|
46
python/gui/layout/qgslayoutviewtooladditem.sip
Normal file
46
python/gui/layout/qgslayoutviewtooladditem.sip
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/************************************************************************
|
||||||
|
* This file has been generated automatically from *
|
||||||
|
* *
|
||||||
|
* src/gui/layout/qgslayoutviewtooladditem.h *
|
||||||
|
* *
|
||||||
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||||
|
************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class QgsLayoutViewToolAddItem : QgsLayoutViewTool
|
||||||
|
{
|
||||||
|
%Docstring
|
||||||
|
Layout view tool for adding items to a layout.
|
||||||
|
.. versionadded:: 3.0
|
||||||
|
%End
|
||||||
|
|
||||||
|
%TypeHeaderCode
|
||||||
|
#include "qgslayoutviewtooladditem.h"
|
||||||
|
%End
|
||||||
|
public:
|
||||||
|
|
||||||
|
QgsLayoutViewToolAddItem( QgsLayoutView *view );
|
||||||
|
|
||||||
|
int itemType() const;
|
||||||
|
%Docstring
|
||||||
|
Returns the item type for items created by the tool.
|
||||||
|
.. seealso:: setItemType()
|
||||||
|
:rtype: int
|
||||||
|
%End
|
||||||
|
|
||||||
|
void setItemType( int type );
|
||||||
|
%Docstring
|
||||||
|
Sets the item ``type`` for items created by the tool.
|
||||||
|
.. seealso:: itemType()
|
||||||
|
%End
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
/************************************************************************
|
||||||
|
* This file has been generated automatically from *
|
||||||
|
* *
|
||||||
|
* src/gui/layout/qgslayoutviewtooladditem.h *
|
||||||
|
* *
|
||||||
|
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
|
||||||
|
************************************************************************/
|
@ -160,6 +160,7 @@ SET(QGIS_GUI_SRCS
|
|||||||
|
|
||||||
layout/qgslayoutview.cpp
|
layout/qgslayoutview.cpp
|
||||||
layout/qgslayoutviewtool.cpp
|
layout/qgslayoutviewtool.cpp
|
||||||
|
layout/qgslayoutviewtooladditem.cpp
|
||||||
|
|
||||||
locator/qgslocator.cpp
|
locator/qgslocator.cpp
|
||||||
locator/qgslocatorfilter.cpp
|
locator/qgslocatorfilter.cpp
|
||||||
@ -625,6 +626,7 @@ SET(QGIS_GUI_MOC_HDRS
|
|||||||
layout/qgslayoutdesignerinterface.h
|
layout/qgslayoutdesignerinterface.h
|
||||||
layout/qgslayoutview.h
|
layout/qgslayoutview.h
|
||||||
layout/qgslayoutviewtool.h
|
layout/qgslayoutviewtool.h
|
||||||
|
layout/qgslayoutviewtooladditem.h
|
||||||
|
|
||||||
locator/qgslocator.h
|
locator/qgslocator.h
|
||||||
locator/qgslocatorfilter.h
|
locator/qgslocatorfilter.h
|
||||||
|
@ -27,6 +27,12 @@ class QWheelEvent;
|
|||||||
class QKeyEvent;
|
class QKeyEvent;
|
||||||
class QgsLayoutView;
|
class QgsLayoutView;
|
||||||
|
|
||||||
|
#ifdef SIP_RUN
|
||||||
|
% ModuleHeaderCode
|
||||||
|
#include <qgslayoutviewtooladditem.h>
|
||||||
|
% End
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \ingroup gui
|
* \ingroup gui
|
||||||
* Abstract base class for all layout view tools.
|
* Abstract base class for all layout view tools.
|
||||||
@ -39,8 +45,8 @@ class GUI_EXPORT QgsLayoutViewTool : public QObject
|
|||||||
|
|
||||||
#ifdef SIP_RUN
|
#ifdef SIP_RUN
|
||||||
SIP_CONVERT_TO_SUBCLASS_CODE
|
SIP_CONVERT_TO_SUBCLASS_CODE
|
||||||
if ( dynamic_cast<QgsMapToolZoom *>( sipCpp ) != NULL )
|
if ( dynamic_cast<QgsLayoutViewToolAddItem *>( sipCpp ) != NULL )
|
||||||
sipType = sipType_QgsMapToolZoom;
|
sipType = sipType_QgsLayoutViewToolAddItem;
|
||||||
else
|
else
|
||||||
sipType = NULL;
|
sipType = NULL;
|
||||||
SIP_END
|
SIP_END
|
||||||
|
27
src/gui/layout/qgslayoutviewtooladditem.cpp
Normal file
27
src/gui/layout/qgslayoutviewtooladditem.cpp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
qgslayoutviewtooladditem.cpp
|
||||||
|
----------------------------
|
||||||
|
Date : July 2017
|
||||||
|
Copyright : (C) 2017 Nyall Dawson
|
||||||
|
Email : nyall dot dawson at gmail dot com
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#include "qgslayoutviewtooladditem.h"
|
||||||
|
|
||||||
|
QgsLayoutViewToolAddItem::QgsLayoutViewToolAddItem( QgsLayoutView *view )
|
||||||
|
: QgsLayoutViewTool( view, tr( "Add item" ) )
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int QgsLayoutViewToolAddItem::itemType() const
|
||||||
|
{
|
||||||
|
return mItemType;
|
||||||
|
}
|
54
src/gui/layout/qgslayoutviewtooladditem.h
Normal file
54
src/gui/layout/qgslayoutviewtooladditem.h
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
qgslayoutviewtooladditem.h
|
||||||
|
--------------------------
|
||||||
|
Date : July 2017
|
||||||
|
Copyright : (C) 2017 Nyall Dawson
|
||||||
|
Email : nyall dot dawson at gmail dot com
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
#ifndef QGSLAYOUTVIEWTOOLADDITEM_H
|
||||||
|
#define QGSLAYOUTVIEWTOOLADDITEM_H
|
||||||
|
|
||||||
|
#include "qgis.h"
|
||||||
|
#include "qgis_gui.h"
|
||||||
|
#include "qgslayoutviewtool.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \ingroup gui
|
||||||
|
* Layout view tool for adding items to a layout.
|
||||||
|
* \since QGIS 3.0
|
||||||
|
*/
|
||||||
|
class GUI_EXPORT QgsLayoutViewToolAddItem : public QgsLayoutViewTool
|
||||||
|
{
|
||||||
|
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
QgsLayoutViewToolAddItem( QgsLayoutView *view );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the item type for items created by the tool.
|
||||||
|
* \see setItemType()
|
||||||
|
*/
|
||||||
|
int itemType() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the item \a type for items created by the tool.
|
||||||
|
* \see itemType()
|
||||||
|
*/
|
||||||
|
void setItemType( int type );
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
int mItemType = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // QGSLAYOUTVIEWTOOLADDITEM_H
|
Loading…
x
Reference in New Issue
Block a user