[Kst] kdeextragear-2/kst/kst

Andrew Walker arwalker at sumusltd.com
Thu Dec 18 00:02:42 CET 2003


CVS commit by arwalker: 

Provide a marginally nicer looking appearance of the point style
drawn in the edit field portion of the combobox by centering the
point style and painting the entire area in the same colour.


  M +31 -20    curveappearancewidget.ui.h   1.5


--- kdeextragear-2/kst/kst/curveappearancewidget.ui.h  #1.4:1.5
@@ -8,4 +8,5 @@
 *****************************************************************************/
 
+#include <qstyle.h>
 
 bool CurveAppearanceWidget::showLines()
@@ -31,9 +32,19 @@ void CurveAppearanceWidget::fillCombo()
 {
   KstPoint tmppoint;
+    QRect rect;
   int iCurrentItem;
   
+    rect = _combo->style().querySubControlMetrics(
+           QStyle::CC_ComboBox, 
+           _combo, 
+           QStyle::SC_ComboBoxEditField );
+    rect.setLeft( rect.left() + 2 );
+    rect.setRight( rect.right() - 2 );
+    rect.setTop( rect.top() + 2 );
+    rect.setBottom( rect.bottom() - 2 );
+    
   /* fill the point type dialog with point types */
-  QPixmap ppix(20,10);
-  QPainter pp(&ppix);
+    QPixmap ppix( rect.width(), rect.height() );
+    QPainter pp( &ppix );
   
   iCurrentItem = _combo->currentItem( );
@@ -42,7 +53,7 @@ void CurveAppearanceWidget::fillCombo()
 
   for (int ptype = 0; ptype <= KSTPOINT_MAXTYPE; ptype++) {
-    pp.fillRect(pp.window(), QColor("white"));
+        pp.fillRect( pp.window(), QColor("white"));
     tmppoint.setType(ptype);
-    tmppoint.draw(&pp, ppix.width()/2, ppix.height()/2, 600);
+        tmppoint.draw( &pp, ppix.width()/2, ppix.height()/2, 600 );
     _combo->insertItem(ppix);
   }
@@ -67,7 +78,7 @@ QColor CurveAppearanceWidget::color()
 void CurveAppearanceWidget::drawLine()
 {
-QPixmap pix(_label->contentsRect().size());
-QPainter p(&pix);
-KstPoint tmppoint;
+    QPixmap pix(_label->contentsRect().size());
+    QPainter p(&pix);
+    KstPoint tmppoint;
 
     p.fillRect(p.window(), QColor("white"));





More information about the Kst mailing list