Skip to content

Commit

Permalink
small fixes in qgs components
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik committed May 4, 2018
1 parent ab24042 commit c29c667
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/quickgui/plugin/qgsquickplugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void QgsQuickPlugin::registerTypes( const char *uri )
qRegisterMetaType< QgsAttributes > ( "QgsAttributes" );
qRegisterMetaType< QgsCoordinateReferenceSystem >( "QgsCoordinateReferenceSystem" );
qRegisterMetaType< QgsCoordinateTransformContext >( "QgsCoordinateTransformContext" );
qRegisterMetaType< QgsFeature > ( "QgsFeature " );
qRegisterMetaType< QgsFeature > ( "QgsFeature" );
qRegisterMetaType< QgsFeatureId > ( "QgsFeatureId" );
qRegisterMetaType< QgsPoint >( "QgsPoint" );
qRegisterMetaType< QgsPointXY >( "QgsPointXY" );
Expand Down
8 changes: 7 additions & 1 deletion src/quickgui/qgsquickmapcanvasmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ QgsQuickMapCanvasMap::QgsQuickMapCanvasMap( QQuickItem *parent )
connect( &mRefreshTimer, &QTimer::timeout, this, &QgsQuickMapCanvasMap::refreshMap );
connect( &mMapUpdateTimer, &QTimer::timeout, this, &QgsQuickMapCanvasMap::renderJobUpdated );

Q_ASSERT( mMapSettings );
connect( mMapSettings, &QgsQuickMapSettings::extentChanged, this, &QgsQuickMapCanvasMap::onExtentChanged );
connect( mMapSettings, &QgsQuickMapSettings::layersChanged, this, &QgsQuickMapCanvasMap::onLayersChanged );

Expand All @@ -51,6 +50,13 @@ QgsQuickMapCanvasMap::QgsQuickMapCanvasMap( QQuickItem *parent )
setFlags( QQuickItem::ItemHasContents );
}

QgsQuickMapCanvasMap::~QgsQuickMapCanvasMap()
{
Q_ASSERT( mMapSettings );
delete mMapSettings;
mMapSettings = nullptr;
}

QgsQuickMapSettings *QgsQuickMapCanvasMap::mapSettings() const
{
Q_ASSERT( mMapSettings );
Expand Down
2 changes: 1 addition & 1 deletion src/quickgui/qgsquickmapcanvasmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class QUICK_EXPORT QgsQuickMapCanvasMap : public QQuickItem
public:
//! Create map canvas map
QgsQuickMapCanvasMap( QQuickItem *parent = nullptr );
~QgsQuickMapCanvasMap() = default;
~QgsQuickMapCanvasMap();

virtual QSGNode *updatePaintNode( QSGNode *oldNode, QQuickItem::UpdatePaintNodeData * ) override;

Expand Down
8 changes: 4 additions & 4 deletions src/quickgui/qgsquickmapsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,16 +109,16 @@ QgsRectangle QgsQuickMapSettings::visibleExtent() const
return mMapSettings.visibleExtent();
}

QPointF QgsQuickMapSettings::coordinateToScreen( const QgsPoint &p ) const
QPointF QgsQuickMapSettings::coordinateToScreen( const QgsPoint &point ) const
{
QgsPointXY pt( p.x(), p.y() );
QgsPointXY pt( point.x(), point.y() );
QgsPointXY pp = mMapSettings.mapToPixel().transform( pt );
return pp.toQPointF();
}

QgsPoint QgsQuickMapSettings::screenToCoordinate( const QPointF &p ) const
QgsPoint QgsQuickMapSettings::screenToCoordinate( const QPointF &point ) const
{
const QgsPointXY pp = mMapSettings.mapToPixel().toMapCoordinates( p.toPoint() );
const QgsPointXY pp = mMapSettings.mapToPixel().toMapCoordinates( point.toPoint() );
return QgsPoint( pp );
}

Expand Down
4 changes: 2 additions & 2 deletions src/quickgui/qgsquickmapsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ class QUICK_EXPORT QgsQuickMapSettings : public QObject
*
* \return A coordinate in pixel / screen space
*/
Q_INVOKABLE QPointF coordinateToScreen( const QgsPoint &p ) const;
Q_INVOKABLE QPointF coordinateToScreen( const QgsPoint &point ) const;


/**
Expand All @@ -156,7 +156,7 @@ class QUICK_EXPORT QgsQuickMapSettings : public QObject
*
* \return A coordinate in map coordinates
*/
Q_INVOKABLE QgsPoint screenToCoordinate( const QPointF &p ) const;
Q_INVOKABLE QgsPoint screenToCoordinate( const QPointF &point ) const;

//! \copydoc QgsMapSettings::setTransformContext()
void setTransformContext( const QgsCoordinateTransformContext &context );
Expand Down
5 changes: 0 additions & 5 deletions src/quickgui/qgsquickutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,8 @@
* (at your option) any later version. *
* *
***************************************************************************/

#include <QDesktopWidget>
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QString>
#include <QThread>

#include "qgis.h"
#include "qgscoordinatereferencesystem.h"
Expand Down

0 comments on commit c29c667

Please sign in to comment.