Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[QgsQuick] Add moveTo animation to qgsquick map canvas and introduce …
…qgsquick utils (#50810)
- Loading branch information
1 parent
21edf1a
commit 13498bd
Showing
5 changed files
with
154 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/*************************************************************************** | ||
qgsquickutils.cpp | ||
-------------------------------------- | ||
Date : 7.11.2022 | ||
Copyright : (C) 2022 by Tomas Mizera | ||
Email : tomas.mizera (at) lutraconsulting.co.uk | ||
*************************************************************************** | ||
* * | ||
* 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 "qgsquickutils.h" | ||
|
||
QgsQuickUtils::QgsQuickUtils( QObject *parent ) | ||
: QObject( parent ) | ||
{ | ||
} | ||
|
||
QgsPoint QgsQuickUtils::toQgsPoint( const QPointF &point ) | ||
{ | ||
return QgsPoint( point ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/*************************************************************************** | ||
qgsquickutils.cpp | ||
-------------------------------------- | ||
Date : 7.11.2022 | ||
Copyright : (C) 2022 by Tomas Mizera | ||
Email : tomas.mizera (at) lutraconsulting.co.uk | ||
*************************************************************************** | ||
* * | ||
* 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 QGSQUICKUTILS_H | ||
#define QGSQUICKUTILS_H | ||
|
||
#include <QObject> | ||
#include <qglobal.h> | ||
|
||
#include "qgis_quick.h" | ||
|
||
#include "qgspoint.h" | ||
|
||
/** | ||
* \ingroup quick | ||
* | ||
* \brief The QgsQuickUtils class serves as a utility class for common operations | ||
* needed either from QML or cpp. | ||
* | ||
* \note use in qml as a singleton, registered as "Utils", e.g. QgsQuick.Utils.toQgsPoint | ||
* | ||
* \since QGIS 3.30 | ||
*/ | ||
class QUICK_EXPORT QgsQuickUtils : public QObject | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
|
||
//! Creates new QgsQuickUtils - this class is meant to serve as a QML singleton | ||
explicit QgsQuickUtils( QObject *parent = nullptr ); | ||
~QgsQuickUtils() = default; | ||
|
||
/** | ||
* Helper function to convert QPointF to QgsPoint without any transformations. | ||
* Useful for converting these values in QML. | ||
*/ | ||
Q_INVOKABLE static QgsPoint toQgsPoint( const QPointF &point ); | ||
}; | ||
|
||
#endif // QGSQUICKUTILS_H |