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

List:       kde-devel
Subject:    Re: Flickering problem in kicker (trunk)
From:       "=?UTF-8?Q?Rafael_Fern=C3=A1ndez_L=C3=B3pez?=" <ereslibre () gmail ! com>
Date:       2006-10-15 11:40:43
Message-ID: 93f85fee0610150440q19c85771r7bbc45f5e2581f04 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]

[Attachment #4 (text/plain)]

Hi !!

2006/10/15, Aaron J. Seigo <aseigo@kde.org>:
>
> On Saturday 14 October 2006 21:43, Rafael Fernández López wrote:
> > ( * ) In AppletWidget constructor, the call setSelected(m_selected); is
> not
> > necessary, since until now, m_selected will be initialized always to
> false.
> > setSelected is not a very fast call, and we should avoid it when
> possible,
> > for no flickering.
>
> this sets the odd/even colouring properly. and i'm really not sure it is
> such
> a slow call at all. have you benchmarked it?


I haven't  benchmarked it. How can I benchmark it ?

> ( * )  KIconLoader * ldr = KGlobal::iconLoader();
> >        QPixmap icon = ldr->loadIcon(info.icon(), K3Icon::Panel,
> > K3Icon::SizeLarge);
> >
> >        can be done in one step:
> >
> >        QPixmap icon = KGlobal::iconLoader()->loadIcon( info.icon(),
> > K3Icon::Panel, K3Icon::SizeLarge);
>
> this should make no practical difference in running time. putting code on
> one
> line does not magically make it faster ;)


Well, not in time to the user, but if we can avoid innecesary assignments we
should, that's clock time to the computer, and the machine needs that time
for assignments (I know, is a pointer, but it is an assignment...)

> ( * ) Here you're losing too many time:
> >
> >        if ((*it).isHidden() || (*it).name().isEmpty() ||
> >            ((*it).isUniqueApplet() &&
> >             PluginManager::self()->hasInstance(*it)))
> >
> >        I consider is faster only de-referencing "it" one time, and then
> use
> > that object instead of de-referencing lots of times as is done right
> now.
>
> you could, sure. but again, have you done any benchmarking of this or is
> it an
> educated guess on your part that this would help?


I haven't done a benchmark, but dereferencing one time is faster than
dereferencing 5 times, I think it is obvious. But anyway I'd like to know
how to benchmark ;)

i don't really have any issue with this particular change in the patch
> (though
> i wonder if it makes any real time difference) aside from the name. cpIt?
> let's name it something readable link "appletInfo" perhaps.
>
> > ( * ) Mainly, play with show() and hide() methods from m_appletBox, when
> > populating applets, and when searching. As no redrawing is necessary, it
> > will add widgets really faster, and when finished, the resulting widget
> > with all applets will be showed.
>
> ugh. so the widget hides and the shows again? that sounds really ugly. is
> it
> enough to simply call updatesEnabled(false) and then updatesEnabled(true)?
> i'm busy packing for a flight so i'd rather not get into testing things
> atm.


Really ugly, but I didn't find any better since QT has a bug at this point.
Try to add 400 elements to the list and search for bookmark, just go
deleting char by char from the last char to the first. I think for the
moment is better the widget to hide and show than that effect that makes the
user wait (in my computer) 10 seconds.

> ( * ) There is a strange issue too... add those 20 * 20 items for example.
> > No no-odd, odd difference is visible (blue, white or something), I see
> all
> > background white. Scroll it very fast and you will see that it seems
> that
> > there is odd, no-odd difference (blue, white in my case).
>
> well, you removed the call to setSelected(m_selected) in the ctor so it's
> not
> surprising the odd/even colouring is broken.


In the constructor I can read the following:

AppletWidget::AppletWidget(const AppletInfo& info, bool odd, QWidget
*parent)
    : AppletItem(parent),
      m_appletInfo(info),
      m_odd(odd),
      m_selected(false)
{
    setFocusPolicy(Qt::StrongFocus);
    setSelected(m_selected);

    itemTitle->setText("<h3>" + info.name() + "</h3>");
    itemTitle->installEventFilter(this);

    if (info.comment() != info.name())
    {
        itemDescription->setText(info.comment());
    }

    itemDescription->installEventFilter(this);

    QPixmap icon = KGlobal::iconLoader()->loadIcon(info.icon(),
K3Icon::Panel, K3Icon::SizeLarge);
    itemPixmap->setPixmap(icon);
    itemPixmap->installEventFilter(this);
}

