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

List:       kde-pim
Subject:    Re: [Kde-pim] A fun (!) KPilot job
From:       "Aaron J. Seigo" <aseigo () olympusproject ! org>
Date:       2001-12-29 19:08:30
[Download RAW message or body]

On Sat, 29 Dec 2001, Adriaan de Groot wrote:

> Finally, a lil' job that's more interesting than search-and-replace. You
> know the KPilot splash screen? Right now it's gOT THe version number in
> it, (it says 4.3c if you have CVS HEAD). I strikes me that updating the
> picture regularly is a waste of bits on the CVS server. So, what I need is
> a snippet of code -- using QPainter and whatnot -- that paints the string
> KPILOT_VERSION (it's defined in kpilot/lib/options.h) in some suitable
> color in the QPixmap that is used for the splash. The code belongs in
> kpilot/kpilot/logWidget.cc, I'm sure.

something like this?

Index: logWidget.cc
===================================================================
RCS file: /home/kde/kdepim/kpilot/kpilot/logWidget.cc,v
retrieving revision 1.8
diff -u -3 -d -p -r1.8 logWidget.cc
--- logWidget.cc        2001/11/25 22:02:57     1.8
+++ logWidget.cc        2001/12/29 19:37:55
@@ -37,6 +37,7 @@ static const char *logw_id =
 #include <qtooltip.h>
 #include <qdatetime.h>
 #include <qlabel.h>
+#include <qpainter.h>
 #include <qpixmap.h>
 #include <qtimer.h>
 #include <qpushbutton.h>
@@ -113,9 +114,15 @@ LogWidget::LogWidget(QWidget * parent) :
                fLog->hide();
                fLabel->hide();
                fProgress->hide();
-
+
+                QPixmap splash(splashPath);
+                QPainter painter(&splash);
+                painter.setPen(QColor(0, 34, 255));
+                painter.drawText(splash.width() -  25 -
fontMetrics().width(KPILOT_VERSION),
+                                 splash.height() - 8 -
fontMetrics().height(),
+                                 KPILOT_VERSION);
                fSplash = new QLabel(this);
-               fSplash->setPixmap(QPixmap(splashPath));
+               fSplash->setPixmap(splash);
                QTimer::singleShot(3000,this,SLOT(hideSplash()));
                grid->addMultiCellWidget(fSplash,1,3,1,2);
        }




if you want it more generic (e.g. not hardcode the margins of 25 and 8,
allow the font and color to be set at run time, etc...) let me know 

--
Aaron J. Seigo


_______________________________________________
kde-pim mailing list
kde-pim@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-pim
kde-pim home page at http://pim.kde.org/
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic