Here is an example with a few of the many ways this could be solved:
https://gist.github.com/justinfx/134992bd323c76d55af2c1b2750ebd84

In the MyListWidget example, it is implementing the edit() hook to capture
when an item edit operation is starting, so that we can remember the
current value before it changes.
Then when the itemChanged signal fires, we can handle the slot and compare
the previous value to the current one and choose to call rename()

The MyListWidget2 example is almost the same, but instead of implementing
edit(), it uses the doubleClicked signal to track the current text value
before it changes. I think I like the previous approach better because it
gives you more specific control over when the edit operation is actually
starting. You can even check the specific edit trigger type if you wanted.

Justin


On Fri, Apr 21, 2023 at 7:08 AM Lien <yien...@gmail.com> wrote:

> Hi
>
> I am trying to make a QListWidget items window and want to connect the
> cmds.rename() to take whatever user edit the new item name with double
> click.
>
> I am currently connect things up like:
> geo_list_wdt = QtWidgets.QListWidget()
> geo_list_wdt.itemDoubleClicked.connect(self.rename_item)
>
> Is there a way I can query the name that user input/edit and connect up
> with the rename cmd  (cmds.rename(currentItem_name, user_input)) ?
>
> Thank you,
>
>
>
>
>
> --
> 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 python_inside_maya+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/26a95e4c-ee05-4bac-afb1-98608492235cn%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/26a95e4c-ee05-4bac-afb1-98608492235cn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA2qktCsoTOKF5sENzxAFAvOth1KJRCA0pQfRvDxxbrADw%40mail.gmail.com.

Reply via email to