[PyKDE] context menu for qtablewidget
Andreas Pakulat
apaku at gmx.de
Wed Nov 15 09:35:04 GMT 2006
On 15.11.06 09:35:22, hok kakada wrote:
> I tried to make context menu for QtableWidget in pyqt4, but I still cannot get
> thru. Does anybody have experience with qtableWidget.
sublcass QTableWidget and re-implement contextMenuEvent. You can fetch
the item via the itemAt() function using the event's position member.
> I'd also like to do something like move item up, move item down.
> It'd be easier if pyqt add them as its public functions.
Unless Qt implements such functions, PyQt won't do this. The reason is
that
a) PyQt is more or less generated from the Qt code
b) PyQt isn't supposed to add such functionality on top of Qt
However there's an easy way to do this, use the setItem function.
retrieve the item to move up and the one currently occupying the "new"
position, call setItem with proper row/col values on the tablewidget
with both items and you're done.
Andreas
--
You will outgrow your usefulness.
More information about the PyQt
mailing list