KLCDNumber

Jason Mott kdedevel at jasonmott.com
Mon Dec 9 18:01:33 GMT 2002


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

- --Jason..JJ
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE99NqEgxGG3K38H6sRAnc5AJ43TBvHvgTKSVxKWKo3O5NpQzGI8gCeLo/p
A5H3ucweyhoKDHbPdx30R9A=
=Mw3l
-----END PGP SIGNATURE-----





More information about the kde-core-devel mailing list