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

List:       kde-commits
Subject:    KDE/kdegraphics/kolourpaint/widgets/toolbars/options
From:       Clarence Dang <dang () kde ! org>
Date:       2007-10-13 12:36:06
Message-ID: 1192278966.003301.31202.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 724783 by dang:

Fix line width previews being 1 pixel wider and higher than they should be.  Also, simplify the code.


 M  +8 -15     kpToolWidgetLineWidth.cpp  


--- trunk/KDE/kdegraphics/kolourpaint/widgets/toolbars/options/kpToolWidgetLineWidth.cpp #724782:724783
@@ -34,7 +34,10 @@
 
 #include <klocale.h>
 
+#include <kpColor.h>
+#include <kpPixmapFX.h>
 
+
 static int lineWidths [] = {1, 2, 3, 5, 8};
 
 kpToolWidgetLineWidth::kpToolWidgetLineWidth (QWidget *parent, const QString &name)
@@ -51,24 +54,14 @@
     {
         QPixmap pixmap ((w <= 0 ? width () : w),
                         (h <= 0 ? height () : h));
-        pixmap.fill (Qt::white);
+        kpPixmapFX::fill (&pixmap, kpColor::Transparent);
 
-        QBitmap maskBitmap (pixmap.width (), pixmap.height ());
-        maskBitmap.fill (Qt::color0/*transparent*/);
-        
-        
-        QPainter painter (&pixmap), maskPainter (&maskBitmap);
-        painter.setPen (Qt::black), maskPainter.setPen (Qt::color1/*opaque*/);
-        painter.setBrush (Qt::black), maskPainter.setBrush (Qt::color1/*opaque*/);
 
-        QRect rect = QRect (0, (pixmap.height () - lineWidths [i]) / 2,
-                            pixmap.width (), lineWidths [i]);
-        painter.drawRect (rect), maskPainter.drawRect (rect);
-
-        painter.end (), maskPainter.end ();
+        kpPixmapFX::fillRect (&pixmap,
+            0, (pixmap.height () - lineWidths [i]) / 2,
+            pixmap.width (), lineWidths [i],
+            kpColor::Black);
         
-        
-        pixmap.setMask (maskBitmap);
 
         addOption (pixmap, QString::number (lineWidths [i]));
         startNewOptionRow ();
[prev in list] [next in list] [prev in thread] [next in thread] 

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