4 /***************************************************************************
5 copyright : (C) 2005, 2006 by Carsten Niehaus
6 email : cniehaus@kde.org
7 ***************************************************************************/
8 /***************************************************************************
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
15 ***************************************************************************/
23 #include <chemicaldataobject.h>
29 * @param string the string which is measured
30 * @param rect the rect needed for measurement
31 * @param font the used font
32 * @param painter the used painter
33 * @param maxFontSize the maximum fontsize
34 * @param minFontSize the maximum fontsize
36 static int maxSize( const QString
& string
, const QRect
& rect
, QFont font
, QPainter
* painter
, int minFontSize
= 4, int maxFontSize
= 20 );
39 * calculate the 4-digit value of the value @p w. For
40 * example, 12.3456 will be returned as 12.35
41 * @param value the value which will be stripped
42 * @return the 4-digit value
44 static double strippedValue( double value
);
47 * @param string the string which is measured
48 * @param font the used font
49 * @param painter the used painter
50 * @return the width of the string @p string
52 static int StringWidth( const QString
& string
, const QFont
& font
, QPainter
* painter
);
54 * @param string the string which is measured
55 * @param font the used font
56 * @param painter the used painter
57 * @return the height of the string @p string
59 static int StringHeight( const QString
& string
, const QFont
& font
, QPainter
* painter
);
62 * An almost standard way to get an unit well converted for
63 * displaying including (eventual) unit.
64 * @param el the element
65 * @param kind the unit we want to print of the element @p el
66 * @return the formatted string
68 static QString
prettyUnit( const Element
* el
, ChemicalDataObject::BlueObelisk kind
);
71 #endif // KALZIUMUTILS_H