[PyQt] Convert string to QString
Vincent Vande Vyvre
vincent.vandevyvre at swing.be
Mon Sep 3 08:19:40 BST 2012
On 03/09/12 05:36, Python.py wrote:
> I'm trying to play a video. But for that I need to choose the video. For
> this, if I use QtGui.QFileDialog.getOpenFileName () I can select a video and
> executar.O my problem is that I do not want to use the
> QtGui.QFileDialog.getOpenFileName (), I already researching where the video
> using the code. Making the code I find the video (the video path), but he is
> in the format string. However, I need the data type is QString instead of
> String. Discover which must make this change, because I'm running video on a
> QWidget.
>
> Now I make myself clear?
>
Not really, why can't you construct a QString from a string ?
Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4 import QtCore
>>> mystring = '~/videos/foo.mp4'
>>> path = QtCore.QString(mystring)
>>> path
PyQt4.QtCore.QString(u'~/videos/foo.mp4')
If this is not the answer of your question, please show the part of your
code that demonstrate the problem.
--
Vincent V.V.
Oqapy <https://launchpad.net/oqapy> . Qarte
<https://launchpad.net/qarte> . PaQager <https://launchpad.net/paqager>
More information about the PyQt
mailing list