How to determine whether a plasmoid has keyboard focus?
arthur.kun at gmail.com
Sat Feb 19 06:50:02 CET 2011
On Sat, Feb 19, 2011 at 11:56 AM, Aaron J. Seigo <aseigo at kde.org> wrote:
> On Friday, February 18, 2011, Kun Zhang wrote:
> > I'm writing a plasmoid in Python with a WebView. The WebView will reload
> > the page automatically by a QTimer. But I don't want it to reload itself
> > when I'm viewing or typing in the plasmoid, because it will be very
> > annoying. So I have to know whether the plasmoid has keyboard focus.
> > I tried hasFocus() of both Applet and WebView, but they always return
> > False. I also tried to override focusInEvent(), but it's never triggered.
> two things you could try:
> * calling setFlag(QGraphicsItem::ItemIsFocusable, true) on the applet or
> webview .. this still may not work (haven't tried) as the webview itself
> likely has the focus
> * call webview->mainFrame()->hasFocus() to see when it has focus.
> Aaron J. Seigo
> humru othro a kohnu se
> GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43
> KDE core developer sponsored by Qt Development Frameworks
> Plasma-devel mailing list
> Plasma-devel at kde.org
Thanks for your reply, but setFlag() doesn't make any change, and
webview->mainFrame()->hasFocus() always returns True.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Plasma-devel