Ask Your Question
1

python_qt_binding and QStringList,QStringListModel missing

asked 2013-10-02 19:27:48 -0600

pgebhard gravatar image

updated 2014-01-28 17:18:07 -0600

ngrennan gravatar image

I recently incorporated an Rviz widget into my custom GUI, and the Rviz Python bindings require the use of 'python_qt_binding' (I used to just directly import PyQt4). Unfortunately, this is causing some problems in the rest of my code. When using from python_qt_binding.QtCore import *, I am now getting a NameError when attempting to create QStringList or QStringListModel objects (NameError: global name 'QStringList' is not defined).

Am I doing something wrong, or am I expected to work around this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-10-03 13:05:36 -0600

Dirk Thomas gravatar image

updated 2013-10-03 13:06:37 -0600

I guess python_qt_binding is not handling these types very well since they are treated special in the bindings. I am not sure if that is easily fixable in python_qt_binding but I have filled a ticket for that: https://github.com/ros-visualization/python_qt_binding/issues/8

For your specific case I would suggest to just use plain Python strings and Python lists of strings. That should work seemless with the QStringListModel API. And in Python 3.x the types QString / QStringList will go away anyway. So it would make your code also more future proof.

edit flag offensive delete link more

Comments

python_qt_binding uses PyQt4 with SIP API version 2. And for that there are no QString / QStringList types defines anymore. Please see http://qt-project.org/wiki/Differences_Between_PySide_and_PyQt#b7669e9ad9355d8b4e8fdccade317b2b for more information.

Dirk Thomas gravatar imageDirk Thomas ( 2013-10-04 15:50:41 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-10-02 19:27:48 -0600

Seen: 1,254 times

Last updated: Oct 03 '13