Getting copy (CTRL + C) to work in abstractnavigationwidget (context browser tooltips)

Milian Wolff mail at
Thu Sep 23 19:52:49 UTC 2010


me again... I'm desperately trying to get copy to work in 
AbstractNavigationWidgets's. I can't get it to work, no matter what approach I 

I tried the obvious:

m_browser->addAction( KStandardActions::copy(m_browser) );

I tried the less obvious:

class Browser : public KTextBrowser {

  explicit Browser( QWidget* parent = 0, bool notifyClick = false )
    : KTextBrowser(parent, notifyClick)
  virtual void keyPressEvent( QKeyEvent* event )
    qDebug() << "browser key press event:" << event->key() << event-
    if (event->key() == Qt::Key_C && event->modifiers() == Qt::ControlModifier) 
      qDebug() << "copy yeah yeah yeah" << textCursor().selectedText();

m_browser = new Browser;

I even tried an eventFilter or put the stuff into AbstractNavigationWidget's 
keyPress overload - all to no avail... No I have to forfeit and ask for your 

What I noticed is that the tooltip closes when I release *any* key, e.g.: Make 
a tooltip showup, press and release just a modifier key like CTRL => tooltip is 
hidden. May that be the reason (where is that eventFilter to do the hide in 
this case btw?)? But shouldn't keyPress(QKeyEvent* e) be called *before* the 
key release? Why don't I even get this?


Milian Wolff
mail at
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <>

More information about the KDevelop-devel mailing list