A list model storing a list of bookmarks available in a Map. More...
| Header | #include <Bookmark |
| Since | Esri |
| Inherits | QAbstract |
Public Types
| enum | Bookmark |
Public Functions
| virtual | ~ |
| void | append( |
| void | clear() |
| bool | contains( |
| Esri | first() const |
| int | index |
| void | insert(int index, Esri |
| bool | is |
| Esri | last() const |
| void | move(int from, int to) |
| void | remove |
| void | remove |
Reimplemented Public Functions
| virtual Esri | at(int index) const override |
| virtual QVariant | data(const QModel |
| virtual int | size() const override |
Signals
| void | error |
(since Esri void | item |
(since Esri void | item |
Detailed Description
Modifying this model (adding, removing, moving) will update the bookmarks available in the Map.
The model returns data for the following roles:
| Role | Type | Description | BookmarkRoles |
|---|---|---|---|
| name | QString | The name of the bookmark. | Bookmark |
Example:
A common workflow is to add bookmarks to a map's BookmarkListModel and display them using the BookmarksView component from the ArcGIS Maps SDK for Qt toolkit. Selecting a bookmark in the component navigates the associated map view to the bookmark's viewpoint.
Add some Bookmarks to the list model:
// Create the bookmark from the name and viewpoint Bookmark* bookmark = new Bookmark(name, viewpoint, this); // Add it to the map's bookmark list m_bookmarks->append(bookmark);
Associate the toolkit's BookmarksView with the map view to display the map's bookmarks:
BookmarksView { id: bookmarksView anchors { left: parent.left top: parent.top margins: 15 } width: 250 height: 200 geoView: mapView }
Relevant samples:
- Manage bookmarks: Access and create bookmarks on a map.
Member Type Documentation
enum BookmarkListModel::BookmarkRoles
This enum specifies the custom roles which can be used with BookmarkListModel::data.
| Constant | Value | Description |
|---|---|---|
Esri | Qt | The name of the bookmark. |
Member Function Documentation
[override virtual noexcept] BookmarkListModel::~BookmarkListModel ()
Destructor.
void BookmarkListModel::append(Esri::ArcGISRuntime::Bookmark *bookmark)
Appends a bookmark to the bookmark list model.
[override virtual] Esri::ArcGISRuntime::Bookmark *BookmarkListModel::at(int index) const
Returns the bookmark at the specified index.
void BookmarkListModel::clear()
Removes all bookmarks from the list model.
List models do not take ownership of the objects they contain. Therefore, removing or clearing objects from the list model will not delete those objects. An RAII technique should be used to ensure that memory is properly deallocated.
bool BookmarkListModel::contains(Esri::ArcGISRuntime::Bookmark *bookmark) const
Returns true if the list model contains the specified bookmark.
[override virtual] QVariant BookmarkListModel::data(const QModelIndex &index, int role = Qt::DisplayRole) const
Reimplements: QAbstractItemModel::data(const QModelIndex &index, int role) const.
Returns the data stored under the given role for the bookmark referred to by the index.
- index. The index in the model for which to return data.
- role. The role for which to return data.
[signal] void BookmarkListModel::errorOccurred (const Esri::ArcGISRuntime::Error &error)
Signal emitted when an error occurs.
- error - Details about the error.
Esri::ArcGISRuntime::Bookmark *BookmarkListModel::first() const
Returns the first bookmark in the list model.
int BookmarkListModel::indexOf (Esri::ArcGISRuntime::Bookmark *bookmark) const
Returns the index of the bookmark specified.
void BookmarkListModel::insert(int index, Esri::ArcGISRuntime::Bookmark *bookmark)
Inserts a bookmark at a specified index in the list model.
This method will append to the list model if the index is greater than the current size of the list.
bool BookmarkListModel::isEmpty () const
Returns true if the list model contains no bookmarks.
[signal, since Esri::ArcGISRuntime 100.15] void BookmarkListModel::itemAdded (int index)
Signal emitted when an item is added from the list model.
index is the index of the removed bookmark.
This function was introduced in Esri::ArcGISRuntime 100.15.
[signal, since Esri::ArcGISRuntime 100.15] void BookmarkListModel::itemRemoved (int index)
Signal emitted when an item is removed from the list model.
index is the index of the removed item.
This function was introduced in Esri::ArcGISRuntime 100.15.
Esri::ArcGISRuntime::Bookmark *BookmarkListModel::last() const
Returns the last bookmark in the list model.
void BookmarkListModel::move(int from, int to)
Moves one bookmark from an index in the list model to a different index.
void BookmarkListModel::removeAt (int index)
Removes a bookmark at the specified index.
List models do not take ownership of the objects they contain. Therefore, removing or clearing objects from the list model will not delete those objects. An RAII technique should be used to ensure that memory is properly deallocated.
void BookmarkListModel::removeOne (Esri::ArcGISRuntime::Bookmark *bookmark)
Removes the specified bookmark from the list model.
List models do not take ownership of the objects they contain. Therefore, removing or clearing objects from the list model will not delete those objects. An RAII technique should be used to ensure that memory is properly deallocated.
[override virtual] int BookmarkListModel::size() const
Returns the number of bookmarks contained in the list model.