Bug 112492 - Gradient: Unit not shown and fonts to big
Summary: Gradient: Unit not shown and fonts to big
Status: RESOLVED FIXED
Alias: None
Product: kalzium
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Kalzium Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-09-12 19:40 UTC by Carsten Niehaus
Modified: 2005-09-15 12:41 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Carsten Niehaus 2005-09-12 19:40:51 UTC
Version:           1.4.2 (using KDE 3.4.2, Kubuntu Package 4:3.4.2-0ubuntu4 )
Compiler:          Target: i486-linux-gnu
OS:                Linux (i686) release 2.6.12-8-386

When you are in the gradient there is no way the user can see which unit is used. It should be displayed like this:

Gradient: Density [g/cm³]

Furthermore, the fonts are very big, they should be smaller, perhaps as big as a word in a menu.
Comment 1 cniehaus 2005-09-15 11:48:16 UTC
SVN commit 460807 by cniehaus:

Part one of this bug: Fix the size of the font

CCBUG: 112492


 M  +16 -0     periodictableview.cpp  


--- branches/KDE/3.5/kdeedu/kalzium/src/periodictableview.cpp #460806:460807
@@ -983,6 +983,7 @@
 	EList::ConstIterator it = d->ElementList.begin();
 	const EList::ConstIterator itEnd = d->ElementList.end();
 
+
 	/**
 	 * this loop iterates through all elements. The Elements
 	 * draw themselves, the PerodicTableView only tells them to do so
@@ -1105,6 +1106,21 @@
 	QImage img = KImageEffect::gradient ( s, Qt::white, Qt::red, 
 										  KImageEffect::HorizontalGradient );
 	QPixmap pm( img );
+	
+	/**
+	 * now find the optimum stringsize for the caption
+	 * i18n( "Gradient: van der Waals Radius" ); is at least 
+	 * for english the longest possible string. As "van der Waals"
+	 * is a name it should be the same in all languages and be
+	 * probably always the longest string
+	 */
+	QString tmp = i18n( "Gradient: van der Waals Radius" );
+	QRect rect(x+5, y+50, ELEMENTSIZE*10,20);
+	QFont font = p->font();
+	int maxSize = KalziumUtils::maxSize( tmp, rect, p->font(), p, 8, 24 );
+	kdDebug() << "maxSize: " << maxSize << endl;
+	font.setPointSize(maxSize);
+	p->setFont(font);
 
 	p->drawText( x+5, y+50, ELEMENTSIZE*10,20, Qt::AlignCenter, title ); 
 	p->drawPixmap( x+50, y+80, pm );
Comment 2 Carsten Niehaus 2005-09-15 12:41:25 UTC
The part of the bug which can be fixed without adding new strings is done for KDE 3.5, the rest is done in trunk (KDE4).