<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Take screenshot of MapGraphicsView (in C++) in Qt Maps SDK Questions</title>
    <link>https://community.esri.com/t5/qt-maps-sdk-questions/take-screenshot-of-mapgraphicsview-in-c/m-p/76995#M371</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can try this.&amp;nbsp; You might want to change the size of the rectangle.&amp;nbsp; But this should work:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; QRect rect(QPoint(0, 100), QSize(400, 400)) ;
&amp;nbsp;&amp;nbsp;&amp;nbsp; QPixmap image = QWidget::grab(rect);
&amp;nbsp;&amp;nbsp;&amp;nbsp; QString path = QDir::tempPath() + QString("/testImage.png");
&amp;nbsp;&amp;nbsp;&amp;nbsp; bool success = image.save(path);
&amp;nbsp;&amp;nbsp;&amp;nbsp; qDebug() &amp;lt;&amp;lt; success;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Possibly didn't work because there was no size specified maybe? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 22:58:27 GMT</pubDate>
    <dc:creator>KoushikHajra</dc:creator>
    <dc:date>2021-12-10T22:58:27Z</dc:date>
    <item>
      <title>Take screenshot of MapGraphicsView (in C++)</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/take-screenshot-of-mapgraphicsview-in-c/m-p/76992#M368</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I want to take a screenshot of the MapGraphicsView and export it to png, jpg..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I tried this, but it returns just a grey picture:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;//EsriRuntimeQt::MapGraphicsView* m_MapGraphicsView;
auto pixmap = QPixmap::grabWidget(m_MapGraphicsView);
QFile file(fileUrl.toLocalFile());
file.open(QIODevice::WriteOnly);
pixmap.save(&amp;amp;file, "PNG");&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there another way of taking a screenshot?&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Maximilian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:58:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/take-screenshot-of-mapgraphicsview-in-c/m-p/76992#M368</guid>
      <dc:creator>MaximilianSchönenberg</dc:creator>
      <dc:date>2021-12-10T22:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: Take screenshot of MapGraphicsView (in C++)</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/take-screenshot-of-mapgraphicsview-in-c/m-p/76993#M369</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This doesn't directly help you right now, but I just wanted to let you know that with our Quartz release, there will be a function directly on the MapView that will export it to an image.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Mar 2016 20:46:18 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/take-screenshot-of-mapgraphicsview-in-c/m-p/76993#M369</guid>
      <dc:creator>LucasDanzinger</dc:creator>
      <dc:date>2016-03-28T20:46:18Z</dc:date>
    </item>
    <item>
      <title>Re: Take screenshot of MapGraphicsView (in C++)</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/take-screenshot-of-mapgraphicsview-in-c/m-p/76994#M370</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, but Quartz isn't released yet. Is there another way of taking a screenshot of the MapView with 10.2.6?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Mar 2016 06:26:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/take-screenshot-of-mapgraphicsview-in-c/m-p/76994#M370</guid>
      <dc:creator>MaximilianSchönenberg</dc:creator>
      <dc:date>2016-03-29T06:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Take screenshot of MapGraphicsView (in C++)</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/take-screenshot-of-mapgraphicsview-in-c/m-p/76995#M371</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can try this.&amp;nbsp; You might want to change the size of the rectangle.&amp;nbsp; But this should work:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; QRect rect(QPoint(0, 100), QSize(400, 400)) ;
&amp;nbsp;&amp;nbsp;&amp;nbsp; QPixmap image = QWidget::grab(rect);
&amp;nbsp;&amp;nbsp;&amp;nbsp; QString path = QDir::tempPath() + QString("/testImage.png");
&amp;nbsp;&amp;nbsp;&amp;nbsp; bool success = image.save(path);
&amp;nbsp;&amp;nbsp;&amp;nbsp; qDebug() &amp;lt;&amp;lt; success;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Possibly didn't work because there was no size specified maybe? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:58:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/take-screenshot-of-mapgraphicsview-in-c/m-p/76995#M371</guid>
      <dc:creator>KoushikHajra</dc:creator>
      <dc:date>2021-12-10T22:58:27Z</dc:date>
    </item>
    <item>
      <title>Re: Take screenshot of MapGraphicsView (in C++)</title>
      <link>https://community.esri.com/t5/qt-maps-sdk-questions/take-screenshot-of-mapgraphicsview-in-c/m-p/76996#M372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for your answer Koushik, but it's the same result as before (see attachment).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is what finally works for me (thanks to &lt;A href="https://community.esri.com/migrated-users/128170" target="_blank"&gt;Norbert Thoden&lt;/A&gt;​):&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;//QVBoxLayout* m_VBox
QRect rect(m_VBox-&amp;gt;itemAt(1)-&amp;gt;geometry());
QMutex m(QMutex::NonRecursive);
m.lock();
m.tryLock(100);
auto pixmap = QGuiApplication::primaryScreen()-&amp;gt;grabWindow(winId(),rect.x(), rect.y(), rect.width(), rect.height());
QFile file(fileUrl.toLocalFile());
file.open(QIODevice::WriteOnly);
pixmap.save(&amp;amp;file, "PNG");&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;Maximilian Schönenberg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:58:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/qt-maps-sdk-questions/take-screenshot-of-mapgraphicsview-in-c/m-p/76996#M372</guid>
      <dc:creator>MaximilianSchönenberg</dc:creator>
      <dc:date>2021-12-10T22:58:29Z</dc:date>
    </item>
  </channel>
</rss>

