开发者

How to enable context menu on a VerticalHeaderItem inside a QTableWidget?

I have QTable widget, where I set

setVerticalHeaderItem(0, QTableWidgetItem("some header", 0))

I set a contex menu by

setContextMenuPolicy(Qt.ActionsContextMenu)

and it works fine on my table's elements other than 1st column, i.e. a VerticalHeaderItem. Basically, when I right-click on 1st column item a context menu doesn't pop up, while clicking on any other elements >1st column causes the context menu to pop up (populated with the QActions I defined, not shown here for clarity).

Is there any attribute I should set in order to make 1st (VerticalHeaderItem) column react to right-click? Qt.ItemFlags maybe?开发者_如何转开发 If so, could anyone write a code snippet how to set it properly? Preferably in Python, but C++ would be also OK.

My conf: QT 4.5.2, PyQT 4.5.4, under Windows XP SP2.


The headers are widgets on their own. So, set the context menu policy on myTableWidget.verticalHeader().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