Display applet context menu when the label hasn't any context menu to show. It makes sense to show a context menu only when the text can be selected or when there is a link.
reviewboard: http://reviewboard.kde.org/r/6009/ svn path=/trunk/KDE/kdelibs/; revision=1202176
This commit is contained in:
parent
28e6398a6a
commit
d8546805e5
@ -231,9 +231,13 @@ void Label::dataUpdated(const QString &sourceName, const Plasma::DataEngine::Dat
|
||||
|
||||
void Label::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
|
||||
{
|
||||
QContextMenuEvent contextMenuEvent(QContextMenuEvent::Reason(event->reason()),
|
||||
event->pos().toPoint(), event->screenPos(), event->modifiers());
|
||||
QApplication::sendEvent(nativeWidget(), &contextMenuEvent);
|
||||
if (d->textSelectable || nativeWidget()->text().contains("<a ", Qt::CaseInsensitive)){
|
||||
QContextMenuEvent contextMenuEvent(QContextMenuEvent::Reason(event->reason()),
|
||||
event->pos().toPoint(), event->screenPos(), event->modifiers());
|
||||
QApplication::sendEvent(nativeWidget(), &contextMenuEvent);
|
||||
}else{
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
void Label::resizeEvent(QGraphicsSceneResizeEvent *event)
|
||||
|
Loading…
Reference in New Issue
Block a user