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

List:       kde-commits
Subject:    KDE/kdegraphics/kviewshell/shell
From:       Wilfried Huss <Wilfried.Huss () gmx ! at>
Date:       2006-02-28 21:52:11
Message-ID: 1141163531.683571.16721.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 514633 by whuss:

Fix drawing of the thumbnail list.

 M  +18 -6     marklist.cpp  
 M  +3 -1      marklist.h  


--- trunk/KDE/kdegraphics/kviewshell/shell/marklist.cpp #514632:514633
@@ -214,6 +214,7 @@
   QBoxLayout* layout = new QVBoxLayout(this, margin);
 
   thumbnailWidget = 0;
+  _selected = false;
   if (showThumbnail)
   {
     thumbnailWidget = new ThumbnailWidget(this, pageNumber, pageCache);
@@ -247,8 +248,6 @@
   if ((pageNumber % 2 == 0) && KGlobalSettings::alternateBackgroundColor().isValid())
     _backgroundColor = KGlobalSettings::alternateBackgroundColor();
 
-  setPaletteBackgroundColor( _backgroundColor );
-
   show();
 }
 
@@ -319,10 +318,11 @@
 
 void MarkListWidget::setSelected( bool selected )
 {
-    if (selected)
-      setPaletteBackgroundColor( QApplication::palette().active().highlight() );
-    else
-      setPaletteBackgroundColor( _backgroundColor );
+  if (_selected != selected)
+  {
+    _selected = selected;
+    update();
+  }
 }
 
 
@@ -382,6 +382,17 @@
 }
 
 
+void MarkListWidget::paintEvent(QPaintEvent* e)
+{
+  // Region from which rectangles occupied by child widgets will by substracted.
+  QPainter p(this);
+  if (_selected)
+    p.fillRect(e->rect(), QApplication::palette().active().highlight());
+  else
+    p.fillRect(e->rect(), _backgroundColor);
+}
+
+
 void MarkListWidget::setThumbnail()
 {
   thumbnailWidget->update();
@@ -838,3 +849,4 @@
   }
   widgetList[pageNumber - 1]->setThumbnail();
 }
+
--- trunk/KDE/kdegraphics/kviewshell/shell/marklist.h #514632:514633
@@ -108,11 +108,13 @@
 
 protected:
   virtual void mousePressEvent(QMouseEvent*);
+  virtual void paintEvent(QPaintEvent*);
 
 private:
 
   bool showThumbnail;
-
+  bool _selected;
+  
   ThumbnailWidget* thumbnailWidget;
   QCheckBox* checkBox;
   QLabel* pageLabel;

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

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