#1 fixed und einiges mehr

git-svn-id: http://svn.lsim.tuxzone.org/trunk@10 4bec179b-ab65-46ed-a5f8-55b8b5c735d0
This commit is contained in:
catdog2
2008-11-02 20:34:58 +00:00
parent dc3d1dd8cb
commit 1f68e40c77
17 changed files with 162 additions and 37 deletions

View File

@@ -28,7 +28,8 @@
ExpDoubleSpinBox::ExpDoubleSpinBox()
: QDoubleSpinBox() {
setPositiveExp(4);
setNegativeExp(3);
setNegativeExp(3);
setDisplayDecimals(decimals());
}
@@ -44,14 +45,14 @@ QString ExpDoubleSpinBox::textFromValue ( double val ) const {
//qDebug() << val;
if((val < pow(10,getPositiveExp()) && val > 1) || (val > -pow(10,getPositiveExp()) && val < -1) || val == 0) {
//return QDoubleSpinBox::textFromValue ( val );
return QString("%L1").arg(val,0,'f',decimals());
return QString("%L1").arg(val,0,'f',getDisplayDecimals());
}
else if ( (val >= pow(10, -getNegativeExp()) && val <= 1 ) || (val <= -pow(10, -getNegativeExp()) && val >= -1 ) ){
//return QDoubleSpinBox::textFromValue ( val );
return QString("%L1").arg(val,0,'f',decimals());
return QString("%L1").arg(val,0,'f',getDisplayDecimals());
}
else {
return QString("%L1").arg(val,0,'e',decimals());
return QString("%L1").arg(val,0,'e',getDisplayDecimals());
}
//return QDoubleSpinBox::textFromValue ( val );
}
@@ -97,3 +98,16 @@ void ExpDoubleSpinBox::stepBy ( int steps ) {
}
int ExpDoubleSpinBox::getDisplayDecimals() const {
return displayDecimals;
}
void ExpDoubleSpinBox::setDisplayDecimals ( int theValue ) {
if (displayDecimals == theValue) return;
//Nicht mehr anzeigen, als die gneauigkeit zulaesst
if (theValue > decimals()) theValue = decimals();
displayDecimals = theValue;
}