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

List:       kde-commits
Subject:    extragear/office/skrooge/skgbasegui
From:       Stephane Mankowski <stephane () mankowski ! fr>
Date:       2010-02-08 11:31:53
Message-ID: 1265628713.957971.13029.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1086974 by smankowski:

Gradient in legend

 M  +1 -1      skgmainpanel.cpp  
 M  +35 -11    skgtablewithgraph.cpp  


--- trunk/extragear/office/skrooge/skgbasegui/skgmainpanel.cpp #1086973:1086974
@@ -299,7 +299,7 @@
     //Set Cancel button
     kCancelButton=new KPushButton();
     kCancelButton->setObjectName ( QString::fromUtf8 ( "kCancelButton" ) );
-    kCancelButton->setIcon ( KIcon ( "process-stop" ) );
+    kCancelButton->setIcon ( KIcon ( "media-playback-stop" ) );
     kCancelButton->setEnabled ( false );
     kCancelButton->setToolTip ( i18nc ("Widget description", "Cancel the current \
                action" ) );
     kCancelButton->setStatusTip ( i18nc ("Widget description", "Cancel the current \
                action" ) );
--- trunk/extragear/office/skrooge/skgbasegui/skgtablewithgraph.cpp #1086973:1086974
@@ -1435,29 +1435,53 @@
         {
             for ( int i=0; i<nbRows; ++i )
             {
+	        //Get title
                 QString title=ui.kTable->item ( i, 0 )->text();
-                QTableWidgetItem* it=ui.kTable->item ( i, \
nbColumns-1-nbVirtualColumns ); +
+		//Build brush
+		QColor color1;
+                QTableWidgetItem* it=ui.kTable->item ( i, 1 );
                 if ( it )
                 {
                     QGraphicsItem * graphicItem=dynamic_cast<QGraphicsItem *> ( ( \
QGraphicsItem* ) it->data ( 1 ).toLongLong() );  if ( graphicItem )
                     {
 			//Draw box
-                        QColor color=QColor::fromHsv ( graphicItem->data ( \
DATA_COLOR_H ).toInt(), +                        color1=QColor::fromHsv ( \
                graphicItem->data ( DATA_COLOR_H ).toInt(),
                                                        graphicItem->data ( \
                DATA_COLOR_S ).toInt(),
                                                        graphicItem->data ( \
                DATA_COLOR_V ).toInt(),
                                                        graphicItem->data ( \
DATA_COLOR_A ).toInt() ); +                    }
+                }
+		QColor color2;
+                it=ui.kTable->item ( i, nbColumns-1-nbVirtualColumns );
+                if ( it )
+                {
+                    QGraphicsItem * graphicItem=dynamic_cast<QGraphicsItem *> ( ( \
QGraphicsItem* ) it->data ( 1 ).toLongLong() ); +                    if ( graphicItem \
) +                    {
+			//Draw box
+                        color2=QColor::fromHsv ( graphicItem->data ( DATA_COLOR_H \
).toInt(), +                                                       graphicItem->data \
( DATA_COLOR_S ).toInt(), +                                                       \
graphicItem->data ( DATA_COLOR_V ).toInt(), +                                         \
graphicItem->data ( DATA_COLOR_A ).toInt() ); +                    }
+                }
 
-                        QGraphicsRectItem* item=scene->addRect ( iPosition.x(), \
                iPosition.y() +2*iSize*i, 2*iSize, iSize, QPen(), QBrush ( color ) );
-                        item->setFlag ( QGraphicsItem::ItemIsSelectable, false );
+                QLinearGradient grandient( iPosition.x(), iPosition.y(), \
iPosition.x()+2*iSize, iPosition.y() ); +		grandient.setColorAt(0, color1);
+		grandient.setColorAt(1, color2);
 
-			//Draw text
-			QGraphicsTextItem* textItem=scene->addText ( title );
-			textItem->setPos ( iPosition.x()+3*iSize, iPosition.y() +2*iSize*i );
-			textItem->scale ( iScaleText, iScaleText );
-			textItem->setFlag ( QGraphicsItem::ItemIsSelectable, false );
-                    }
-                }
+		//Draw legend item
+		QGraphicsRectItem* item=scene->addRect ( iPosition.x(), iPosition.y() +2*iSize*i, \
2*iSize, iSize, QPen(), QBrush ( grandient ) ); +		item->setFlag ( \
QGraphicsItem::ItemIsSelectable, false ); +
+		//Draw text
+		QGraphicsTextItem* textItem=scene->addText ( title );
+		textItem->setPos ( iPosition.x()+3*iSize, iPosition.y() +2*iSize*i );
+		textItem->scale ( iScaleText, iScaleText );
+		textItem->setFlag ( QGraphicsItem::ItemIsSelectable, false );
+
             }
         }
     }


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

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