Skip to content

Commit 3e1acda

Browse files
authored
Merge pull request #605 from Esri/bri12415/fixmodeldata
rename modelData
2 parents b67f379 + b59fee1 commit 3e1acda

File tree

11 files changed

+53
-35
lines changed

11 files changed

+53
-35
lines changed

uitools/cpp/Esri/ArcGISRuntime/Toolkit/CoordinateConversionController.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,14 @@ GenericListModel* CoordinateConversionController::coordinateFormats() const
313313
return m_coordinateFormats;
314314
}
315315

316+
/*!
317+
\brief Returns the \c CoordinateConversionOption at \a index from the \c GenericListModel
318+
*/
319+
CoordinateConversionOption* CoordinateConversionController::getOption(int index) const
320+
{
321+
return m_coordinateFormats->element<CoordinateConversionOption>(m_coordinateFormats->index(index));
322+
}
323+
316324
/*!
317325
\brief Returns the list of textual representations of the current point in
318326
different formats.

uitools/cpp/Esri/ArcGISRuntime/Toolkit/CoordinateConversionController.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ class CoordinateConversionController : public QObject
6262

6363
GenericListModel* coordinateFormats() const;
6464

65+
Q_INVOKABLE CoordinateConversionOption* getOption(int index) const;
66+
6567
GenericListModel* conversionResults() const;
6668

6769
Q_INVOKABLE Esri::ArcGISRuntime::Point currentPoint() const;

uitools/cpp/Esri/ArcGISRuntime/Toolkit/Internal/GenericListModel.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace Esri::ArcGISRuntime::Toolkit {
5555
\li Value
5656
\li Type
5757
\row
58-
\li modelData
58+
\li listModelData
5959
\li \c{Qt::UserRole}
6060
\li \c{Foo*}
6161
\row
@@ -72,7 +72,7 @@ namespace Esri::ArcGISRuntime::Toolkit {
7272
\li \c {bool}
7373
\endtable
7474
75-
A hard-coded \e{modelData} role is always exposed as \c Qt::UserRole,
75+
A hard-coded \e{listModelData} role is always exposed as \c Qt::UserRole,
7676
followed by each property on \c Foo in order of declaration.
7777
7878
Both \c data and \c setData can be called respectively on these roles.
@@ -290,7 +290,7 @@ namespace Esri::ArcGISRuntime::Toolkit {
290290
\brief A collection of role names and the corresponding user role enum.
291291
292292
This will always return the hard-coded \e{(name, role)} combination
293-
\c{(modelData, Qt::UserRole)}.
293+
\c{(listModelData, Qt::UserRole)}.
294294
295295
For each subsequent property it will also expose:
296296
\c{(property_N, Qt::UserRole + N + 1)} where \tt{property_N} is the N\sup{th}
@@ -304,7 +304,7 @@ namespace Esri::ArcGISRuntime::Toolkit {
304304
\li Name
305305
\li Value
306306
\row
307-
\li modelData
307+
\li listModelData
308308
\li \c{Qt::UserRole}
309309
\row
310310
\li propertyA
@@ -326,7 +326,7 @@ namespace Esri::ArcGISRuntime::Toolkit {
326326
return {};
327327

328328
QHash<int, QByteArray> output;
329-
output.insert(Qt::UserRole, "modelData");
329+
output.insert(Qt::UserRole, "listModelData");
330330

331331
const int offset = m_elementType->propertyOffset();
332332
for (int i = offset; i < m_elementType->propertyCount(); ++i)

uitools/import/Esri/ArcGISRuntime/Toolkit/BasemapGallery.qml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ Pane {
208208
id: basemapDelegate
209209
width: view.cellWidth
210210
height: view.cellHeight
211-
enabled: controller.basemapMatchesCurrentSpatialReference(modelData.basemap)
212-
onClicked: controller.setCurrentBasemap(modelData.basemap)
211+
enabled: controller.basemapMatchesCurrentSpatialReference(listModelData.basemap)
212+
onClicked: controller.setCurrentBasemap(listModelData.basemap)
213213
indicator: Item { }
214214
down: GridView.isCurrentItem
215215

@@ -229,13 +229,13 @@ Pane {
229229
}
230230
icon {
231231
cache: false
232-
source: modelData.thumbnailUrl
232+
source: listModelData.thumbnailUrl
233233
width: basemapGallery.internal.defaultCellSize
234234
height: basemapGallery.internal.defaultCellSize
235235
color: "transparent"
236236
}
237237

238-
text: modelData.name === "" ? "Unnamed basemap" : modelData.name
238+
text: listModelData.name === "" ? "Unnamed basemap" : listModelData.name
239239
display: {
240240
if (basemapGallery.internal.calculatedStyle === BasemapGallery.ViewStyle.List) {
241241
return AbstractButton.TextBesideIcon;
@@ -250,23 +250,23 @@ Pane {
250250
Qt.openUrlExternally(link)
251251
}
252252
}
253-
ToolTip.text: modelData.tooltip
253+
ToolTip.text: listModelData.tooltip
254254
MouseArea {
255255
id: mouseArea
256256
z : 2
257257
anchors.fill: parent
258258
hoverEnabled: true
259259
onClicked: {
260-
if (controller.currentBasemap !== modelData.basemap)
260+
if (controller.currentBasemap !== listModelData.basemap)
261261
busyIndicator.running = true;
262-
controller.setCurrentBasemap(modelData.basemap);
262+
controller.setCurrentBasemap(listModelData.basemap);
263263
}
264264

265265
// When mouse enters thumbnail area, use timer to delay showing of tooltip.
266266
onEntered: {
267267
// Create a definition for the showTooltipFn property of timerOnEntered
268268
timerOnEntered.showTooltipFn = () => {
269-
if (allowTooltips && mouseArea.containsMouse && modelData.tooltip !== "")
269+
if (allowTooltips && mouseArea.containsMouse && listModelData.tooltip !== "")
270270
basemapDelegate.ToolTip.visible = true;
271271
}
272272
timerOnEntered.start();

uitools/import/Esri/ArcGISRuntime/Toolkit/BookmarksView.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ Pane {
7979
text: name
8080
width: listView.width
8181
indicator: null
82-
onPressed: controller.zoomToBookmarkExtent(modelData)
82+
onPressed: controller.zoomToBookmarkExtent(listModelData)
8383
}
8484
}
8585

uitools/import/Esri/ArcGISRuntime/Toolkit/ClientCertificateView.qml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ Dialog {
9797
}
9898

9999
delegate: ItemDelegate {
100-
text: modelData
100+
text: listModelData
101101
anchors {
102102
left: parent.left
103103
right: parent.right

uitools/import/Esri/ArcGISRuntime/Toolkit/Controller/BasemapGalleryController.qml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ QtObject {
6969
\brief The gallery of BasemapGalleryItem objects.
7070
7171
Internally, the gallery is a QML ListModel containing elements of type ListElement.
72-
Each ListElement has a single property `modelData`, which maps to a BasemapGalleryItem.
72+
Each ListElement has a single property `listModelData`, which maps to a BasemapGalleryItem.
7373
*/
7474
readonly property alias gallery: internal.gallery
7575

