[pyqt] How to copy the content of a QPopupMenu ?
Diez B. Roggisch
deets at nospam.web.de
Wed Apr 5 08:36:40 EDT 2006
kobayashi at netcourrier.com wrote:
> Dear all,
>
> For a particuliar case, I need to copy all the items of
> an existing menu (including the separators and sub-menus)
> in a new empty one ... Does someone knows how to do that ?
> I've tried :
> item = menu_orig.findItem(item_id)
> menu_new.insertItem(item, item_id)
> but it fails with :
> TypeError: argument 1 of QMenuData.insertItem() has an invalid type
>From the docs:
"""
QMenuItem * QMenuData::findItem ( int id ) const
Returns the menu item with identifier id, or 0 if there is no item with this
identifier.
Note that QMenuItem is an internal class, and that you should not need to
call this function. Use the higher level functions like text(), pixmap()
and changeItem() to get and modify menu item attributes instead.
See also indexOf().
"""
Diez
More information about the Python-list
mailing list