<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Screenshot with QT]]></title><description><![CDATA[<p dir="auto">Im using the code below for taking screenshot of my charts.<br />
But i dont want to open a file dialog.<br />
I want to save them with a giving format. In every new picture it will save it the date and time.<br />
I dont want to give a name.<br />
How can i do it without file dialog?</p>
<pre><code>```
QRect crop_rect(int x, int y, int w, int h);
QPixmap desk = qApp-&gt;screens().at(0)-&gt;grabWindow(
    QDesktopWidget().winId());

   QString format = "jpg";
   QString initialPath = tr("Screenshots") + tr("/Image.") +
           QDateTime::currentDateTime().toString("dd.MM.yyyy" "hh.mm.ss.") + format;

   QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"),
                              initialPath,
                              tr("%1 Files (*.%2);;All Files (*)")
                              .arg(format.toUpper())
                              .arg(format));
   if (!fileName.isEmpty())
       desk.save(fileName, format.toLatin1().constData());
</code></pre>
<pre><code></code></pre>
]]></description><link>https://forum.qt.io/topic/126651/screenshot-with-qt</link><generator>RSS for Node</generator><lastBuildDate>Fri, 24 Apr 2026 00:09:27 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/126651.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 14 May 2021 09:36:23 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Screenshot with QT on Fri, 14 May 2021 15:54:18 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/firsnur96">@<bdi>firsnur96</bdi></a> please don't <a href="https://forum.qt.io/topic/126578/taking-screenshot-in-qt-application">double post</a></p>
]]></description><link>https://forum.qt.io/post/659729</link><guid isPermaLink="true">https://forum.qt.io/post/659729</guid><dc:creator><![CDATA[Pablo J. Rogina]]></dc:creator><pubDate>Fri, 14 May 2021 15:54:18 GMT</pubDate></item><item><title><![CDATA[Reply to Screenshot with QT on Fri, 14 May 2021 10:12:23 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/firsnur96">@<bdi>firsnur96</bdi></a> said in <a href="/post/659663">Screenshot with QT</a>:</p>
<blockquote>
<p dir="auto">How can i do?</p>
</blockquote>
<p dir="auto">Are you asking me how to add a button?<br />
Can you please explain what you want to do?<br />
Should there be a button to select folder where user can store screen-shots?<br />
What is the problem with that? Add a button, connect its clicked signal to a slot where you use <a href="https://doc.qt.io/qt-5/qfiledialog.html#getExistingDirectory" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qfiledialog.html#getExistingDirectory</a> to let the user select a folder, really nothing special...</p>
]]></description><link>https://forum.qt.io/post/659666</link><guid isPermaLink="true">https://forum.qt.io/post/659666</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Fri, 14 May 2021 10:12:23 GMT</pubDate></item><item><title><![CDATA[Reply to Screenshot with QT on Fri, 14 May 2021 09:54:42 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/jsulm">@<bdi>jsulm</bdi></a><br />
Ok.<br />
I want to add another push button for opening the directory<br />
How can i do?</p>
]]></description><link>https://forum.qt.io/post/659663</link><guid isPermaLink="true">https://forum.qt.io/post/659663</guid><dc:creator><![CDATA[firsnur96]]></dc:creator><pubDate>Fri, 14 May 2021 09:54:42 GMT</pubDate></item><item><title><![CDATA[Reply to Screenshot with QT on Fri, 14 May 2021 09:41:53 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/firsnur96">@<bdi>firsnur96</bdi></a> said in <a href="/post/659654">Screenshot with QT</a>:</p>
<blockquote>
<p dir="auto">But i dont want to open a file dialog</p>
</blockquote>
<p dir="auto">Then don't open a dialog, what is the problem?<br />
Construct the file name as you need and use it...</p>
]]></description><link>https://forum.qt.io/post/659656</link><guid isPermaLink="true">https://forum.qt.io/post/659656</guid><dc:creator><![CDATA[jsulm]]></dc:creator><pubDate>Fri, 14 May 2021 09:41:53 GMT</pubDate></item></channel></rss>