@@ -123,7 +123,7 @@ QtObject {
123123
return false;
124124
}
125125
internal.gallery.append(
126-
{ "modelData" : internal.galleryItem.createObject(
126+
{ "listModelData" : internal.galleryItem.createObject(
127127
this,
128128
{
129129
basemap: basemap,
@@ -149,7 +149,7 @@ QtObject {
149149
// We do a name and ItemID comparisons, since the ArcGIS QML API disallows
150150
// pointer comparisons.
151151
for (let i = 0; i < gallery.count; i++) {
152-
let b = gallery.get(i).modelData;
152+
let b = gallery.get(i).listModelData;
153153
if (b && b.basemap && b.basemap.name === basemap.name) {
154154
// If there is an item involved, we can check the itemId to confirm the sameness.
155155
if ((b.basemap.item && basemap.item && b.basemap.item.itemId === basemap.item.itemId)

uitools/import/Esri/ArcGISRuntime/Toolkit/Controller/BookmarksViewController.qml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ QtObject {
3939
\brief The bookmarks of Bookmark list objects.
4040
4141
Internally, the list is a QML ListModel containing elements of type ListElement.
42-
Each ListElement has a `modelData` and property `name`, which maps to a Bookmark.
42+
Each ListElement has a `listModelData` and property `name`, which maps to a Bookmark.
4343
*/
4444
readonly property alias bookmarks: internal.bookmarks
4545

4646
/*!
47-
\brief Method that takes a Bookmark \a modelData and zoom to that bookmark in the `geoView`.
47+
\brief Method that takes a Bookmark \a listModelData and zoom to that bookmark in the `geoView`.
4848
*/
49-
function zoomToBookmarkExtent(modelData) {
50-
geoView.setBookmark(modelData);
49+
function zoomToBookmarkExtent(listModelData) {
50+
geoView.setBookmark(listModelData);
5151
}
5252

5353
/*! \internal */
@@ -84,7 +84,7 @@ QtObject {
8484
for (let i = 0; i <= internal.rawBookmarks.count; i++) {
8585
let bookmark = internal.rawBookmarks.get(i);
8686
if (bookmark)
87-
bookmarks.insert(i, {modelData: bookmark, name: bookmark.name});
87+
bookmarks.insert(i, {listModelData: bookmark, name: bookmark.name});
8888
}
8989
}
9090
}
@@ -97,7 +97,7 @@ QtObject {
9797
function onRowsInserted(parent, first, last) {
9898
for (let i = first; i <= last; i++) {
9999
let bookmark = internal.rawBookmarks.get(i);
100-
bookmarks.insert(i, {modelData: bookmark, name: bookmark.name});
100+
bookmarks.insert(i, {listModelData: bookmark, name: bookmark.name});
101101
}
102102
}
103103

uitools/import/Esri/ArcGISRuntime/Toolkit/Controller/CoordinateConversionController.qml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import Esri.ArcGISRuntime
2727

2828
QtObject {
2929
id: controller
30-
3130
/*!
3231
\qmlproperty GeoView geoView
3332
\brief The GeoView for this tool. Should be a SceneView or a MapView.
@@ -244,6 +243,14 @@ QtObject {
244243
}
245244
}
246245

246+
/*!
247+
\qmlmethod CoordinateConversionController::getOption(int index)
248+
\brief Returns the CoordinateConversionOption at index.
249+
*/
250+
function getOption(index) {
251+
return formats[index];
252+
}
253+
247254
/*! \internal */
248255
property QtObject internal: QtObject {
249256
property Point currentPoint: null

uitools/import/Esri/ArcGISRuntime/Toolkit/Controller/SearchViewController.qml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ QtObject {
131131
\qmlproperty ListModel sources
132132
\brief The collection of search sources to be used.
133133
134-
Each element is a ListElement with a single \c modelData
134+
Each element is a ListElement with a single \c listModelData
135135
field, which contains the search source object.
136136
*/
137137
readonly property alias sources: internal.sources
@@ -246,7 +246,7 @@ QtObject {
246246
// Go through all sources and start a search.
247247
const area = restrictToArea ? internal.queryArea : null;
248248
for (let i = 0; i < internal.sources.count; i++) {
249-
const source = internal.sources.get(i).modelData;
249+
const source = internal.sources.get(i).listModelData;
250250
if (source) {
251251
source.search(controller.currentQuery, area);
252252
}
@@ -298,7 +298,7 @@ QtObject {
298298
property ListModel sources: ListModel {
299299
onRowsInserted: (parent, first, last) =>{
300300
for (let i = first; i <= last; ++i) {
301-
const source = sources.get(i).modelData;
301+
const source = sources.get(i).listModelData;
302302
if (source) {
303303
// Listen to the source changes in results/suggestions.
304304
source.suggestions.suggestionsAdded.connect(internal.onSuggestionsAdded);
@@ -309,7 +309,7 @@ QtObject {
309309
}
310310
onRowsAboutToBeRemoved: {
311311
for (let i = first; i <= last; i++) {
312-
const source = source.get(i).modelData;
312+
const source = source.get(i).listModelData;
313313
if (source) {
314314
// Disconnect from source.
315315
source.suggestions.suggestionsAdded.disconnect(internal.onSuggestionsAdded);
@@ -450,7 +450,7 @@ QtObject {
450450

451451
onQueryCenterChanged: {
452452
for (let i = 0; i < internal.sources.count; i++) {
453-
const source = internal.sources.get(i).modelData;
453+
const source = internal.sources.get(i).listModelData;
454454
if (source) {
455455
// Update all sources with changes to queryCenter.
456456
source.preferredSearchLocation = internal.queryCenter;
@@ -468,7 +468,7 @@ QtObject {
468468
internal.graphicsOverlay = null;
469469
internal.sources.clear();
470470
internal.sources.append({
471-
"modelData" : internal.defaultWorldGeocoderSource.createObject(this)
471+
"listModelData" : internal.defaultWorldGeocoderSource.createObject(this)
472472
});
473473

474474
if (controller.geoView) {
@@ -482,7 +482,7 @@ QtObject {
482482
onCurrentQueryChanged: {
483483
controller.eligableForRequery = false;
484484
for (let i = 0; i < internal.sources.count; i++) {
485-
const source = internal.sources.get(i).modelData;
485+
const source = internal.sources.get(i).listModelData;
486486
if (source) {
487487
source.suggestions.searchText = controller.currentQuery;
488488
}

0 commit comments

Comments
 (0)