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

List:       kde-edu-devel
Subject:    [kde-edu]: [PATCH] for bug 86758 in KVocTrain
From:       Peter Hedlund <peter () peterandlinda ! com>
Date:       2004-08-08 18:19:38
Message-ID: 200408081119.39933.peter () peterandlinda ! com
[Download RAW message or body]

Hi,

The attached patch corrects bug http://bugs.kde.org/show_bug.cgi?id=86758.

Please review and, if OK, commit since I'm a bit unsure how to work with the 
different branches. The patch is against HEAD.

I know the event described in the bug is very unlikely, but since it results 
in a crash I think it should be corrected.

The crash occurs when a flag image can't be found. The flag images are 
displayed in the header columns of the main table in KVocTrain.

The option dialog (Options->General Options...->Language) where languages are 
defined is not affected, it already checks for a valid image file.

Thanks,
Peter

["kvoctrainview.cpp.diff" (text/x-diff)]

Index: kvoctrainview.cpp
===================================================================
RCS file: /home/kde/kdeedu/kvoctrain/kvoctrain/kvoctrainview.cpp,v
retrieving revision 1.32
diff -U3 -r1.32 kvoctrainview.cpp
--- kvoctrainview.cpp	3 Apr 2004 22:15:59 -0000	1.32
+++ kvoctrainview.cpp	8 Aug 2004 18:08:13 -0000
@@ -38,6 +38,7 @@
 
 #include <qlayout.h>
 #include <qbitmap.h>
+#include <qfile.h>
 
 #include <ctype.h>
 
@@ -250,7 +251,28 @@
   }
   else
   {
-     QPixmap pix(pixfile);
+    QPixmap pix;     
+    if (QFile::exists(pixfile))
+      pix.load(pixfile);
+    else
+    {
+      //this is the code used by kxkb when a flag image can't be found
+      //see kdebase/kxkb/pixmap.cpp/LayoutIcon::findPixmap()
+      pix.resize(21, 14);
+      pix.fill(Qt::white);
+      
+      QPainter p(&pix);
+      
+      QFont font("sans");
+      font.setPixelSize(10);
+      font.setWeight(QFont::Bold);
+      p.setFont(font);
+      p.setPen(Qt::red);
+      p.drawText(2, 1, pix.width(), pix.height()-2, Qt::AlignCenter, "err");
+      p.setPen(Qt::blue);
+      p.drawText(1, 0, pix.width(), pix.height()-2, Qt::AlignCenter, "err");     
+    }
+     
      int w = pix.width();
      int h = pix.height();
 


_______________________________________________
kde-edu mailing list
kde-edu@mail.kde.org
https://mail.kde.org/mailman/listinfo/kde-edu


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

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