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

List:       kde-commits
Subject:    kdebindings/kjsembed/bindings
From:       Ian Reinhart Geiser <geiseri () kde ! org>
Date:       2003-12-18 6:49:09
[Download RAW message or body]

CVS commit by geiseri: 

This might not be the right place for it, but we need a good way to get
the bounding boxes of text drawn on the painter with the current font
metrics.  Ideally we can move this later when we bind QFontMetrics?


  M +6 -0      painter_imp.cpp   1.10
  M +2 -0      painter_imp.h   1.9


--- kdebindings/kjsembed/bindings/painter_imp.h  #1.8:1.9
@@ -60,4 +60,6 @@ public slots:
     QPen pen() const;
 
+    QRect textBox(const QString &text);
+    
     void moveTo( int x, int y );
     void lineTo( int x, int y );

--- kdebindings/kjsembed/bindings/painter_imp.cpp  #1.9:1.10
@@ -119,4 +119,10 @@ QPen Painter::pen() const
 }
 
+QRect Painter::textBox(const QString &text)
+{
+        QFontMetrics fnt = p->fontMetrics();
+        return fnt.boundingRect(text);
+}
+
 void Painter::moveTo( int x, int y )
 {


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

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