[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdeedu/kalzium/src
From: Carsten Niehaus <cniehaus () gmx ! de>
Date: 2005-01-29 10:51:15
Message-ID: 20050129105115.BCE291C902 () office ! kde ! org
[Download RAW message or body]
CVS commit by cniehaus:
Jasons patch: improve the look of this dialog
M +55 -23 detailinfodlg.cpp 1.46
--- kdeedu/kalzium/src/detailinfodlg.cpp #1.45:1.46
@@ -160,23 +160,53 @@ void DetailedTab::paintEvent( QPaintEven
p.setBrush(Qt::NoBrush);
- /**
- * TODO: Fix the fonts
- **/
- QFont f1 = KGlobalSettings::generalFont();
- QFont f2 = KGlobalSettings::generalFont();
- QFont f3 = KGlobalSettings::generalFont();
+ QFont fA = KGlobalSettings::generalFont();
+ QFont fB = KGlobalSettings::generalFont();
+ QFont fC = KGlobalSettings::generalFont();
+ fA.setPointSize( fA.pointSize() + 20 ); //Huge font
+ fA.setBold( true );
+ fB.setPointSize( fB.pointSize() + 6 ); //Big font
+ fC.setPointSize( fC.pointSize() + 4 ); //Big font
+ fC.setBold( true );
+ QFontMetrics fmA = QFontMetrics( fA );
+ QFontMetrics fmB = QFontMetrics( fB );
+ QFontMetrics fmC = QFontMetrics( fC );
- p.setFont( f1 );
- int h_ = y2/10*3; //a third of the whole widget
- p.drawText( x2/10 * 4, h_ , e->symbol() ); //Symbol
+ //coordinates for element symbol: near the center
+ int xA = 4 * w / 10;
+ int yA = h / 2;
- p.setFont( f2 );
- p.drawText( x1+4, y2-h_t , x2/2 , h_t , Qt::AlignLeft , i18n( \
e->elname().utf8() )); //Name + //coordinates for the atomic number: offset from \
element symbol to the upper left + int xB = xA - fmB.width( QString::number( \
e->number() ) ); + int yB = yA - fmA.height() + fmB.height();
- p.drawText( x1+4+h_t , y2-2*h_t , x2-x1-4-h_t , h_t , Qt::AlignRight , \
e->oxstage() ); //Oxidationszahlen
- p.drawText( x2/2 , y2-h_t , x2/2-4 , h_t , Qt::AlignRight , QString::number( \
e->weight() )); //Weight + //coordinates for element name: lower left
+ int xC1 = 8;
+ int yC1 = h - 8;
+
+ //coordinates for oxidation: right side, above atomic weight
+ int xC2 = w - fmC.width( e->oxstage() ) - 8;
+ int yC2 = h - fmC.height() - 8;
+
+ //coordinates for weight: lower right corner
+ int xC3 = w - fmC.width( QString::number( e->weight() ) ) - 8;
+ int yC3 = h - 8;
+
+ //Element Symbol
+ p.setFont( fA );
+ p.drawText( xA, yA , e->symbol() );
+
+ //Atomic number
+ p.setFont( fB );
+ p.drawText( xB, yB, QString::number( e->number() ));
+
+ //Name and other data
+ p.setFont( fC );
+ //Name
+ p.drawText( xC1, yC1, i18n( e->elname().utf8() ));
+ //Oxidationszahlen
+ p.drawText( xC2, yC2, e->oxstage() );
+ //Weight
+ p.drawText( xC3, yC3, QString::number( e->weight() ));
- p.setFont( f3 );
- p.drawText( x2/10*3 , h_-h_t , x2/10, h_t , Qt::AlignRight , \
QString::number( e->number() )); drawBiologicalSymbol( &p );
@@ -193,6 +223,8 @@ void DetailedTab::drawBiologicalSymbol(
int d_ds = ( db/2 )-( ds/2 ); //the delta-x/y of the inner circle
- int pos_x = x1+4;
- int pos_y = y2 - 5 - 2*h_t;
+// int pos_x = x1+4;
+// int pos_y = y2 - 5 - 2*h_t;
+ int pos_x = 8;
+ int pos_y = 8;
switch ( e->biological() )
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic