<div class="gmail_quote">On Sat, Feb 19, 2011 at 11:56 AM, Aaron J. Seigo <span dir="ltr"><<a href="mailto:aseigo@kde.org">aseigo@kde.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<div class="im">On Friday, February 18, 2011, Kun Zhang wrote:<br>
> I'm writing a plasmoid in Python with a WebView. The WebView will reload<br>
> the page automatically by a QTimer. But I don't want it to reload itself<br>
> when I'm viewing or typing in the plasmoid, because it will be very<br>
> annoying. So I have to know whether the plasmoid has keyboard focus.<br>
><br>
> I tried hasFocus() of both Applet and WebView, but they always return<br>
> False. I also tried to override focusInEvent(), but it's never triggered.<br>
<br>
</div>two things you could try:<br>
<br>
* calling setFlag(QGraphicsItem::ItemIsFocusable, true) on the applet or the<br>
webview .. this still may not work (haven't tried) as the webview itself<br>
likely has the focus<br>
<br>
* call webview->mainFrame()->hasFocus() to see when it has focus.<br>
<font color="#888888"><br>
--<br>
Aaron J. Seigo<br>
humru othro a kohnu se<br>
GPG Fingerprint: 8B8B 2209 0C6F 7C47 B1EA EE75 D6B7 2EB1 A7F1 DB43<br>
<br>
KDE core developer sponsored by Qt Development Frameworks<br>
</font><br>_______________________________________________<br>
Plasma-devel mailing list<br>
<a href="mailto:Plasma-devel@kde.org">Plasma-devel@kde.org</a><br>
<a href="https://mail.kde.org/mailman/listinfo/plasma-devel" target="_blank">https://mail.kde.org/mailman/listinfo/plasma-devel</a><br>
<br></blockquote></div><br>Thanks for your reply, but setFlag() doesn't make any change, and webview->mainFrame()->hasFocus() always returns True.<br clear="all"><br>-- <br>Best wishes<br>ZHANG Kun<br>