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

List:       kde-panel-devel
Subject:    Re: How to determine whether a plasmoid has keyboard focus?
From:       Kun Zhang <arthur.kun () gmail ! com>
Date:       2011-02-19 5:50:02
Message-ID: AANLkTinnqrSM80GHXbQmopqgkB3BRdY_Ju5Tah37ukrD () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Sat, Feb 19, 2011 at 11:56 AM, Aaron J. Seigo <aseigo@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
> the
> 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@kde.org
> https://mail.kde.org/mailman/listinfo/plasma-devel
>
>
Thanks for your reply, but setFlag() doesn't make any change, and
webview->mainFrame()->hasFocus() always returns True.

-- 
Best wishes
ZHANG Kun

[Attachment #5 (text/html)]

<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>



_______________________________________________
Plasma-devel mailing list
Plasma-devel@kde.org
https://mail.kde.org/mailman/listinfo/plasma-devel


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

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