From 8bc1bab56acf5d32f6cd8486eca28581934fe433 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Thu, 1 Sep 2005 18:53:00 +0000 Subject: [PATCH] complete the sync with the 3.5 branch svn path=/trunk/KDE/kdeedu/kalzium/src/element.cpp; revision=455955 --- kalzium/src/element.cpp | 23 +++++++++++++++++++++++ kalzium/src/element.h | 6 ++++++ 2 files changed, 29 insertions(+) diff --git a/kalzium/src/element.cpp b/kalzium/src/element.cpp index 26f4911..0367c09 100644 --- a/kalzium/src/element.cpp +++ b/kalzium/src/element.cpp @@ -341,6 +341,29 @@ void Element::drawGradient( QPainter* p, const QString& value, const QColor& c) p->drawRect( X, Y,ELEMENTSIZE+1,ELEMENTSIZE+1); } +void Element::drawGrayedOut( QPainter *p ) +{ + //The X-coordiante + int X = xPos(); + + //The Y-coordinate + int Y = yPos(); + + p->fillRect( X, Y,ELEMENTSIZE,ELEMENTSIZE, Qt::lightGray ); + + p->setPen( Qt::darkGray ); + + QFont symbol_font = p->font(); + const QRect rect = QRect( X,Y,ELEMENTSIZE-2,ELEMENTSIZE-10 ); + int goodsize = KalziumUtils::maxSize( symbol(), rect, symbol_font, p ); + symbol_font.setPointSize( goodsize ); + p->setFont( symbol_font ); + p->drawText( X+1,Y+5, ELEMENTSIZE-2,ELEMENTSIZE-10,Qt::AlignCenter, symbol() ); + + p->setPen( Qt::black ); + p->drawRect( X, Y,ELEMENTSIZE+1,ELEMENTSIZE+1); +} + void Element::drawSelf( QPainter* p, bool simple, bool isCrystal ) { //the height of a "line" inside an element diff --git a/kalzium/src/element.h b/kalzium/src/element.h index e0212dd..78e736c 100644 --- a/kalzium/src/element.h +++ b/kalzium/src/element.h @@ -494,6 +494,12 @@ class Element{ */ virtual void drawGradient( QPainter* p, const QString& value, const QColor& c); + /** + * Draw the Element grayed out. Used in the timeline + * @param p the painter used for the painting + */ + virtual void drawGrayedOut( QPainter* p ); + /** * draw the rectangle with the information * @param p painter to do the drawing on -- 2.47.3