Skip to content
Permalink
Browse files
Move annotation items and widgets from gui to app
git-svn-id: http://svn.osgeo.org/qgis/trunk@13190 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
mhugent committed Mar 29, 2010
1 parent 7ba75be commit c0a4ee39514bb9945886a9c1528aa78c9f730348
@@ -25,9 +25,6 @@ class QgsAnnotationItem: QgsMapCanvasItem
QgsAnnotationItem( QgsMapCanvas* mapCanvas );
virtual ~QgsAnnotationItem();

/**Creates an editor widget (caller takes ownership)*/
virtual QDialog* createEditor() = 0;

void updatePosition();

QRectF boundingRect() const;
@@ -71,4 +68,4 @@ class QgsAnnotationItem: QgsMapCanvasItem

void _writeXML( QDomDocument& doc, QDomElement& itemElem ) const;
void _readXML( const QDomDocument& doc, const QDomElement& annotationElem );
};
};
@@ -13,9 +13,6 @@ class QgsFormAnnotationItem: QObject, QgsAnnotationItem
//! paint function called by map canvas
void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );

/**Create a configuration dialog*/
QDialog* createEditor();

QSizeF minimumFrameSize() const;
/**Returns the optimal frame size*/
QSizeF preferredFrameSize() const;
@@ -28,4 +25,4 @@ class QgsFormAnnotationItem: QObject, QgsAnnotationItem

void writeXML( QDomDocument& doc ) const;
void readXML( const QDomDocument& doc, const QDomElement& itemElem );
};
};
@@ -7,8 +7,6 @@ class QgsTextAnnotationItem: QgsAnnotationItem
QgsTextAnnotationItem( QgsMapCanvas* canvas );
~QgsTextAnnotationItem();

QDialog* createEditor();

/**Returns document (caller takes ownership)*/
QTextDocument* document() const;
/**Sets document (does not take ownership)*/
@@ -18,4 +16,4 @@ class QgsTextAnnotationItem: QgsAnnotationItem
void readXML( const QDomDocument& doc, const QDomElement& itemElem );

