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

List:       pykde
Subject:    [PyQt] Contextmenu in a QTreeWidget
From:       "Jake Richards" <blaven () gmail ! com>
Date:       2007-11-27 14:53:13
Message-ID: 8467e2d90711270653x7d46d954gb65537026e9a95db () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Is there a better way of creating a contextMenu (a small menu when you right
click) inside a QTreeWidget
than setting the setContextMenuPolicy?  This is what I currently do:

self.treeView = QTreeWidget()
self.treeView.setContextMenuPolicy(Qt.CustomContextMenu)
self.connect(self.treeView,SIGNAL('customContextMenuRequested(QPoint)'),
self.newContext)

But, the problem I'm having is that the right click to bring up the menu,
also changes the selection.
How can I tell the tree to ignore right clicks but still bring up the
contextmenu?  Oh, and as a side
question.  How can I get a list of the QTreeWidgetItems that make up the
tree?  I saw items() but I
didn't quite understand how to set the QMimeData type (I'm sorry, I'm a bit
new to QT :( )  Thank you!

B

[Attachment #5 (text/html)]

Is there a better way of creating a contextMenu (a small menu when you right click) \
inside a QTreeWidget<br>than setting the setContextMenuPolicy?&nbsp; This is what I \
currently do:<br><br>self.treeView = \
QTreeWidget()<br>self.treeView.setContextMenuPolicy \
(Qt.CustomContextMenu)<br>self.connect(self.treeView,SIGNAL(&#39;customContextMenuRequested(QPoint)&#39;),self.newContext)<br><br>But, \
the problem I&#39;m having is that the right click to bring up the menu, also changes \
the selection. <br>How can I tell the tree to ignore right clicks but still bring up \
the contextmenu?&nbsp; Oh, and as a side<br>question.&nbsp; How can I get a list of \
the QTreeWidgetItems that make up the tree?&nbsp; I saw items() but I<br>didn&#39;t \
quite understand how to set the QMimeData type (I&#39;m sorry, I&#39;m a bit new to \
QT :( )&nbsp; Thank you! <br><br>B<br>



_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

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

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