Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 committed Feb 28, 2009
1 parent d36a1f3 commit 73548f4
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 19 deletions.
4 changes: 2 additions & 2 deletions python/core/qgscomposerlabel.sip
Expand Up @@ -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*/
Expand All @@ -33,4 +33,4 @@ class QgsComposerLabel: QgsComposerItem
* @param node is Dom node corresponding to 'ComposerLabel' tag
*/
bool readXML( const QDomElement& itemElem, const QDomDocument& doc );
};
};
4 changes: 2 additions & 2 deletions python/core/qgscomposerlegend.sip
Expand Up @@ -8,7 +8,7 @@ class QgsComposerLegend: QObject, QgsComposerItem
%End

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

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

/**Helper function that lists ids of layers contained in map canvas*/
QStringList layerIdList() const;
};
};
6 changes: 3 additions & 3 deletions python/core/qgscomposermap.sip
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
};
};
4 changes: 2 additions & 2 deletions python/core/qgscomposerpicture.sip
Expand Up @@ -9,7 +9,7 @@ class QgsComposerPicture: QObject, QgsComposerItem
%End

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

/**Reimplementation of QCanvasItem::paint*/
Expand Down Expand Up @@ -48,4 +48,4 @@ class QgsComposerPicture: QObject, QgsComposerItem
signals:
/**Tell the configuration widget that the settings need to be updated*/
void settingsChanged();
};
};
4 changes: 2 additions & 2 deletions python/core/qgscomposerscalebar.sip
Expand Up @@ -9,7 +9,7 @@ class QgsComposerScaleBar: QObject, QgsComposerItem
%End
public:

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

/** \brief Reimplementation of QCanvasItem::paint*/
Expand Down Expand Up @@ -98,4 +98,4 @@ class QgsComposerScaleBar: QObject, QgsComposerItem
protected:
/**Calculates with of a segment in mm and stores it in mSegmentMillimeters*/
void refreshSegmentMillimeters();
};
};
8 changes: 4 additions & 4 deletions python/gui/qgscomposerview.sip
Expand Up @@ -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 );

Expand Down
2 changes: 1 addition & 1 deletion src/core/composer/qgscomposition.cpp
Expand Up @@ -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;
}
Expand Down
7 changes: 4 additions & 3 deletions src/gui/qgscomposerview.cpp
Expand Up @@ -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;
Expand All @@ -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 )
{
Expand Down

0 comments on commit 73548f4

Please sign in to comment.