void paint( QPainter* painter );
};
};
@@ -4,6 +4,7 @@ SET(QGIS_APP_SRCS
qgisappinterface.cpp
qgsabout.cpp
qgsaddattrdialog.cpp
qgsannotationwidget.cpp
qgsattributeactiondialog.cpp
qgsattributedialog.cpp
qgsattributetypedialog.cpp
@@ -17,6 +18,7 @@ SET(QGIS_APP_SRCS
qgscustomprojectiondialog.cpp
qgsdbfilterproxymodel.cpp
qgsdbtablemodel.cpp
qgsformannotationdialog.cpp
qgsspatialitefilterproxymodel.cpp
qgsspatialitetablemodel.cpp
qgsdelattrdialog.cpp
@@ -65,6 +67,7 @@ SET(QGIS_APP_SRCS
qgsprojectproperties.cpp
qgsrasterlayerproperties.cpp
qgssearchquerybuilder.cpp
qgstextannotationdialog.cpp
qgswmssourceselect.cpp
qgsshortcutsmanager.cpp
qgssinglesymboldialog.cpp
@@ -126,6 +129,7 @@ SET (QGIS_APP_MOC_HDRS
qgisappinterface.h
qgsabout.h
qgsaddattrdialog.h
qgsannotationwidget.h
qgsattributeactiondialog.h
qgsattributedialog.h
qgsattributetypedialog.h
@@ -137,15 +141,14 @@ SET (QGIS_APP_MOC_HDRS
qgscustomprojectiondialog.h
qgsdelattrdialog.h
qgsfieldcalculator.h
qgsformannotationdialog.h
qgsmaptoolmeasureangle.h
qgsnewvectorlayerdialog.h
qgsgraduatedsymboldialog.h
qgshelpviewer.h
qgsidentifyresults.h
qgslabeldialog.h

qgsmanageconnectionsdialog.h

qgsmaptoolidentify.h
qgsmaptoolsplitfeatures.h
qgsmaptoolvertexedit.h
@@ -161,7 +164,6 @@ SET (QGIS_APP_MOC_HDRS
qgsmaptooldeletevertex.h
qgsmaptoolmovevertex.h
qgsmaptoolsimplify.h

qgsmeasuretool.h
qgsmeasuredialog.h
qgsmergeattributesdialog.h
@@ -172,6 +174,7 @@ SET (QGIS_APP_MOC_HDRS
qgsprojectproperties.h
qgsrasterlayerproperties.h
qgssearchquerybuilder.h
qgstextannotationdialog.h
qgswmssourceselect.h
qgssinglesymboldialog.h
qgssnappingdialog.h
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -16,9 +16,11 @@
***************************************************************************/

#include "qgsmaptoolannotation.h"
#include "qgsformannotationdialog.h"
#include "qgsformannotationitem.h"
#include "qgslogger.h"
#include "qgsmapcanvas.h"
#include "qgstextannotationdialog.h"
#include "qgstextannotationitem.h"
#include <QDialog>
#include <QMouseEvent>
@@ -39,6 +41,28 @@ QgsAnnotationItem* QgsMapToolAnnotation::createItem( QMouseEvent* e )
return 0;
}

QDialog* QgsMapToolAnnotation::createItemEditor( QgsAnnotationItem* item )
{
if ( !item )
{
return 0;
}

QgsTextAnnotationItem* tItem = dynamic_cast<QgsTextAnnotationItem*>( item );
if ( tItem )
{
return new QgsTextAnnotationDialog( tItem );
}

QgsFormAnnotationItem* fItem = dynamic_cast<QgsFormAnnotationItem*>( item );
if ( fItem )
{
return new QgsFormAnnotationDialog( fItem );
}

return 0;
}

void QgsMapToolAnnotation::canvasReleaseEvent( QMouseEvent * e )
{
mCurrentMoveAction = QgsAnnotationItem::NoAction;
@@ -193,7 +217,7 @@ void QgsMapToolAnnotation::canvasDoubleClickEvent( QMouseEvent * e )
{
return;
}
QDialog* itemEditor = item->createEditor();
QDialog* itemEditor = createItemEditor( item );
if ( itemEditor )
{
itemEditor->exec();
@@ -36,6 +36,8 @@ class QgsMapToolAnnotation: public QgsMapTool
protected:
/**Creates a new item. To be implemented by subclasses. Returns 0 by default*/
virtual QgsAnnotationItem* createItem( QMouseEvent* e );
/**Creates an editor widget (caller takes ownership)*/
QDialog* createItemEditor( QgsAnnotationItem* item );

private:
/**Returns the topmost annotation item at the position (or 0 if none)*/
File renamed without changes.
File renamed without changes.
@@ -22,7 +22,6 @@ symbology-ng/characterwidget.cpp
qgisgui.cpp
qgisinterface.cpp
qgsannotationitem.cpp
qgsannotationwidget.cpp
qgsattributeeditor.cpp
qgslegendinterface.cpp
qgscolorbutton.cpp
@@ -33,7 +32,6 @@ qgsdetaileditemwidget.cpp
qgsdetaileditemdata.cpp
qgsencodingfiledialog.cpp
qgsfiledropedit.cpp
qgsformannotationdialog.cpp
qgsformannotationitem.cpp
qgsgenericprojectionselector.cpp
qgsmapcanvas.cpp
@@ -52,7 +50,6 @@ qgsprojectbadlayerguihandler.cpp
qgsprojectionselector.cpp
qgsquickprint.cpp
qgsrubberband.cpp
qgstextannotationdialog.cpp
qgstextannotationitem.cpp
qgsvertexmarker.cpp
qgsludialog.cpp
@@ -75,15 +72,13 @@ symbology-ng/qgsvectorrandomcolorrampv2dialog.h
symbology-ng/qgsvectorcolorbrewercolorrampv2dialog.h
symbology-ng/characterwidget.h

qgsannotationwidget.h
qgsattributeeditor.h
qgscomposerview.h
qgsdetaileditemdelegate.h
qgsdetaileditemwidget.h
qgslegendinterface.h
qgisinterface.h
qgsencodingfiledialog.h
qgsformannotationdialog.h
qgsformannotationitem.h
qgsgenericprojectionselector.h
qgsmapcanvas.h
@@ -93,7 +88,6 @@ qgsmessageviewer.h
qgscredentialdialog.h
qgsprojectionselector.h
qgsquickprint.h
qgstextannotationdialog.h
qgsludialog.h
qgsprojectbadlayerguihandler.h
)
@@ -50,9 +50,6 @@ class GUI_EXPORT QgsAnnotationItem: public QgsMapCanvasItem
QgsAnnotationItem( QgsMapCanvas* mapCanvas );
virtual ~QgsAnnotationItem();

/**Creates an editor widget (caller takes ownership)*/
virtual QDialog* createEditor() = 0;

void updatePosition();

QRectF boundingRect() const;
@@ -16,7 +16,6 @@
***************************************************************************/

#include "qgsformannotationitem.h"
#include "qgsformannotationdialog.h"
#include "qgsattributeeditor.h"
#include "qgsfeature.h"
#include "qgslogger.h"
@@ -142,11 +141,6 @@ void QgsFormAnnotationItem::paint( QPainter * painter, const QStyleOptionGraphic
}
}

QDialog* QgsFormAnnotationItem::createEditor()
{
return new QgsFormAnnotationDialog( this );
}

QSizeF QgsFormAnnotationItem::minimumFrameSize() const
{
if ( mDesignerWidget )
@@ -36,9 +36,6 @@ class GUI_EXPORT QgsFormAnnotationItem: public QObject, public QgsAnnotationItem
//! paint function called by map canvas
void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );

/**Create a configuration dialog*/
QDialog* createEditor();

QSizeF minimumFrameSize() const;
/**Returns the optimal frame size*/
QSizeF preferredFrameSize() const;
@@ -16,7 +16,6 @@
***************************************************************************/

#include "qgstextannotationitem.h"
#include "qgstextannotationdialog.h"
#include <QDomDocument>
#include <QPainter>

@@ -46,11 +45,6 @@ void QgsTextAnnotationItem::setDocument( const QTextDocument* doc )
mDocument = doc->clone();
}

QDialog* QgsTextAnnotationItem::createEditor()
{
return new QgsTextAnnotationDialog( this );
}

void QgsTextAnnotationItem::paint( QPainter * painter )
{
if ( !painter || !mDocument )
@@ -28,8 +28,6 @@ class GUI_EXPORT QgsTextAnnotationItem: public QgsAnnotationItem
QgsTextAnnotationItem( QgsMapCanvas* canvas );
~QgsTextAnnotationItem();

QDialog* createEditor();

/**Returns document (caller takes ownership)*/
QTextDocument* document() const;
/**Sets document (does not take ownership)*/

0 comments on commit c0a4ee3

Please sign in to comment.