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

List:       kde-panel-devel
Subject:    Re: Creating a rectangular icon
From:       Antony Loebs <barefootedjournalist () gmail ! com>
Date:       2010-03-03 22:05:36
Message-ID: 469a3d631003031405i6a007fd2u7daa1c61a44eaabc () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


On Tue, Mar 2, 2010 at 9:09 PM, Aaron J. Seigo <aseigo@kde.org> wrote:

> On March 2, 2010, Antony Loebs wrote:
> > Ok, when I added
> > self.layout.setPreferredWidth(120)
> > that displays it correctly, but now it doesn't expand or contract at all
> > horizontally. It does expand and contract vertically, however. What
> should
> > I add so that the height and the width of the image scale relative to
> each
> > other?
>
> in theory, KeepAspectRatio, but in practice that's not paid attention to by
> the panel. you'll need to keep the pixmap in ratio in your paint event.
>

Hmm...I added the following
def paintEvent(self, event):
    size = self.geometry()
    height = size.height()
    self.resize(height * 4, height)

But that doesn't work. Do I need to completely re-implement drawing the
pixmap in paintEvent?

[Attachment #5 (text/html)]

On Tue, Mar 2, 2010 at 9:09 PM, Aaron J. Seigo <span dir="ltr">&lt;<a \
href="mailto:aseigo@kde.org">aseigo@kde.org</a>&gt;</span> wrote:<br><div \
class="gmail_quote"><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 \
March 2, 2010, Antony Loebs wrote:<br>

&gt; Ok, when I added<br>
&gt; self.layout.setPreferredWidth(120)<br>
&gt; that displays it correctly, but now it doesn&#39;t expand or contract at all<br>
&gt; horizontally. It does expand and contract vertically, however. What should<br>
&gt; I add so that the height and the width of the image scale relative to each<br>
&gt; other?<br>
<br>
</div>in theory, KeepAspectRatio, but in practice that&#39;s not paid attention to \
by<br> the panel. you&#39;ll need to keep the pixmap in ratio in your paint \
event.<br></blockquote></div><br>Hmm...I added the following <br>def paintEvent(self, \
event):<br>    size = self.geometry()<br>    height = size.height()<br>  \
self.resize(height * 4, height)<br><br>But that doesn&#39;t work. Do I need to \
completely re-implement drawing the pixmap in paintEvent? <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