[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] context menu for qtablewidget
From:       Andreas Pakulat <apaku () gmx ! de>
Date:       2006-11-15 9:35:04
Message-ID: 20061115093504.GB5443 () morpheus ! apaku ! dnsalias ! org
[Download RAW message or body]

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.

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic