Skip to content
Permalink
Browse files

Added /TransferThis/ keywords in the constructor of the composer item…

… classes as suggested by Martin, fixed the possibility of moving the paper item

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10248 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent
mhugent committed Feb 28, 2009
1 parent d36a1f3 commit 73548f4e3e20d47bd26967eed665de6cb8bc559e
@@ -7,7 +7,7 @@ class QgsComposerLabel: QgsComposerItem
#include "qgscomposerlabel.h"
%End
public:
QgsComposerLabel( QgsComposition *composition );
QgsComposerLabel( QgsComposition *composition /TransferThis/);
~QgsComposerLabel();

/** \brief Reimplementation of QCanvasItem::paint*/
@@ -33,4 +33,4 @@ class QgsComposerLabel: QgsComposerItem
* @param node is Dom node corresponding to 'ComposerLabel' tag
*/
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
};
};
@@ -8,7 +8,7 @@ class QgsComposerLegend: QObject, QgsComposerItem
%End

public:
QgsComposerLegend( QgsComposition* composition );
QgsComposerLegend( QgsComposition* composition /TransferThis/);
~QgsComposerLegend();

/** \brief Reimplementation of QCanvasItem::paint*/
@@ -94,4 +94,4 @@ class QgsComposerLegend: QObject, QgsComposerItem

/**Helper function that lists ids of layers contained in map canvas*/
QStringList layerIdList() const;
};
};
@@ -11,9 +11,9 @@ class QgsComposerMap : QObject, QgsComposerItem

public:
/** Constructor. */
QgsComposerMap( QgsComposition *composition, int x, int y, int width, int height );
QgsComposerMap( QgsComposition *composition /TransferThis/, int x, int y, int width, int height );
/** Constructor. Settings are read from project. */
QgsComposerMap( QgsComposition *composition );
QgsComposerMap( QgsComposition *composition /TransferThis/ );
~QgsComposerMap();

/** \brief Preview style */
@@ -114,4 +114,4 @@ class QgsComposerMap : QObject, QgsComposerItem
/**Returns the zoom factor of the graphics view. If no
graphics view exists, the default 1 is returned*/
double horizontalViewScaleFactor() const;
};
};
@@ -9,7 +9,7 @@ class QgsComposerPicture: QObject, QgsComposerItem
%End

public:
QgsComposerPicture( QgsComposition *composition );
QgsComposerPicture( QgsComposition *composition /TransferThis/);
~QgsComposerPicture();

/**Reimplementation of QCanvasItem::paint*/
@@ -48,4 +48,4 @@ class QgsComposerPicture: QObject, QgsComposerItem
signals:
/**Tell the configuration widget that the settings need to be updated*/
void settingsChanged();
};
};
@@ -9,7 +9,7 @@ class QgsComposerScaleBar: QObject, QgsComposerItem
%End
public:

QgsComposerScaleBar( QgsComposition* composition );
QgsComposerScaleBar( QgsComposition* composition /TransferThis/);
~QgsComposerScaleBar();

/** \brief Reimplementation of QCanvasItem::paint*/
@@ -98,4 +98,4 @@ class QgsComposerScaleBar: QObject, QgsComposerItem
protected:
/**Calculates with of a segment in mm and stores it in mSegmentMillimeters*/
void refreshSegmentMillimeters();
};
};
@@ -42,13 +42,13 @@ class QgsComposerView: QGraphicsView
QgsComposition* composition();

/**Adds label to the graphics scene and advices composer to create a widget for it (through signal)*/
void addComposerLabel( QgsComposerLabel* label /Transfer/);
void addComposerLabel( QgsComposerLabel* label);
/**Adds map to the graphics scene and advices composer to create a widget for it (through signal)*/
void addComposerMap( QgsComposerMap* map /Transfer/);
void addComposerMap( QgsComposerMap* map );
/**Adds scale bar to the graphics scene and advices composer to create a widget for it (through signal)*/
void addComposerScaleBar( QgsComposerScaleBar* scaleBar /Transfer/);
void addComposerScaleBar( QgsComposerScaleBar* scaleBar );
/**Adds legend to the graphics scene and advices composer to create a widget for it (through signal)*/
void addComposerLegend( QgsComposerLegend* legend /Transfer/);
void addComposerLegend( QgsComposerLegend* legend );
/**Adds picture to the graphics scene and advices composer to create a widget for it (through signal)*/
void addComposerPicture( QgsComposerPicture* picture );

@@ -79,7 +79,7 @@ QgsComposerItem* QgsComposition::composerItemAt( const QPointF & position )
for ( ; itemIt != itemList.end(); ++itemIt )
{
QgsComposerItem* composerItem = dynamic_cast<QgsComposerItem*>( *itemIt );
if ( composerItem )
if ( composerItem && composerItem != mPaperItem )
{
return composerItem;
}
@@ -57,12 +57,12 @@ void QgsComposerView::mousePressEvent( QMouseEvent* e )

//select topmost item at position of event
QgsComposerItem* selectedItem = composition()->composerItemAt( scenePoint );
if ( selectedItem )
if ( !selectedItem )
{
selectedItem->setSelected( true );
break;
}


selectedItem->setSelected( true );
QGraphicsView::mousePressEvent( e );
emit selectedItemChanged( selectedItem );
break;
@@ -71,6 +71,7 @@ void QgsComposerView::mousePressEvent( QMouseEvent* e )
case MoveItemContent:
{
//store item as member if it is selected and cursor is over item
QGraphicsItem* gitem = itemAt( e->pos());
QgsComposerItem* item = dynamic_cast<QgsComposerItem*>( itemAt( e->pos() ) );
if ( item )
{

0 comments on commit 73548f4

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