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); } }
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; }
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); }
IntensityFactor() : rif(0.0), secs(0.0) { setSymbol("coggan_if"); setName("IF"); setType(RideMetric::Average); setPrecision(3); }
void initialize() { setName(tr("Aerobic Decoupling")); setType(RideMetric::Average); setMetricUnits(tr("%")); setImperialUnits(tr("%")); setPrecision(1); }
void initialize() { setName("LNP"); setType(RideMetric::Average); setMetricUnits("watts"); setImperialUnits("watts"); setPrecision(0); }
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 ) ) ); }
PeakWPK() : wpk(0.0), secs(0.0), weight(0.0) { setType(RideMetric::Peak); setMetricUnits(tr("wpk")); setImperialUnits(tr("wpk")); setPrecision(1); }
void initialize() { setName(tr("Left/Right Balance")); setMetricUnits(tr("%")); setImperialUnits(tr("%")); setType(RideMetric::Average); setPrecision(1); }
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; }
VI() : vi(0.0), secs(0.0) { setSymbol("coggam_variability_index"); setName("VI"); setType(RideMetric::Average); setPrecision(3); }
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.")); }
ZoneTime() : level(0), seconds(0.0) { setType(RideMetric::Total); setMetricUnits("seconds"); setImperialUnits("seconds"); setPrecision(0); setConversion(1.0); }
//ported from bsnes Resampler::Resampler() { setChannels(2); setPrecision(16); setFrequency(44100.0, 44100.0); setVolume(1.0); clear(); }
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")); }
QgsRendererRangeV2LabelFormat::QgsRendererRangeV2LabelFormat( QString format, int precision, bool trimTrailingZeroes ): mReTrailingZeroes( "[.,]?0*$" ), mReNegativeZero( "^\\-0(?:[.,]0*)?$" ) { setFormat( format ); setPrecision( precision ); setTrimTrailingZeroes( trimTrailingZeroes ); }
void OSIntegerEdit2::onEditingFinished() { emit inFocus(true, hasData()); QString text = this->text(); if (text.isEmpty() || m_text == text) return; if (m_modelObject) { std::string str = this->text().toStdString(); boost::regex autore("[aA][uU][tT][oO]"); ModelObject modelObject = m_modelObject.get(); if (str.empty()) { if (m_reset) { (*m_reset)(); } } else if (boost::regex_search(str,autore)) { if (m_isAutosized) { if (m_autosize) { (*m_autosize)(); } else if (m_reset) { (*m_reset)(); } } if (m_isAutocalculated) { if (m_autocalculate) { (*m_autocalculate)(); } else if (m_reset) { (*m_reset)(); } } } else { try { int value = boost::lexical_cast<int>(str); setPrecision(str); if (m_set) { QString text = this->text(); if (text.isEmpty() || m_text == text) return; bool result = (*m_set)(value); if (!result){ //restore refreshTextAndLabel(); } } } catch (...) { // restore refreshTextAndLabel(); } } } }
void KDoubleSpinBox::setRange( double lower, double upper, double step, int precision ) { lower = kMin(upper, lower); upper = kMax(upper, lower); setPrecision( precision, true ); // disable bounds checking, since setMinValue( lower ); // it's done in set{Min,Max}Value setMaxValue( upper ); // anyway and we want lower, upper setLineStep( step ); // and step to have the right precision }
NP() : np(0.0), secs(0.0) { setSymbol("coggan_np"); setName("NP"); setType(RideMetric::Average); setMetricUnits("watts"); setImperialUnits("watts"); setPrecision(0); }
EfficiencyFactor() : ef(0.0) { setSymbol("friel_efficiency_factor"); setName(tr("Efficiency Factor")); setType(RideMetric::Average); setMetricUnits(tr("")); setImperialUnits(tr("")); setPrecision(3); }
AerobicDecoupling() : percent(0.0) { setSymbol("aerobic_decoupling"); setName(tr("Aerobic Decoupling")); setType(RideMetric::Average); setMetricUnits(tr("%")); setImperialUnits(tr("%")); setPrecision(2); }
void initialize() { setName(tr("Distance Swim")); setType(RideMetric::Total); setMetricUnits(tr("m")); setImperialUnits(tr("yd")); setPrecision(0); setConversion(1.0/METERS_PER_YARD); setDescription(tr("Total Distance in meters or yards")); }
AverageWPK() { setSymbol("average_wpk"); setName(tr("Watts Per Kilogram")); setType(RideMetric::Average); setMetricUnits(tr("wpk")); setImperialUnits(tr("wpk")); setPrecision(1); }
void QgsRendererRangeLabelFormat::setFromDomElement( QDomElement &element ) { mFormat = element.attribute( QStringLiteral( "format" ), element.attribute( QStringLiteral( "prefix" ), QStringLiteral( " " ) ) + "%1" + element.attribute( QStringLiteral( "separator" ), QStringLiteral( " - " ) ) + "%2" + element.attribute( QStringLiteral( "suffix" ), QStringLiteral( " " ) ) ); setPrecision( element.attribute( QStringLiteral( "decimalplaces" ), QStringLiteral( "4" ) ).toInt() ); mTrimTrailingZeroes = element.attribute( QStringLiteral( "trimtrailingzeroes" ), QStringLiteral( "false" ) ) == QLatin1String( "true" ); }
PgSQLType::PgSQLType(unsigned type_id, unsigned length, unsigned dimension, int precision, bool with_timezone, IntervalType interv_type, SpatialType spatial_type) : PgSQLType() { (*this)=type_id; setLength(length); setDimension(dimension); setPrecision(precision); setWithTimezone(with_timezone); setIntervalType(interv_type); setSpatialType(spatial_type); }
MidiVolEntry::MidiVolEntry(QWidget* parent) : FloatEntry(parent) { _max = 127; setRange(-98.0f, 0.0f); setSpecialText(tr("off")); setSuffix(tr("db")); setFrame(true); setPrecision(0); }
PgSQLType::PgSQLType(const QString &type_name, unsigned length, unsigned dimension, int precision, bool with_timezone, IntervalType interv_type, SpatialType spatial_type) { (*this)=type_name; setLength(length); setDimension(dimension); setPrecision(precision); setWithTimezone(with_timezone); setIntervalType(interv_type); setSpatialType(spatial_type); }
void QgsRendererRangeV2LabelFormat::setFromDomElement( QDomElement &element ) { mFormat = element.attribute( "format", element.attribute( "prefix", " " ) + "%1" + element.attribute( "separator", " - " ) + "%2" + element.attribute( "suffix", " " ) ); setPrecision( element.attribute( "decimalplaces", "4" ).toInt() ); mTrimTrailingZeroes = element.attribute( "trimtrailingzeroes", "false" ) == "true"; }
PeakPercent() : maxp(0.0), minp(10000) { setType(RideMetric::Average); setSymbol("peak_percent"); setInternalName("MMP Percentage"); setName(tr("MMP Percentage")); setMetricUnits(tr("%")); setPrecision(1); // e.g. 99.9% setImperialUnits(tr("%")); }
MarginValueWidget::MarginValueWidget(KNumInput *below, double value, QWidget *parent, const char *name) : KDoubleNumInput(below, value, parent, name) { m_mode = Pixels; m_block = false; setPrecision(0); m_dpi = 72.0; m_margin = (float)value; setMode(m_mode); setRange(0, 999, 1, false); connect(this, SIGNAL(valueChanged(double)), SLOT(slotValueChanged(double))); }