I just updated my setup to 200.1 (200.2 requires new Qt version my setup cant update to yet) and even though I am calling "mapGraphicsView->setAttributionTextVisible(false);" the "Powered by Esri" bar still shows up on my map.
I checked my license and my extensions and they both have a licenseStatus of 3/Valid.
And further experimentation with calling it with true, then false does not seem to do anything.
If I call isAttributionTextVisible that is returning false.
Hello Troy,
I tested with 200.2, everything looks fine. I'll try with 200.1.
EDIT : which platform do you use? And which license level?
linux/ubuntu 22.04. I censored out our key info but I can send it in a direct message or email if you like.
// Before initializing ArcGIS Runtime, set the
// ArcGIS Runtime license.
QStringList extensions = QStringList();
extensions.append(QString(
"runtimeanalysis,1000,[key info removed],none,[key info removed]"));
Esri::ArcGISRuntime::LicenseResult result =
Esri::ArcGISRuntime::ArcGISRuntimeEnvironment::setLicense(
QString("runtimestandard,1000,[key info removed],none,[key info removed]"),
extensions);
printf("LicenseResult created with status of: %d\n",
(int)result.licenseStatus());
for( const auto& extension : result.extensionsStatus().toStdMap())
{
printf("LicenseResult extension %s created with status of: %d\n",
extension.first.toStdString().c_str(),
(int)extension.second);
}
printf("License expiration date: %s\n",
Esri::ArcGISRuntime::ArcGISRuntimeEnvironment::license()->expiry().toString().toStdString().c_str());
printf("License isPermanent: %d\n",
Esri::ArcGISRuntime::ArcGISRuntimeEnvironment::license()->isPermanent());
printf("License licenseLevel: %d\n",
(int)Esri::ArcGISRuntime::ArcGISRuntimeEnvironment::license()->licenseLevel());
// Use this code to check for licensing errors
if (Esri::ArcGISRuntime::ArcGISRuntimeEnvironment::initialize() == false)
{
application.quit();
return 1;
}
And here is the output of those printf statements
LicenseResult created with status of: 3
LicenseResult extension runtimeanalysis created with status of: 3
License expiration date: Sun Aug 17 07:12:55 292278994
License isPermanent: 1
License licenseLevel: 3
I can reproduce with 200.1 and 2002. We will investigate to understand the problem.
You can force the update using `update` function:
mapGraphicsView->setAttributionTextVisible(false);
mapGraphicsView->update();
Calling update explicitly does not seem to fix this for me. I fiddled with my code to temporarily backdoor one of my other toggles to try switching attribution text off and on once everything was up and running (thinking I was calling too early before some async loadable became available) but adding the update call does not seem to be having any effect.
Can you post a minimal code to reproduce the problem?
I can put something together here in a day or two once I get my environment back to 200.0 temporarily and confirm it works there and then that it does not work on 200.1
Most of my samples are modified derivations of an older copy of the FeatureLayerShapefile sample from your github. I added a button in the top left that when clicked toggles the status of what it sends to setAttributionTextVisible. This toggle works on 200.0 but not on 200.1. The errorOccurred signal is not getting triggered also for the mapGraphicsView .
main.cpp
// Copyright 2017 Esri.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <QApplication>
#include <QMessageBox>
#include "FeatureLayerShapefile.h"
#define STRINGIZE(x) #x
#define QUOTE(x) STRINGIZE(x)
int main(int argc, char *argv[])
{
QApplication application(argc, argv);
#ifdef Q_OS_WIN
// Force usage of OpenGL ES through ANGLE on Windows
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
#endif
FeatureLayerShapefile applicationWindow;
applicationWindow.setMinimumWidth(800);
applicationWindow.setMinimumHeight(600);
applicationWindow.show();
return application.exec();
}
FeatureLayerShapefile.h
// [WriteFile Name=FeatureLayerShapefile, Category=Layers]
// [Legal]
// Copyright 2017 Esri.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// [Legal]
#ifndef FEATURELAYERSHAPEFILE_H
#define FEATURELAYERSHAPEFILE_H
namespace Esri
{
namespace ArcGISRuntime
{
class Map;
class MapGraphicsView;
class FeatureCollectionTable;
class FeatureCollection;
class FeatureCollectionLayer;
class Feature;
class UniqueValueRenderer;
class FeatureQueryResult;
} // namespace ArcGISRuntime
} // namespace Esri
class QPushButton;
#include <QWidget>
#include <Error.h>
class FeatureLayerShapefile : public QWidget
{
Q_OBJECT
public:
explicit FeatureLayerShapefile(QWidget *parent = nullptr);
~FeatureLayerShapefile() = default;
public slots:
void button1Pressed();
void errorOccurred(Esri::ArcGISRuntime::Error error);
private:
Esri::ArcGISRuntime::Map *m_map = nullptr;
Esri::ArcGISRuntime::MapGraphicsView *m_mapView = nullptr;
QPushButton *m_button = nullptr;
void createAndAddShapefileLayer();
};
#endif // FEATURELAYERSHAPEFILE_H
FeatureLayerShapefile.cpp
// [WriteFile Name=FeatureLayerShapefile, Category=Layers]
// [Legal]
// Copyright 2017 Esri.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// [Legal]
#include "FeatureLayerShapefile.h"
#include "Map.h"
#include "MapGraphicsView.h"
#include "ShapefileFeatureTable.h"
#include "FeatureLayer.h"
#include "Envelope.h"
#include "LayerListModel.h"
#include "Error.h"
#include "TaskWatcher.h"
#include <QFileInfo>
#include <iostream>
#include <QVBoxLayout>
#include <QPushButton>
using namespace std;
using namespace Esri::ArcGISRuntime;
FeatureLayerShapefile::FeatureLayerShapefile(QWidget *parent /* = nullptr */)
: QWidget(parent)
{
// Create a map using the Imagery with labels basemap
m_map = new Map(this);
// Create a map view, and pass in the map
m_mapView = new MapGraphicsView(m_map, this);
// Create the button to display the input dialog
m_button = new QPushButton("Do Something", this);
m_button->setStyleSheet("QPushbutton#text {color: black;}");
connect(m_button,
&QPushButton::clicked,
this,
&FeatureLayerShapefile::button1Pressed);
// Set up the UI
QVBoxLayout *vBoxLayout = new QVBoxLayout();
vBoxLayout->addWidget(m_mapView);
setLayout(vBoxLayout);
// Create and add the shapefile to the map
createAndAddShapefileLayer();
}
void FeatureLayerShapefile::createAndAddShapefileLayer()
{
// TODO download and update the path in this file
// from
// https://github.com/Esri/arcgis-runtime-samples-data/tree/master/shapefiles
QString dataPath = "../shapefiles/world-continents.shp";
// Create the ShapefileFeatureTable
ShapefileFeatureTable *featureTable =
new ShapefileFeatureTable(dataPath, this);
// Create the feature layer from the ShapefileFeatureTable
FeatureLayer *layer = new FeatureLayer(featureTable, this);
connect(layer,
&FeatureLayer::doneLoading,
this,
[this, layer](Error loadError)
{
cout << __LINE__ << " " << loadError.message().toStdString()
<< endl;
if (!loadError.isEmpty())
return;
// If the layer was loaded successfully, set the map extent to the
// full extent of the layer
m_mapView->setViewpointGeometry(layer->fullExtent());
});
connect(layer,
&FeatureLayer::errorOccurred,
this,
[this, layer](Error loadError)
{
cout << __LINE__ << " " << loadError.message().toStdString()
<< " " << loadError.additionalMessage().toStdString()
<< endl;
});
connect(featureTable,
&ShapefileFeatureTable::errorOccurred,
this,
[this, layer](Error loadError) {
cout << __LINE__ << " " << loadError.message().toStdString()
<< endl;
});
connect(m_mapView,
&MapGraphicsView::errorOccurred,
this,
[this, layer](Error loadError) {
cout << __LINE__ << " " << loadError.message().toStdString()
<< endl;
});
layer->load();
// Add the shapefile layer to the map
m_map->operationalLayers()->clear();
m_map->operationalLayers()->append(layer);
}
void FeatureLayerShapefile::errorOccurred(Esri::ArcGISRuntime::Error error)
{
printf("FeatureLayerShapefile::onErrorOccurred errorType = %d, domain = %d, "
"extendedErrorType = %d, %s %s\n",
(int)error.errorType(),
(int)error.domain(),
(int)error.extendedErrorType(),
error.message().toStdString().c_str(),
error.additionalMessage().toStdString().c_str());
}
void FeatureLayerShapefile::button1Pressed()
{
static bool shown = false;
shown = !shown;
cout << "button1Pressed shown = " << shown << endl;
m_mapView->setAttributionTextVisible(shown);
m_mapView->update();
}
Hello,
I'm sorry, I didn't realize that you're using QtWidgets. You're right, `update` doesn't work in this case.
There is no workaround. We will fix that as soon as possible.