[Qt-interest] QLabel disable right-click menu
qzvjtml02 at sneakemail.com
qzvjtml02 at sneakemail.com
Wed Jul 8 07:54:11 CEST 2009
Hello.
I am trying to create my own QLabel right-click menu by writing my
own mouseReleaseEvent(). However, it appears that QLabel already HAS a
right-click menu that comes up with mousePressEvent(). I would like to
disable this menu! I wrote the following function:
void MyClass::mousePressEvent(QMouseEvent * event)
{
if (event->button() == Qt::RightButton)
{
event->accept();
}
else
{
QLabel::mousePressEvent(event);
}
}
I thought the event->accept() would say "Okay, capture this keypress
and don't let it go further" thus inhibiting the right-click menu. No-
go, the right-click menu still comes up. Am I doing this incorrectly,
or completely missing where the right-click menu is coming from?
Thanks for any help!
Kyle Fazzari
More information about the Qt-interest-old
mailing list