<?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[Save App with self MenuBar]]></title><description><![CDATA[<p dir="auto">Hi,<br />
I've create self menuBar with the button : File, Save, Save As, etc..</p>
<p dir="auto">And i would like to save my Python File with the Windows Explorer, but i completely stuck for the rest of the code.</p>
<pre><code>self.saveAsAction.setText(_translate("MainWindow", "Save To...")) self.saveAsAction.setShortcut(_translate("MainWindow", "Ctrl+Shift+S"))
self.saveAsAction.triggered.connect(self.saveAs)

 def saveAs(self):
</code></pre>
<p dir="auto">If you have any idea that could unblock me, i'll take it !</p>
<p dir="auto">Thanks</p>
]]></description><link>https://forum.qt.io/topic/126428/save-app-with-self-menubar</link><generator>RSS for Node</generator><lastBuildDate>Wed, 13 May 2026 18:45:32 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/126428.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 07 May 2021 09:57:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Save App with self MenuBar on Fri, 07 May 2021 20:07:20 GMT]]></title><description><![CDATA[<p dir="auto">Ok, i think, understood !<br />
Thanks for your help</p>
]]></description><link>https://forum.qt.io/post/658596</link><guid isPermaLink="true">https://forum.qt.io/post/658596</guid><dc:creator><![CDATA[Zayle]]></dc:creator><pubDate>Fri, 07 May 2021 20:07:20 GMT</pubDate></item><item><title><![CDATA[Reply to Save App with self MenuBar on Fri, 07 May 2021 20:04:07 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/zayle">@<bdi>Zayle</bdi></a> said in <a href="/post/658593">Save App with self MenuBar</a>:</p>
<blockquote>
<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> Hi, if i understand, this line :</p>
<pre><code>from PyQt5.QtWidgets import QApplication, QWidget, QInputDialog, QLineEdit, QFileDialog, QTextEdit, QAction
</code></pre>
<p dir="auto">is enough ?</p>
</blockquote>
<p dir="auto">If your remove the QtGui. where you use QAction.</p>
]]></description><link>https://forum.qt.io/post/658595</link><guid isPermaLink="true">https://forum.qt.io/post/658595</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Fri, 07 May 2021 20:04:07 GMT</pubDate></item><item><title><![CDATA[Reply to Save App with self MenuBar on Fri, 07 May 2021 20:00:05 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/zayle">@<bdi>Zayle</bdi></a><br />
Should be!  Give it a go?</p>
]]></description><link>https://forum.qt.io/post/658594</link><guid isPermaLink="true">https://forum.qt.io/post/658594</guid><dc:creator><![CDATA[JonB]]></dc:creator><pubDate>Fri, 07 May 2021 20:00:05 GMT</pubDate></item><item><title><![CDATA[Reply to Save App with self MenuBar on Fri, 07 May 2021 19:45:56 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/sgaist">@<bdi>SGaist</bdi></a> Hi, if i understand, this line :</p>
<pre><code>from PyQt5.QtWidgets import QApplication, QWidget, QInputDialog, QLineEdit, QFileDialog, QTextEdit, QAction
</code></pre>
<p dir="auto">is enough ?</p>
]]></description><link>https://forum.qt.io/post/658593</link><guid isPermaLink="true">https://forum.qt.io/post/658593</guid><dc:creator><![CDATA[Zayle]]></dc:creator><pubDate>Fri, 07 May 2021 19:45:56 GMT</pubDate></item><item><title><![CDATA[Reply to Save App with self MenuBar on Fri, 07 May 2021 14:04:58 GMT]]></title><description><![CDATA[<p dir="auto">Hi,</p>
<p dir="auto">Because <a href="https://doc.qt.io/qt-5/qaction.html" target="_blank" rel="noopener noreferrer nofollow ugc">QAction</a> is part of the widgets module.</p>
<p dir="auto">You have that information in the small table at the top of the documentation.</p>
]]></description><link>https://forum.qt.io/post/658516</link><guid isPermaLink="true">https://forum.qt.io/post/658516</guid><dc:creator><![CDATA[SGaist]]></dc:creator><pubDate>Fri, 07 May 2021 14:04:58 GMT</pubDate></item><item><title><![CDATA[Reply to Save App with self MenuBar on Fri, 07 May 2021 13:42:14 GMT]]></title><description><![CDATA[<p dir="auto">Hi, and thanks for your answer.<br />
I continue with the documentation of Qt, but i'm stuck again :</p>
<pre><code>saveAction = QtGui.QAction("&amp;Save File", self)
        self.saveAction.setText(_translate("MainWindow", "Save To"))
        self.saveAction.setShortcut(_translate("MainWindow", "Ctrl+S"))
        self.saveAction.setStatusTip('Save File')
        self.saveAction.triggered.connect(self.file_save)

        self.mainMenu = self.menubar()
        self.fileMenu.addAction(saveAction)

    def file_save(self):
        name = QtGui.QFileDialog.getSaveFileName(self, 'Save File')
        file = open(name, 'w')
        text = self.textEdit.toPlainText()
        file.write(text)
        file.close()
</code></pre>
<p dir="auto">I've an error  in this line :</p>
<pre><code>saveAction = QtGui.QAction("&amp;Save File", self)
</code></pre>
<p dir="auto">AttributeError: module 'PyQt5.QtGui' has no attribute 'QAction'</p>
<p dir="auto">I don't know how to solve it</p>
]]></description><link>https://forum.qt.io/post/658508</link><guid isPermaLink="true">https://forum.qt.io/post/658508</guid><dc:creator><![CDATA[Zayle]]></dc:creator><pubDate>Fri, 07 May 2021 13:42:14 GMT</pubDate></item><item><title><![CDATA[Reply to Save App with self MenuBar on Fri, 07 May 2021 10:00:22 GMT]]></title><description><![CDATA[<p dir="auto">You probably want to just use <a href="https://doc.qt.io/qt-5/qfiledialog.html#getSaveFileName" target="_blank" rel="noopener noreferrer nofollow ugc">https://doc.qt.io/qt-5/qfiledialog.html#getSaveFileName</a></p>
]]></description><link>https://forum.qt.io/post/658442</link><guid isPermaLink="true">https://forum.qt.io/post/658442</guid><dc:creator><![CDATA[VRonin]]></dc:creator><pubDate>Fri, 07 May 2021 10:00:22 GMT</pubDate></item></channel></rss>