Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 5

Qt-interest Archive, April 2007
QTreeWidget (qt4.3) and right click on items?


Message 1 in thread

I want to capture right click on items in QTreeWidget (to open a popup
menu). However, the signal does not send any information about button
used to do the click:
void QTreeWidget::itemClicked ( QTreeWidgetItem * item, int column )   [signal]

The clicked(...) slot in QAbstractItemView have no button distinction too.

I know  I can subclass QTreeWidget and reimplement  mousePressEvent,
but that may  be a bit more cumbersome and not very elegant (one
"almost empty" class just to get right clicks).

IMHO that signal is pretty much useless if you don't know the button
that is used to click (left? right?).

Or did I miss something?

Also, as the popup menu may be also invoked by that key next to the
windows logo key, it may be nice to add some signal like
popupMenuInvoked(item, column) - i found nothing like that in docs
either

Martin Petricek

--
 [ signature omitted ] 

Message 2 in thread

Take a look at QWidget::setContextMenuPolicy() and
QWidget::contextMenuEvent().


On 04-16-2007 9:54 PM, "BH" wrote:

> I want to capture right click on items in QTreeWidget (to open a popup
> menu). However, the signal does not send any information about button
> used to do the click:
> void QTreeWidget::itemClicked ( QTreeWidgetItem * item, int column )
> [signal]
> 
> The clicked(...) slot in QAbstractItemView have no button distinction too.
> 
> I know  I can subclass QTreeWidget and reimplement  mousePressEvent,
> but that may  be a bit more cumbersome and not very elegant (one
> "almost empty" class just to get right clicks).
> 
> IMHO that signal is pretty much useless if you don't know the button
> that is used to click (left? right?).
> 
> Or did I miss something?
> 
> Also, as the popup menu may be also invoked by that key next to the
> windows logo key, it may be nice to add some signal like
> popupMenuInvoked(item, column) - i found nothing like that in docs
> either
> 
> Martin Petricek
> 
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
> 

Keith Esau
Senior Software Engineer (dpSHEET)
PDF Solutions, Inc.
keith.esau@xxxxxxx
913-599-6537 (work/home)
913-515-2135 (mobile)
kaesau@xxxxxxxxxxxxx (home/personal)
  
===========================================================================
CONFIDENTIALITY NOTICE: This email contains information that may be
confidential and privileged. Unless you are the intended recipient (or
authorized to receive for the intended recipient), you are prohibited from
reviewing, using, copying, forwarding, keeping, or disclosing to anyone
other than PDF Solutions, Inc. this email or any information in the email
(including any attachment). If you have received this email in error,
please send a reply email only to the sender <keith.esau@xxxxxxx> (delete
the original message body from the reply), and please delete this message
from your system. My apologies for the inconvenience, and thank you in
advance for your cooperation.
===========================================================================


--
 [ signature omitted ]