So my comment doesn't hurt at all:

AppletWidget::AppletWidget(const AppletInfo& info, bool odd, QWidget
*parent)
    : AppletItem(parent),
      m_appletInfo(info),
      m_odd(odd),
      m_selected(false)
{
    setFocusPolicy(Qt::StrongFocus);
    setSelected(m_selected);

    itemTitle->setText("<h3>" + info.name() + "</h3>");
    itemTitle->installEventFilter(this);

    if (info.comment() != info.name())
    {
        itemDescription->setText(info.comment());
    }

    itemDescription->installEventFilter(this);

    QPixmap icon = KGlobal::iconLoader()->loadIcon(info.icon(),
K3Icon::Panel, K3Icon::SizeLarge);
    itemPixmap->setPixmap(icon);
    itemPixmap->installEventFilter(this);
}

and I'm not talking about if it is broken, I'm talking about another really
strange issue. If you see them you will see a plain white background, but if
you scroll the scrollbar really fast, you will notice that some of them have
blue background and others white background... I can't understand why.

Bye,
Rafael Fernández López.

[Attachment #5 (text/html)]

Hi !!<br><br>2006/10/15, Aaron J. Seigo &lt;<a \
href="mailto:aseigo@kde.org">aseigo@kde.org</a>&gt;:<div><span \
class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px \
solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> On Saturday \
14 October 2006 21:43, Rafael Fernández López wrote:<br>&gt; ( * ) In AppletWidget \
constructor, the call setSelected(m_selected); is not<br>&gt; necessary, since until \
now, m_selected will be initialized always to false. <br>&gt; setSelected is not a \
very fast call, and we should avoid it when possible,<br>&gt; for no \
flickering.<br><br>this sets the odd/even colouring properly. and i'm really not sure \
it is such<br>a slow call at all. have you benchmarked it? </blockquote><div><br>I \
haven't&nbsp; benchmarked it. How can I benchmark it ?<br></div><br><blockquote \
class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt \
0pt 0.8ex; padding-left: 1ex;">&gt; ( * )&nbsp;&nbsp;KIconLoader * ldr = \
KGlobal::iconLoader(); \
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;QPixmap icon = \
ldr-&gt;loadIcon(info.icon(), K3Icon::Panel,<br>&gt; \
K3Icon::SizeLarge);<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;can \
be done in one step:<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;QPixmap \
icon = KGlobal::iconLoader()-&gt;loadIcon(  info.icon(),<br>&gt; K3Icon::Panel, \
K3Icon::SizeLarge);<br><br>this should make no practical difference in running time. \
putting code on one<br>line does not magically make it faster \
;)</blockquote><div><br>Well, not in time to the user, but if we can avoid innecesary \
assignments we should, that's clock time to the computer, and the machine needs that \
time for assignments (I know, is a pointer, but it is an assignment...) \
<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, \
204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">&gt; ( * ) Here you're \
losing too many time:<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if \
((*it).isHidden() || (*it).name().isEmpty() || \
<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;((*it).isUniqueApplet() \
&amp;&amp;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
PluginManager::self()-&gt;hasInstance(*it)))<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;I \
consider is faster only de-referencing &quot;it&quot; one time, and then use <br>&gt; \
that object instead of de-referencing lots of times as is done right now.<br><br>you \
could, sure. but again, have you done any benchmarking of this or is it \
an<br>educated guess on your part that this would help? </blockquote><div><br>I \
haven't done a benchmark, but dereferencing one time is faster than dereferencing 5 \
times, I think it is obvious. But anyway I'd like to know how to benchmark \
;)<br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid \
rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> i don't really \
have any issue with this particular change in the patch (though<br>i wonder if it \
makes any real time difference) aside from the name. cpIt?<br>let's name it something \
readable link &quot;appletInfo&quot; perhaps. <br><br>&gt; ( * ) Mainly, play with \
show() and hide() methods from m_appletBox, when<br>&gt; populating applets, and when \
searching. As no redrawing is necessary, it<br>&gt; will add widgets really faster, \
and when finished, the resulting widget <br>&gt; with all applets will be \
showed.<br><br>ugh. so the widget hides and the shows again? that sounds really ugly. \
is it<br>enough to simply call updatesEnabled(false) and then \
updatesEnabled(true)?<br>i'm busy packing for a flight so i'd rather not get into \
testing things atm. </blockquote><div><br>Really ugly, but I didn't find any better \
since QT has a bug at this point. Try to add 400 elements to the list and search for \
bookmark, just go deleting char by char from the last char to the first. I think for \
the moment is better the widget to hide and show than that effect that makes the user \
wait (in my computer) 10 seconds. <br></div><br><blockquote class="gmail_quote" \
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; \
padding-left: 1ex;">&gt; ( * ) There is a strange issue too... add those 20 * 20 \
items for example. <br>&gt; No no-odd, odd difference is visible (blue, white or \
something), I see all<br>&gt; background white. Scroll it very fast and you will see \
that it seems that<br>&gt; there is odd, no-odd difference (blue, white in my case). \
<br><br>well, you removed the call to setSelected(m_selected) in the ctor so it's \
not<br>surprising the odd/even colouring is broken.</blockquote><div><br>In the \
constructor I can read the following:<br><br>AppletWidget::AppletWidget(const \
AppletInfo&amp; info, bool odd, QWidget *parent) <br>&nbsp;&nbsp;&nbsp; : \
AppletItem(parent),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
m_appletInfo(info),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
m_odd(odd),<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
m_selected(false)<br>{<br>&nbsp;&nbsp;&nbsp; \
setFocusPolicy(Qt::StrongFocus);<br>&nbsp;&nbsp;&nbsp; \
setSelected(m_selected);<br><br>&nbsp;&nbsp;&nbsp; \
itemTitle-&gt;setText(&quot;&lt;h3&gt;&quot; +  info.name() + \
&quot;&lt;/h3&gt;&quot;);<br>&nbsp;&nbsp;&nbsp; \
itemTitle-&gt;installEventFilter(this);<br><br>&nbsp;&nbsp;&nbsp; if (info.comment() \
!= info.name())<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
itemDescription-&gt;setText(info.comment());<br>&nbsp;&nbsp;&nbsp; \
}<br><br>&nbsp;&nbsp;&nbsp; itemDescription-&gt;installEventFilter(this); \
<br><br>&nbsp;&nbsp;&nbsp; QPixmap icon = \
KGlobal::iconLoader()-&gt;loadIcon(info.icon(), K3Icon::Panel, \
K3Icon::SizeLarge);<br>&nbsp;&nbsp;&nbsp; \
itemPixmap-&gt;setPixmap(icon);<br>&nbsp;&nbsp;&nbsp; \
itemPixmap-&gt;installEventFilter(this);<br>} <br><br>So my comment doesn't hurt at \
all: <br><br>AppletWidget::AppletWidget(const AppletInfo&amp; info, bool odd, QWidget \
*parent)<br> &nbsp;&nbsp;&nbsp; : AppletItem(parent),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_appletInfo(info),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_odd(odd),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; m_selected(false)<br>
{<br>
&nbsp;&nbsp;&nbsp; setFocusPolicy(Qt::StrongFocus);<br>
&nbsp;&nbsp;&nbsp; setSelected(m_selected);<br>
<br>
&nbsp;&nbsp;&nbsp; itemTitle-&gt;setText(&quot;&lt;h3&gt;&quot; + info.name() + \
&quot;&lt;/h3&gt;&quot;);<br> &nbsp;&nbsp;&nbsp; \
itemTitle-&gt;installEventFilter(this);<br> <br>
&nbsp;&nbsp;&nbsp; if (info.comment() != info.name())<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
itemDescription-&gt;setText(info.comment());<br> &nbsp;&nbsp;&nbsp; }<br>
<br>
&nbsp;&nbsp;&nbsp; itemDescription-&gt;installEventFilter(this);<br>
<br>
&nbsp;&nbsp;&nbsp; QPixmap icon = KGlobal::iconLoader()-&gt;loadIcon(info.icon(), \
K3Icon::Panel, K3Icon::SizeLarge);<br> &nbsp;&nbsp;&nbsp; \
itemPixmap-&gt;setPixmap(icon);<br> &nbsp;&nbsp;&nbsp; \
itemPixmap-&gt;installEventFilter(this);<br> } <br><br>and I'm not talking about if \
it is broken, I'm talking about another really strange issue. If you see them you \
will see a plain white background, but if you scroll the scrollbar really fast, you \
will notice that some of them have blue background and others white background... I \
can't understand why. <br><br>Bye,<br>Rafael Fernández López.<br></div></div><br>



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