Creating a rectangular icon

Aaron J. Seigo aseigo at kde.org
Wed Mar 3 03:09:09 CET 2010


On March 2, 2010, Antony Loebs wrote:
> On Fri, Feb 26, 2010 at 6:57 PM, Aaron J. Seigo <aseigo at kde.org> wrote:
> > On February 26, 2010, Antony Loebs wrote:
> > > Two problems: one, I don't see how to make a click on a label register,
> > > and two, while it looks fine on the desktop, if it is started in the
> > 
> > panel
> > 
> > > it is squashed horizontally (so the image looks like a vertical line
> > 
> > about
> > 
> > > four or five pixels wide). Additionally, when I rescale the panel, the
> > > image scales vertically, but not horizontally.
> > 
> > sounds like a layouting issue; you probably need to set a preferred
> > and/or minimum size in your widget.
> > 
> > remember that panels can be very small, however. it's never fun when a
> > widget
> > enforces a minimum size that's overly large. :)
> > 
> >  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.

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


More information about the Plasma-devel mailing list