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

List:       kde-commits
Subject:    koffice/kexi/shapes/relationdesign
From:       Adam Pigg <adam () piggz ! co ! uk>
Date:       2009-08-25 19:47:42
Message-ID: 1251229662.265800.20547.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1015540 by piggz:

Fix connection points on resize of the shape and use the standard koffice fill \
effects

 M  +15 -4     kexirelationdesignshape.cpp  
 M  +2 -1      kexirelationdesignshape.h  


--- trunk/koffice/kexi/shapes/relationdesign/kexirelationdesignshape.cpp \
#1015539:1015540 @@ -25,6 +25,7 @@
 #include <KoXmlWriter.h>
 #include <KoShapeSavingContext.h>
 #include <KoXmlReader.h>
+#include <KoShapeBackground.h>
 
 KexiRelationDesignShape::KexiRelationDesignShape() : \
KoFrameShape("http://www.koffice.org/kexirelationdesign", "shape"){  m_connection = \
0; @@ -121,17 +122,21 @@
 
 void KexiRelationDesignShape::paint ( QPainter& painter, const KoViewConverter& \
converter ) {  QSizeF viewSize = converter.documentToView(size());
-    QLinearGradient linearGrad(QPointF(0, 0), QPointF(viewSize.width(), \
                viewSize.height()));
-    linearGrad.setColorAt(0, Qt::white);
-    linearGrad.setColorAt(1, QColor(240,240,240));
 
     painter.save();
     painter.setRenderHint(QPainter::Antialiasing, true);
     painter.setClipRect(QRectF(QPointF(-0.5,-0.5), viewSize + QSizeF(1,1)));
-    painter.setBrush(linearGrad);
     
     painter.setPen(QPen(Qt::black, 1.0));
     painter.drawRoundedRect(QRectF(QPointF(0.5,0.5), (viewSize - QSizeF(1.0, 1.0))), \
converter.documentToViewX(3.0), converter.documentToViewY(3.0)); +
+    //Draw user specified background
+    QPainterPath pp;
+    pp.addRoundedRect(QRectF(QPointF(0.5,0.5), (viewSize - QSizeF(1.0, 1.0))), \
converter.documentToViewX(3.0), converter.documentToViewY(3.0)); +    if \
(background()) { +        background()->paint(painter, pp);
+    }
+
     painter.drawLine(0, converter.documentToViewY(15), viewSize.width(), \
converter.documentToViewY(15));  
     QFont f;
@@ -254,3 +259,9 @@
 
     }
 }
+
+void KexiRelationDesignShape::setSize(const QSizeF &size)
+{
+    addConnectionPoints();
+    KoShape::setSize(size);
+}
--- trunk/koffice/kexi/shapes/relationdesign/kexirelationdesignshape.h \
#1015539:1015540 @@ -38,7 +38,8 @@
         virtual void saveOdf ( KoShapeSavingContext& context ) const;
         virtual bool loadOdf ( const KoXmlElement& element, KoShapeLoadingContext& \
                context );
         virtual void paint ( QPainter& painter, const KoViewConverter& converter );
-
+        virtual void setSize(const QSizeF &size);
+        
         void setConnectionData(KexiDB::ConnectionData*);
         KexiDB::ConnectionData* connectionData();
 


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

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