Some fixes in the unit system
This commit is contained in:
parent
87c4741fac
commit
f58ea31b6a
|
@ -119,7 +119,7 @@ Quantity& Quantity::operator = (const Quantity &New)
|
|||
return *this;
|
||||
}
|
||||
|
||||
QString Quantity::getUserString(double &factor,QString &unitString)
|
||||
QString Quantity::getUserString(double &factor,QString &unitString)const
|
||||
{
|
||||
return Base::UnitsApi::schemaTranslate(*this,factor,unitString);
|
||||
}
|
||||
|
@ -200,7 +200,7 @@ Quantity Quantity::Yard (914.4 ,Unit(1));
|
|||
Quantity Quantity::Mile (1609344.0 ,Unit(1));
|
||||
|
||||
Quantity Quantity::Pound (0.45359237 ,Unit(0,1));
|
||||
Quantity Quantity::Ounce (0.45359237 ,Unit(0,1));
|
||||
Quantity Quantity::Ounce (0.0283495231 ,Unit(0,1));
|
||||
Quantity Quantity::Stone (6.35029318 ,Unit(0,1));
|
||||
Quantity Quantity::Hundredweights (50.80234544 ,Unit(0,1));
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ public:
|
|||
//@}
|
||||
|
||||
/// transfer to user prefered unit/potence
|
||||
QString getUserString(double &factor=defaultFactor,QString &unitString=QString());
|
||||
QString getUserString(double &factor=defaultFactor,QString &unitString=QString())const;
|
||||
//double getUserPrefered() const { QString dummy; return getUserPrefered(dummy); }
|
||||
//double getUserPrefered(QString &unitString) const;
|
||||
//std::string getUserString(void)const;
|
||||
|
|
|
@ -159,57 +159,3 @@ int UnitsApi::getDecimals()
|
|||
return UserPrefDecimals;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//// === Parser & Scanner stuff ===============================================
|
||||
//
|
||||
//// include the Scanner and the Parser for the filter language
|
||||
//
|
||||
//double ScanResult=0;
|
||||
//bool UU = false;
|
||||
//
|
||||
//// error func
|
||||
//void Unit_yyerror(char *errorinfo)
|
||||
//{ throw Base::Exception(errorinfo); }
|
||||
//
|
||||
//
|
||||
//// for VC9 (isatty and fileno not supported anymore)
|
||||
//#ifdef _MSC_VER
|
||||
//int isatty (int i) {return _isatty(i);}
|
||||
//int fileno(FILE *stream) {return _fileno(stream);}
|
||||
//#endif
|
||||
//
|
||||
//namespace UnitParser {
|
||||
//
|
||||
//// show the parser the lexer method
|
||||
//#define yylex UnitsApilex
|
||||
//int UnitsApilex(void);
|
||||
//
|
||||
//// Parser, defined in UnitsApi.y
|
||||
//#include "UnitsApi.tab.c"
|
||||
//
|
||||
//#ifndef DOXYGEN_SHOULD_SKIP_THIS
|
||||
//// Scanner, defined in UnitsApi.l
|
||||
//#include "lex.UnitsApi.c"
|
||||
//#endif // DOXYGEN_SHOULD_SKIP_THIS
|
||||
//}
|
||||
//
|
||||
//double UnitsApi::parse(const char* buffer,bool &UsedUnit)
|
||||
//{
|
||||
// // parse from buffer
|
||||
// UnitParser::YY_BUFFER_STATE my_string_buffer = UnitParser::UnitsApi_scan_string (buffer);
|
||||
// // set the global return variables
|
||||
// ScanResult = DOUBLE_MIN;
|
||||
// UU = false;
|
||||
// // run the parser
|
||||
// UnitParser::Unit_yyparse ();
|
||||
// UsedUnit = UU;
|
||||
// UU=false;
|
||||
// // free the scan buffer
|
||||
// UnitParser::UnitsApi_delete_buffer (my_string_buffer);
|
||||
//
|
||||
// if (ScanResult == DOUBLE_MIN)
|
||||
// throw Base::Exception("Unknown error in Unit expression");
|
||||
// return ScanResult;
|
||||
//}
|
||||
|
|
|
@ -52,4 +52,4 @@ QString UnitsSchemaInternal::schemaTranslate(Base::Quantity quant,double &factor
|
|||
// return Base::Quantity(1,unit);
|
||||
// }
|
||||
|
||||
}
|
||||
//}
|
||||
|
|
|
@ -105,7 +105,7 @@ void DlgUnitsCalculator::valueChanged(const Base::Quantity& quant)
|
|||
}
|
||||
}else{
|
||||
//this->ValueOutput->setValue(quant);
|
||||
this->ValueOutput->setText(QString::fromAscii(quant.getUserString().c_str()));
|
||||
this->ValueOutput->setText(quant.getUserString());
|
||||
QPalette palette;
|
||||
palette.setColor(QPalette::Base,QColor(200,255,200));
|
||||
this->ValueOutput->setPalette(palette);
|
||||
|
|
|
@ -226,7 +226,7 @@ void InputField::setValue(const Base::Quantity& quant)
|
|||
if(!quant.getUnit().isEmpty())
|
||||
actUnit = quant.getUnit();
|
||||
|
||||
setText(QString::fromAscii(quant.getUserString().c_str()));
|
||||
setText(quant.getUserString());
|
||||
}
|
||||
|
||||
void InputField::setUnit(const Base::Unit& unit)
|
||||
|
|
Loading…
Reference in New Issue
Block a user