Skip to content

Commit 9ed0f62

Browse files
committed
update readme
1 parent 8f8eba3 commit 9ed0f62

3 files changed

Lines changed: 35 additions & 4 deletions

File tree

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ A Qt widget for rendering tile maps.
2020
- [Add Marker](#add-marker)
2121
- [Change Default Marker Icon](#change-default-marker-icon)
2222
- [QML](#qml)
23+
- [Python](#python)
2324
- [Using Offline Maps](#using-offline-maps)
2425

2526
## Setup
@@ -220,7 +221,7 @@ mapView->setMarkerIcon(newIcon);
220221

221222
## QML
222223

223-
``SimpleMapView`` also provides a QML component based on ``QQuickItem`` instead of ``QWidget``. Since ``QQuickItem`` uses GPU-accelerated rendering, it offers better performance.
224+
``SimpleMapView`` provides a QML component based on ``QQuickItem`` instead of ``QWidget``. Since ``QQuickItem`` uses GPU-accelerated rendering, it offers better performance.
224225

225226
To use the QML component, you need to enable it in your build system first.
226227

@@ -303,6 +304,32 @@ Window {
303304
304305
```
305306

307+
308+
## Python
309+
310+
To use ``SimpleMapView`` in ``PySide6`` applications, you have to build and install the **python module** by running ``pip install .`` command on the project's root.
311+
312+
Here is a simple example on how to use in python:
313+
314+
```py
315+
import sys
316+
from PySide6.QtWidgets import QApplication
317+
from PySimpleMapView import SimpleMapView, TileServers, MapText
318+
319+
app = QApplication(sys.argv)
320+
321+
map_view = SimpleMapView()
322+
map_view.setTileServer(TileServers.GOOGLE_MAP)
323+
324+
marker = map_view.addMarker(map_view.center())
325+
marker.findChild(MapText).setText("Marker")
326+
327+
map_view.resize(1280, 720)
328+
map_view.show()
329+
330+
sys.exit(app.exec())
331+
```
332+
306333
## Using Offline Maps
307334

308335
Create a widgets app and download the tiles. This is a one time thing.

pyproject.toml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
[build-system]
2-
requires = ["scikit-build-core", "PySide6", "shiboken6", "shiboken6_generator"]
2+
requires = [
3+
"scikit-build-core",
4+
"cmake>=3.20",
5+
"PySide6==6.10.1",
6+
"shiboken6==6.10.1",
7+
"shiboken6_generator==6.10.1"
8+
]
39
build-backend = "scikit_build_core.build"
410

511
[project]
612
name = "PySimpleMapView"
713
version = "1.2.0"
814
description = "Python bindings for the SimpleMapView C++ Qt Widget"
9-
dependencies = ["PySide6"]
1015

1116
[tool.scikit-build]
1217
cmake.build-type = "Release"

python_bindings/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ file(TO_CMAKE_PATH "${PYSIDE6_DIR}" PYSIDE6_DIR)
2727
list(APPEND CMAKE_PREFIX_PATH "${SHIBOKEN6_GENERATOR_DIR}" "${PYSIDE6_DIR}")
2828

2929
find_package(Shiboken6Tools REQUIRED)
30-
find_package(Qt6 REQUIRED COMPONENTS Core Widgets Positioning Network)
3130

3231
set(
3332
generated_sources

0 commit comments

Comments
 (0)