From kde-core-devel Tue Dec 10 08:08:29 2002 From: Helge Deller Date: Tue, 10 Dec 2002 08:08:29 +0000 To: kde-core-devel Subject: Re: KLCDNumber X-MARC-Message: https://marc.info/?l=kde-core-devel&m=103950792708403 On Monday 09 December 2002 19:01, Jason Mott wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > Thanks everyone for the feedback on getting a CVS account. As soon as I see > a need for an account I will request one. > > I haven't seen any responses to the second subject in the email, and > figured perhaps it should have been its own email. Any comments on the > KLCDNumber class idea? Here is what I wrote about it: > > Now, here is one thing I'd like to add: A class that extends QLCDNumber > that is configurable the way that the DigitalClock Widget of the clock > applet is. Basically, I'd take the code in the DigitalClock Widget of the > clock applet and make it more general purpose and configurable through an > API. When done, the clock applet would be able to use the new class instead > of implementing the functionality itself (but that is really separate from > this > conversation). I'm doing this because of my program Kalculate > (http://sourceforge.net/projects/kalculate/). It uses the base QLCDNumber > for its display. As I was investigating how to add configurability to its > look and feel, I realized I was just redoing what the DigitalClock widget > was doing -- so it made since to see if it is something that should be > offered to core so we don't have many different iterations of this > functionality around. > > Here is the interface I'd imagine for such a widget (this is of course just > a rough sketch and is open to comments/suggestions). > > class KLCDNumber : public QLCDNumber { > Q_OBJECT > public: > KLCDNumber(QWidget *parent=0, const char *name=0); > ~KLCDNumber(); > > /** > * This method just calls the setPaletteBackgroundColor() method in > QWidget. > * I'm just showing it here to emphasize its availability. > */ > virtual void setPaletteBackgroundColor(const QColor & background); > > /** > * This method just calls the setPaletteBackgroundPixmap method in > QWidget. * I'm just showing it here to emphasize its availability. > */ > virtual void setPaletteBackgroundPixmap(const QPixmap & backgroundPix); > > /** > * This is reimplemented because we need to make note of the color in > order * to support the shadow. > */ > virtual void setPaletteForgroundColor(const QColor & forground); > > /** > * This is new but made virtual in case derivative classes want to make > use of it polymorphically. > */ > virtual void setPaletteShadowColor(const QColor & shadowColor); > > /** > * These two methods give control over the distance of the displayed > number and its shadow (and the angle of the shadow)... > * they are doubles because QPainter's translate method takes doubles. > */ > virtual void setForgroundOffset(double x, double y); > virtual void setShadowOffset(double x, double y); > > }; > > Is this something that would benefit the core ui library? Hi Jason, If this derived class would have some more features than just color/palette-additions, I think it might be more useful. One example of more functionality is described in Bug report #28412 (http://bugs.kde.org/show_bug.cgi?id=28412) - e.g. it would be useful if KLCDNumber would be able to show a small "am/pm" and a blinking dot on the left side. I know, that this feature might not be very useful in your Kalculate program, but it would at least help to make the clock look more like a real digital clock. Helge