<div class="gmail_quote">On Sat, Feb 19, 2011 at 11:56 AM, Aaron J. Seigo <span dir="ltr">&lt;<a href="mailto:aseigo@kde.org">aseigo@kde.org</a>&gt;</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>
&gt; I&#39;m writing a plasmoid in Python with a WebView. The WebView will reload<br>
&gt; the page automatically by a QTimer. But I don&#39;t want it to reload itself<br>
&gt; when I&#39;m viewing or typing in the plasmoid, because it will be very<br>
&gt; annoying. So I have to know whether the plasmoid has keyboard focus.<br>
&gt;<br>
&gt; I tried hasFocus() of both Applet and WebView, but they always return<br>
&gt; False. I also tried to override focusInEvent(), but it&#39;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&#39;t tried) as the webview itself<br>
likely has the focus<br>
<br>
* call webview-&gt;mainFrame()-&gt;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&#39;t make any change, and webview-&gt;mainFrame()-&gt;hasFocus() always returns True.<br clear="all"><br>-- <br>Best wishes<br>ZHANG Kun<br>