PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 832 - QFileDialog.getSaveFileName does not return the selected filter
: QFileDialog.getSaveFileName does not return the selected filter
Status: CLOSED DUPLICATE of bug 819
Product: PySide
Classification: Unclassified
Component: QtGui
: HEAD
: PC All
: P5 normal
Assigned To: renato filho
:
:
:
  Show dependency treegraph
 
Reported: 2011-04-18 06:59 EEST by Mailson Lira
Modified: 2011-04-29 18:08 EEST (History)
8 users (show)

See Also:


Attachments
Reproducing the bug (269 bytes, text/x-python)
2011-04-18 06:59 EEST, Mailson Lira
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mailson Lira 2011-04-18 06:59:00 EEST
Created attachment 311 [details]
Reproducing the bug

The function QtGui.QFileDialog.getSaveFileName(...) is supposed to return both
the filename chosen to save and the selected filter (as a tuple).
Unfortunately, if you try to run the attached example, you'll get the file name
but not the selected filter. The function actually returns all the filters, as
passed as the 4th argument ("Text files (*.txt);;Image files (*.png)")

I wrote a patch to fix this bug:
Edit the file PySide/QtGui/typesystem_gui_common.xml and find the line
containing
<modify-function signature="getSaveFileName ... >
It's inside the <object-type name="QFileDialog"> tag

Replace the following lines
<inject-code class="target" position="end">
  <insert-template name="return_for_QFileDialog"/>
</inject-code>

with the lines below

<inject-code class="target" position="beginning">
  QString _selectedFilter_;

  QString _fileName_ = %CPPSELF.%FUNCTION_NAME(%1, %2, %3, %4,
&amp;_selectedFilter_, %6);
  %PYARG_0 = Shiboken::makeTuple(_fileName_, _selectedFilter_);
</inject-code>

and the following lines
<modify-argument index="5">
  <remove-argument/>
</modify-argument>

with the lines below
<modify-argument index="5">
  <replace-type modified-type="QString"/>
</modify-argument>
Comment 1 Mailson Lira 2011-04-18 07:00:08 EEST
Note: I proposed to a PySide project on Google Summer of Code 2011 and found
this bug while trying to contribute with a bug fix to PySide project (as
required by the organization)

GSoC link_id: mailson
Comment 2 Hugo Parente Lima 2011-04-19 20:32:02 EEST
It's the same of bug 819. anyway thanks for report and provide a patch.

*** This bug has been marked as a duplicate of bug 819 ***
Comment 3 renato filho 2011-04-29 18:08:01 EEST
PySide release 1.0.2