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

List:       kde-commits
Subject:    koffice/lib/kopainter
From:       Patrick Julien <freak () ideasandassociates ! com>
Date:       2003-01-16 16:37:48
[Download RAW message or body]

CVS commit by pjulien: 

Fix various painting bugs in KoIconChooser


  M +10 -7     koIconChooser.cc   1.6


--- koffice/lib/kopainter/koIconChooser.cc  #1.5:1.6
@@ -19,4 +19,5 @@
 */
 
+#include <kdebug.h>
 #include <koIconChooser.h>
 
@@ -25,4 +26,5 @@
 #include <qhbox.h>
 #include <qlayout.h>
+#include <kdebug.h>
 
 KoPixmapWidget::KoPixmapWidget(const QPixmap &aPixmap, QWidget *parent, const char *name):
@@ -59,5 +61,5 @@ KoIconChooser::KoIconChooser(QSize aIcon
 QGridView(parent, name)
 {
-  QGridView::setBackgroundColor(white);
+  QGridView::setBackgroundColor(Qt::white);
 
   mMargin = 2;
@@ -84,6 +86,10 @@ KoIconChooser::~KoIconChooser()
 void KoIconChooser::addItem(KoIconItem *item)
 {
+  Q_INT32 n = mItemCount;
+
+  Q_ASSERT(item);
   mIconList.insert(mItemCount++, item);
   calculateCells();
+  updateCell(n / numCols(), n - (n / numCols()) * numCols());
 }
 
@@ -165,5 +171,5 @@ void KoIconChooser::mousePressEvent(QMou
 
 // when a big item is shown in full size, delete it on mouseRelease
-void KoIconChooser::mouseReleaseEvent(QMouseEvent */*e*/)
+void KoIconChooser::mouseReleaseEvent(QMouseEvent * /*e*/)
 {
   if(mPixmapWidget)
@@ -257,5 +263,5 @@ void KoIconChooser::paintCell(QPainter *
   {
     // empty cell
-    p->fillRect(0, 0, cellWidth(), cellHeight(), QBrush(white));
+    p->fillRect(0, 0, cellWidth(), cellHeight(), QBrush(Qt::white));
   }
 }
@@ -273,8 +279,5 @@ KoIconItem *KoIconChooser::itemAt(int ro
 KoIconItem *KoIconChooser::itemAt(int index)
 {
-  if(index == -1 || index >= mItemCount)
-    return 0L;
-  else
-    return mIconList.at(index);
+  return mIconList.count() > index ? mIconList.at(index) : 0;
 }
 


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

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