PySide also returns a list in the versions I am testing. In your version is it actually returning a QList? I wasn't aware that those were actually exposed to python bindings. Everything I have tried returns a python list. I will have to check my version of PySide in Maya 2014 when I get back to work.
On Wed, Jul 16, 2014 at 9:52 PM, Arjun Thekkummadathil <[email protected]> wrote: > I actually use PySide > > > On Wed, Jul 16, 2014 at 3:09 PM, Justin Israel <[email protected]> > wrote: > >> Are you using an old version of PyQt maybe? Because I am testing PyQt >> 4.8.6 in Maya 2013, using the default sip API v1, and >> QTreeWidget.selectedItems() returns a plain list of QTreeWidgetItems: >> >> from PyQt4 import QtCore, QtGui >> >> tree = QtGui.QTreeWidget() >> tree.setSelectionMode(t.ExtendedSelection) >> for i in xrange(5): >> item = QtGui.QTreeWidgetItem(["test"]) >> tree.addTopLevelItem(item) >> >> tree.show() >> # Selected 4 things in the tree >> result = tree.selectedItems()print type(result), len(result)# <type 'list'> 4 >> >> >> >> It returns exactly what the docs say: A list of QTreeWidgetItems >> >> >> >> >> On Wed, Jul 16, 2014 at 6:29 PM, Arjun Thekkummadathil <[email protected] >> > wrote: >> >>> yeah that's what even i thought but then it returns me a object and i >>> can loop through that, that object is not of a type list its some kind of >>> Qt object but luckily i can loop through that >>> for i in object: >>> print i.text(columnNumber) >>> >>> that gives me the values >>> >>> >>> On Wed, Jul 16, 2014 at 11:42 AM, Justin Israel <[email protected]> >>> wrote: >>> >>>> I'm not sure I follow. It should always be a list, with one or more >>>> items in it. So it technically always returns multiple items (0+) >>>> >>>> >>>> On Wed, Jul 16, 2014 at 5:50 PM, Arjun Thekkummadathil < >>>> [email protected]> wrote: >>>> >>>>> I figured it out i was using QTreeWidget.selectedItems() but then i >>>>> was expecting it to return multiple objects, it returns one object which >>>>> is >>>>> ideally a list >>>>> >>>>> >>>>> On Wed, Jul 16, 2014 at 10:53 AM, Justin Israel < >>>>> [email protected]> wrote: >>>>> >>>>>> What are you using now to get the selected items that isn't giving >>>>>> you the full selection? Is it QTreeWidget.selectedItems()? >>>>>> >>>>>> What is your QTreeWidget set to for its SelectionBehavior and >>>>>> SelectionMode? Does it already allow multi-row selection but is not >>>>>> returning multiple rows? >>>>>> >>>>>> >>>>>> On Wed, Jul 16, 2014 at 4:08 PM, Arjun Thekkummadathil < >>>>>> [email protected]> wrote: >>>>>> >>>>>>> Hi >>>>>>> Am writing a tool which has a QTreeWidget and i need to get the >>>>>>> selected items from the widget am only able to get one selection. >>>>>>> >>>>>>> How do i get multiple selected items >>>>>>> >>>>>>> -Arjun >>>>>>> >>>>>>> -- >>>>>>> You received this message because you are subscribed to the Google >>>>>>> Groups "Python Programming for Autodesk Maya" group. >>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>> send an email to [email protected]. >>>>>>> To view this discussion on the web visit >>>>>>> https://groups.google.com/d/msgid/python_inside_maya/CAJrOGy_vrEZgYkWvdaPeH2unpMSGnBu%3DrV0Z-NBFK26gdM8N8Q%40mail.gmail.com >>>>>>> <https://groups.google.com/d/msgid/python_inside_maya/CAJrOGy_vrEZgYkWvdaPeH2unpMSGnBu%3DrV0Z-NBFK26gdM8N8Q%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>>>> . >>>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>>> >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Python Programming for Autodesk Maya" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to [email protected]. >>>>>> To view this discussion on the web visit >>>>>> https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1FosqT88q6MXi5GFzZvMocKVtCHXF2h3B4V3MjNTqztg%40mail.gmail.com >>>>>> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1FosqT88q6MXi5GFzZvMocKVtCHXF2h3B4V3MjNTqztg%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> >>>>>> For more options, visit https://groups.google.com/d/optout. >>>>>> >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Python Programming for Autodesk Maya" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/python_inside_maya/CAJrOGy_%2BHQ_iTW2-Jt%3DyCxT24Wh-GkJs7gvUiOPsdG1PcJBfsQ%40mail.gmail.com >>>>> <https://groups.google.com/d/msgid/python_inside_maya/CAJrOGy_%2BHQ_iTW2-Jt%3DyCxT24Wh-GkJs7gvUiOPsdG1PcJBfsQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> >>>>> For more options, visit https://groups.google.com/d/optout. >>>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Python Programming for Autodesk Maya" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA23x1ejTk1_BgmHSLdE7XcWitmxrrpsgfnJyYwcdXA90g%40mail.gmail.com >>>> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA23x1ejTk1_BgmHSLdE7XcWitmxrrpsgfnJyYwcdXA90g%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Python Programming for Autodesk Maya" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/python_inside_maya/CAJrOGy-ES_o6AfkrWEvPnoGA85T5fTUjPiYLbb-dF6tO2bGdYg%40mail.gmail.com >>> <https://groups.google.com/d/msgid/python_inside_maya/CAJrOGy-ES_o6AfkrWEvPnoGA85T5fTUjPiYLbb-dF6tO2bGdYg%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Python Programming for Autodesk Maya" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0zvr8KFanu66Wn8_t0ZE%3DfqW-1fFESkmJJ38cGf80ewg%40mail.gmail.com >> <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0zvr8KFanu66Wn8_t0ZE%3DfqW-1fFESkmJJ38cGf80ewg%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/CAJrOGy-M8wz8m1-aNG-cqweo11S7hwneO9A8kO66YOnVKbj%3Dqw%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAJrOGy-M8wz8m1-aNG-cqweo11S7hwneO9A8kO66YOnVKbj%3Dqw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2uOizXHgBd7T%3Di5nNPejhotgrR63nkYwQRayyXz4_9Cg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
