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

List:       kde-devel
Subject:    Re: KAction (and its shortcut configuration) on multiple widgets of
From:       Thomas =?UTF-8?B?TMO8Ymtpbmc=?= <thomas.luebking () gmail ! com>
Date:       2011-10-18 10:17:06
Message-ID: 20111018121706.62b87118 () gmail ! com
[Download RAW message or body]

Am Tue, 18 Oct 2011 15:20:50 +0530
schrieb Yogesh Marwaha <yogeshm.007@gmail.com>:

> Hi,
> 
> I'm still waiting for more suggestions :-)
Assuming you want _ONE_ shortcut[1] in every case (eg. F3 cuts in
editor1 if that has the focus, editor2 if that has the focus and editor
three resp.), add the shortcut to the parenting window, bind it's
action to a wrapper slot which triggers the shortcut on the widget
which has the focus.


If the focuswidget / type is undetectable so you cannot eg.
if ( QApplication::focusWidget() == m_editor1 )
   m_editor1->cut();

or
if ( MyTextEditor* editor =
qobject_cast<MyTextEditor*>(QApplication::focusWidget()) )
   editor1->cut();

you can still 
QMetaObject::invokeMethod( QApplication::focusWidget(), "cut",
Qt::DirectConnection);

if you've
public slots:
   void cut();

[1] Otherwise just add all actions (for each editor and with different
names)

Cheers,
Thomas

>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

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

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