本文整理汇总了C++中setPrecision函数的典型用法代码示例。如果您正苦于以下问题:C++ setPrecision函数的具体用法?C++ setPrecision怎么用?C++ setPrecision使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setPrecision函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveValuesFromUi
void PropertyTreeViewer::normalise(bool _toggled)
{
m_treePropertyWidget->setEditable(!_toggled);
if(_toggled)
{
saveValuesFromUi();
TreeRightSideValues* oldVals = m_loader->createRightSide(m_leftSideTreeId,
"tmp", true);
if(isServiceTab(m_currentTab))
oldVals = m_treePropertyWidget->updateRightSideFromUi(oldVals);
else
oldVals = m_values[m_currentTab];
Q_ASSERT(oldVals);
TreeRightSideValues* newVals = normalise(oldVals);
m_treePropertyWidget->setValues(newVals);
setPrecision(6);
}
else
{
if(m_ui->tabWidget->widget(m_currentTab) == m_ui->average)
displayValuesForArithmeticalMean();
else
m_treePropertyWidget->setValues(m_values[m_currentTab]);
setPrecision(2);
}
}
示例2: switch
int QProg::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
switch (_id) {
case 0: valueChanged((*reinterpret_cast< double(*)>(_a[1]))); break;
case 1: setValue((*reinterpret_cast< double(*)>(_a[1]))); break;
case 2: setMaxValue((*reinterpret_cast< double(*)>(_a[1]))); break;
case 3: setMinValue((*reinterpret_cast< double(*)>(_a[1]))); break;
case 4: setFontDim((*reinterpret_cast< int(*)>(_a[1]))); break;
case 5: setPrecision((*reinterpret_cast< int(*)>(_a[1]))); break;
case 6: setBarColor((*reinterpret_cast< QColor(*)>(_a[1]))); break;
default: ;
}
_id -= 7;
}
#ifndef QT_NO_PROPERTIES
else if (_c == QMetaObject::ReadProperty) {
void *_v = _a[0];
switch (_id) {
case 0: *reinterpret_cast< double*>(_v) = value(); break;
case 1: *reinterpret_cast< double*>(_v) = minValue(); break;
case 2: *reinterpret_cast< double*>(_v) = maxValue(); break;
case 3: *reinterpret_cast< int*>(_v) = font(); break;
case 4: *reinterpret_cast< int*>(_v) = numPrec(); break;
case 5: *reinterpret_cast< QColor*>(_v) = color(); break;
}
_id -= 6;
} else if (_c == QMetaObject::WriteProperty) {
void *_v = _a[0];
switch (_id) {
case 0: setValue(*reinterpret_cast< double*>(_v)); break;
case 1: setMinValue(*reinterpret_cast< double*>(_v)); break;
case 2: setMaxValue(*reinterpret_cast< double*>(_v)); break;
case 3: setFontDim(*reinterpret_cast< int*>(_v)); break;
case 4: setPrecision(*reinterpret_cast< int*>(_v)); break;
case 5: setBarColor(*reinterpret_cast< QColor*>(_v)); break;
}
_id -= 6;
} else if (_c == QMetaObject::ResetProperty) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyDesignable) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyScriptable) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyStored) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyEditable) {
_id -= 6;
} else if (_c == QMetaObject::QueryPropertyUser) {
_id -= 6;
}
#endif // QT_NO_PROPERTIES
return _id;
}
示例3: ofSetWindowTitle
void GuiApp::setup(void)
{
ofSetWindowTitle("Controls");
gui = new ofxDatGui(ofxDatGuiAnchor::TOP_LEFT);
auto theme = new GuiTheme();
gui->setTheme(theme);
gui->addHeader("boids");
gui->getHeader()->setDraggable(false);
gui->addFRM(0.1);
auto fps_toggle = gui->addToggle("cap to 30 FPS");
fps_toggle->toggleEventCallback = std::bind(&GuiApp::fpsCapToggleEvent, this, std::placeholders::_1);
gui->addBreak();
gui->addLabel("boid controls");
for (const auto &type_boid_pair : Config::boids_by_type) {
const auto &boid_type = type_boid_pair.first;
const auto &boid_type_config = type_boid_pair.second;
auto boid_type_folder = gui->addFolder(BoidMisc::typeToTypename(boid_type));
auto amount_slider = boid_type_folder->addSlider("amount", 1, 1200);
amount_slider->sliderEventCallback = std::bind(&GuiApp::boidTypeAmountChanged, this, std::placeholders::_1, boid_type);
amount_slider->setPrecision(0);
amount_slider->setValue(boid_type_config.amount);
auto infl_max_dist_slider = boid_type_folder->addSlider("infl max dist", 1, 120, boid_type_config.infl_max_dist);
infl_max_dist_slider->sliderEventCallback = std::bind(&GuiApp::boidTypeInflMaxDistChanged, this, std::placeholders::_1, boid_type);
auto angle_of_view_slider = boid_type_folder->addSlider("angle of view", 10, 180, boid_type_config.angle_of_view);
angle_of_view_slider->sliderEventCallback = std::bind(&GuiApp::boidTypeAngleOfViewChanged, this, std::placeholders::_1, boid_type);
auto max_speed_slider = boid_type_folder->addSlider("max speed", 0.5, 10, boid_type_config.max_speed);
max_speed_slider->sliderEventCallback = std::bind(&GuiApp::boidTypeMaxSpeedChanged, this, std::placeholders::_1, boid_type);
auto color_picker = boid_type_folder->addColorPicker("color", boid_type_config.graphics.color);
color_picker->colorPickerEventCallback = std::bind(&GuiApp::boidTypeColorChanged, this, std::placeholders::_1, boid_type);
auto size_slider = boid_type_folder->addSlider("size", 1, 4);
size_slider->sliderEventCallback = std::bind(&GuiApp::boidTypeSizeChanged, this, std::placeholders::_1, boid_type);
size_slider->setPrecision(0);
size_slider->setValue(boid_type_config.graphics.size); // We need to set this after the precision so that the proper precision is applied
auto draw_head_toggle = boid_type_folder->addToggle("draw head", boid_type_config.graphics.draw_head);
draw_head_toggle->toggleEventCallback = std::bind(&GuiApp::boidTypeDrawHeadChanged, this, std::placeholders::_1, boid_type);
}
ofBackground(theme->color.guiBackground);
ofSetFrameRate(60);
}
示例4: IntensityFactor
IntensityFactor() : rif(0.0), secs(0.0)
{
setSymbol("coggan_if");
setName("IF");
setType(RideMetric::Average);
setPrecision(3);
}
示例5: initialize
void initialize() {
setName(tr("Aerobic Decoupling"));
setType(RideMetric::Average);
setMetricUnits(tr("%"));
setImperialUnits(tr("%"));
setPrecision(1);
}
示例6: initialize
void initialize() {
setName("LNP");
setType(RideMetric::Average);
setMetricUnits("watts");
setImperialUnits("watts");
setPrecision(0);
}
示例7: QTableWidget
caTable::caTable(QWidget *parent) : QTableWidget(parent)
{
setPrecisionMode(Channel);
setLimitsMode(Channel);
setPrecision(0);
setMinValue(0.0);
setMaxValue(1.0);
for(int i=0; i< MaxRows; i++) {
setFormat(i, 1);
for(int j=0; j< MaxCols; j++) tableItem[i][j] = (QTableWidgetItem*) 0;
}
thisItemFont = this->font();
setColorMode(Static);
setAlternatingRowColors(true);
setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding);
setEditTriggers(QTableWidget::NoEditTriggers);
verticalHeader()->setDefaultSectionSize(20);
horizontalHeader()->setResizeMode(QHeaderView::Stretch);
defaultForeColor = palette().foreground().color();
createActions();
addAction(copyAct);
connect(this, SIGNAL( cellDoubleClicked (int, int) ), this, SLOT(celldoubleclicked( int, int ) ) );
//connect(this, SIGNAL( cellClicked (int, int) ), this, SLOT(cellclicked( int, int ) ) );
}
示例8: PeakWPK
PeakWPK() : wpk(0.0), secs(0.0), weight(0.0)
{
setType(RideMetric::Peak);
setMetricUnits(tr("wpk"));
setImperialUnits(tr("wpk"));
setPrecision(1);
}
示例9: initialize
void initialize() {
setName(tr("Left/Right Balance"));
setMetricUnits(tr("%"));
setImperialUnits(tr("%"));
setType(RideMetric::Average);
setPrecision(1);
}
示例10: switch
bool RealFormat::setValue(int idx, const Variant& val)
{
bool result;
int tmp;
switch (idx)
{
case 0:
result = setInt(tmp, val) && setMode((FmtMode)tmp);
break;
case 1:
result = setInt(tmp, val) && setBase(tmp);
break;
case 2:
result = setInt(tmp, val) && setSignificandBase(tmp);
break;
case 3:
result = setInt(tmp, val) && setScaleBase(tmp);
break;
case 4:
result = setInt(tmp, val) && setPrecision(tmp);
break;
// result = setChar(dot, val); break;
default:
result = false;
}
return result;
}
示例11: VI
VI() : vi(0.0), secs(0.0)
{
setSymbol("coggam_variability_index");
setName("VI");
setType(RideMetric::Average);
setPrecision(3);
}
示例12: initialize
void initialize() {
setName("NP");
setType(RideMetric::Average);
setMetricUnits("watts");
setImperialUnits("watts");
setPrecision(0);
setDescription(tr("Normalized Power is an estimate of the power that you could have maintained for the same physiological 'cost' if your power output had been perfectly constant."));
}
示例13: ZoneTime
ZoneTime() : level(0), seconds(0.0)
{
setType(RideMetric::Total);
setMetricUnits("seconds");
setImperialUnits("seconds");
setPrecision(0);
setConversion(1.0);
}
示例14: setChannels
//ported from bsnes
Resampler::Resampler()
{
setChannels(2);
setPrecision(16);
setFrequency(44100.0, 44100.0);
setVolume(1.0);
clear();
}
示例15: initialize
void initialize() {
setName("LNP");
setType(RideMetric::Average);
setMetricUnits("watts");
setImperialUnits("watts");
setPrecision(0);
setDescription(tr("Lactate Normalized Power as defined by Dr. Skiba in GOVSS algorithm"));
}