]> Git trees. - libqmvoc.git/commitdiff
add gradients to kalzium
authorCarsten Niehaus <cniehaus@gmx.de>
Sun, 22 May 2005 19:34:03 +0000 (19:34 +0000)
committerCarsten Niehaus <cniehaus@gmx.de>
Sun, 22 May 2005 19:34:03 +0000 (19:34 +0000)
svn path=/trunk/KDE/kdeedu/kalzium/src/element.cpp; revision=417088

kalzium/src/element.cpp
kalzium/src/element.h

index b9f82db72e1258594e09d6bd92a20c82abf7b60d..9c4b95918fa52888275d5657e21200c55ffb7609 100644 (file)
@@ -335,6 +335,42 @@ void Element::drawHighlight( QPainter* p, int coordinate, bool horizontal )
        drawSelf( p, false );
 }
        
+void Element::drawGradient( QPainter* p, const QString& value, const QColor c)
+{
+       //the height of a "line" inside an element
+       int h_small = 15; //the size for the small units like elementnumber
+
+       //The X-coordiante
+       int X = 0;
+       
+       X = ( x-1 )*ELEMENTSIZE;
+
+       //The Y-coordinate
+       int Y = ( y-1 )*ELEMENTSIZE;
+       Y += ELEMENTSIZE;
+
+       p->setPen( c );
+       p->fillRect( X+3, Y+3,ELEMENTSIZE-6,ELEMENTSIZE-6, c );
+       p->drawRoundRect( X+2, Y+2,ELEMENTSIZE-4,ELEMENTSIZE-4 );
+       
+       p->setPen( Qt::black );
+       QFont symbol_font = p->font();
+       symbol_font.setPointSize( 18 );
+       QFont f = p->font();
+       f.setPointSize( 9 );
+               
+       p->setFont( f );
+
+       p->drawText( X+5,Y+ELEMENTSIZE-h_small , ELEMENTSIZE-2, h_small,Qt::AlignLeft, value );
+
+       p->setFont( symbol_font );
+       p->drawText( X+5,Y+2, ELEMENTSIZE,ELEMENTSIZE,Qt::AlignCenter, symbol() );
+       
+       //border
+       p->setPen( Qt::black );
+       p->drawRoundRect( X+1, Y+1,ELEMENTSIZE-2,ELEMENTSIZE-2);
+}
+
 void Element::drawSelf( QPainter* p, bool useSimpleView )
 {
        //the height of a "line" inside an element
index cbe74a8fe58cf45bd4aa5ef6ca128f259975b4a8..9a52fedfb05cef36b1e139cd07d930e8e70bf210 100644 (file)
@@ -28,6 +28,7 @@
 #include <qfile.h>
 
 class Element;
+class QColor;
 
 struct coordinate;
 
@@ -300,12 +301,12 @@ class Element{
                        RADIUS = 0,
                        WEIGHT,
                        DENSITY,
-                       DATE,
                        BOILINGPOINT,
                        MELTINGPOINT,
                        IE,
+                       EN,
                        IE2,
-                       EN
+                       DATE
                };
 
 
@@ -364,6 +365,8 @@ class Element{
                 * draw the recatangle with the information
                 * @param showFullInformation if True more information will be shown
                 */
+               virtual void drawGradient( QPainter* p, const QString& value, const QColor );
+               
                virtual void drawSelf( QPainter* p, bool showFullInformation );
                
                /**