本文整理汇总了C++中setRange函数的典型用法代码示例。如果您正苦于以下问题:C++ setRange函数的具体用法?C++ setRange怎么用?C++ setRange使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setRange函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QSpinBox
PitchEdit::PitchEdit(QWidget* parent)
: QSpinBox(parent)
{
setRange(0, 127);
deltaMode = false;
}
示例2: switch
Item::e_sercode Item::deserialize( Stream *file, VMachine *vm )
{
byte type = FLC_ITEM_NIL;
if ( file->read((byte *) &type, 1 ) == 0 )
return sc_eof;
if( ! file->good() )
return sc_ferror;
switch( type )
{
case FLC_ITEM_NIL:
setNil();
return sc_ok;
case FLC_ITEM_UNB:
setUnbound();
return sc_ok;
case FLC_ITEM_BOOL:
{
byte bval;
file->read( (byte *) &bval, sizeof( bval ) );
if ( file->good() ) {
setBoolean( bval != 0 );
return sc_ok;
}
return sc_ferror;
}
return sc_ok;
case FLC_ITEM_INT:
{
int64 val;
file->read( (byte *) &val, sizeof( val ) );
if ( file->good() ) {
setInteger(endianInt64(val) );
return sc_ok;
}
return sc_ferror;
}
break;
case FLC_ITEM_RANGE:
{
int64 val1;
int64 val2;
int64 val3;
//byte isOpen;
file->read( (byte *) &val1, sizeof( val1 ) );
file->read( (byte *) &val2, sizeof( val2 ) );
file->read( (byte *) &val3, sizeof( val3 ) );
//file->read( (byte *) &isOpen, sizeof( isOpen ) );
val1 = endianInt64( val1 );
val2 = endianInt64( val2 );
val3 = endianInt64( val3 );
if ( file->good() ) {
setRange( new CoreRange( val1, val2, val3 ) );
return sc_ok;
}
return sc_ferror;
}
break;
case FLC_ITEM_NUM:
{
numeric val;
file->read( (byte *) &val, sizeof( val ) );
if ( file->good() ) {
setNumeric( endianNum( val ) );
return sc_ok;
}
return sc_ferror;
}
break;
case FLC_ITEM_LBIND:
{
int32 id;
file->read( (byte*) &id, sizeof(id) );
String name;
if ( ! name.deserialize( file ) )
return file->bad() ? sc_ferror : sc_invformat;
setLBind( new CoreString( name ) );
}
break;
case FLC_ITEM_STRING:
{
CoreString *cs = new CoreString;
setString( cs );
if ( ! cs->deserialize( file ) )
{
return file->bad() ? sc_ferror : sc_invformat;
}
//.........这里部分代码省略.........
示例3: checkAltitude
//! Check current water column.
void
checkAltitude(void)
{
if (m_estate.alt > c_min_alt)
setRange((unsigned)(m_estate.alt * m_args.range_modifier_mul_k + m_args.range_modifier_add_k));
}
示例4: QDialog
SequenceDialog::SequenceDialog(QWidget *parent, capture_file *cf, SequenceType type) :
QDialog(parent),
ui(new Ui::SequenceDialog),
cap_file_(cf),
num_items_(0),
packet_num_(0),
node_label_w_(20)
{
ui->setupUi(this);
QCustomPlot *sp = ui->sequencePlot;
seq_diagram_ = new SequenceDiagram(sp->yAxis, sp->xAxis2, sp->yAxis2);
sp->addPlottable(seq_diagram_);
sp->axisRect()->setRangeDragAxes(sp->xAxis2, sp->yAxis);
sp->xAxis->setVisible(false);
sp->xAxis->setPadding(0);
sp->xAxis->setLabelPadding(0);
sp->xAxis->setTickLabelPadding(0);
sp->xAxis2->setVisible(true);
sp->yAxis2->setVisible(true);
one_em_ = QFontMetrics(sp->yAxis->labelFont()).height();
ui->horizontalScrollBar->setSingleStep(100 / one_em_);
ui->verticalScrollBar->setSingleStep(100 / one_em_);
sp->setInteractions(QCP::iRangeDrag);
ui->gridLayout->setSpacing(0);
connect(sp->yAxis, SIGNAL(rangeChanged(QCPRange)), sp->yAxis2, SLOT(setRange(QCPRange)));
ctx_menu_.addAction(ui->actionReset);
ctx_menu_.addSeparator();
ctx_menu_.addAction(ui->actionMoveRight10);
ctx_menu_.addAction(ui->actionMoveLeft10);
ctx_menu_.addAction(ui->actionMoveUp10);
ctx_menu_.addAction(ui->actionMoveDown10);
ctx_menu_.addAction(ui->actionMoveRight1);
ctx_menu_.addAction(ui->actionMoveLeft1);
ctx_menu_.addAction(ui->actionMoveUp1);
ctx_menu_.addAction(ui->actionMoveDown1);
ctx_menu_.addSeparator();
ctx_menu_.addAction(ui->actionGoToPacket);
memset (&seq_analysis_, 0, sizeof(seq_analysis_));
ui->showComboBox->blockSignals(true);
ui->showComboBox->setCurrentIndex(0);
ui->showComboBox->blockSignals(false);
ui->addressComboBox->blockSignals(true);
ui->addressComboBox->setCurrentIndex(0);
ui->addressComboBox->blockSignals(false);
QComboBox *fcb = ui->flowComboBox;
fcb->addItem(ui->actionFlowAny->text(), SEQ_ANALYSIS_ANY);
fcb->addItem(ui->actionFlowTcp->text(), SEQ_ANALYSIS_TCP);
ui->flowComboBox->blockSignals(true);
switch (type) {
case any:
seq_analysis_.type = SEQ_ANALYSIS_ANY;
ui->flowComboBox->setCurrentIndex(SEQ_ANALYSIS_ANY);
break;
case tcp:
seq_analysis_.type = SEQ_ANALYSIS_TCP;
ui->flowComboBox->setCurrentIndex(SEQ_ANALYSIS_TCP);
break;
case voip:
seq_analysis_.type = SEQ_ANALYSIS_VOIP;
ui->flowComboBox->hide();
ui->flowLabel->hide();
break;
}
ui->flowComboBox->blockSignals(false);
seq_analysis_.all_packets = TRUE;
QPushButton *save_bt = ui->buttonBox->button(QDialogButtonBox::Save);
save_bt->setText(tr("Save As..."));
// XXX Use recent settings instead
if (parent) {
resize(parent->width(), parent->height() * 4 / 5);
}
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(hScrollBarChanged(int)));
connect(ui->verticalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(vScrollBarChanged(int)));
connect(sp->xAxis2, SIGNAL(rangeChanged(QCPRange)), this, SLOT(xAxisChanged(QCPRange)));
connect(sp->yAxis, SIGNAL(rangeChanged(QCPRange)), this, SLOT(yAxisChanged(QCPRange)));
connect(sp, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(diagramClicked(QMouseEvent*)));
connect(sp, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(mouseMoved(QMouseEvent*)));
connect(sp, SIGNAL(mouseRelease(QMouseEvent*)), this, SLOT(mouseReleased(QMouseEvent*)));
connect(this, SIGNAL(goToPacket(int)), seq_diagram_, SLOT(setSelectedPacket(int)));
disconnect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
fillDiagram();
}
示例5: getAddress
/** Called when asyn clients call pasynInt32->write().
* \param[in] pasynUser pasynUser structure that encodes the reason and address.
* \param[in] value Value to write. */
asynStatus drvQuadEM::writeInt32(asynUser *pasynUser, epicsInt32 value)
{
int function = pasynUser->reason;
int status = asynSuccess;
int channel;
const char *paramName;
const char* functionName = "writeInt32";
getAddress(pasynUser, &channel);
/* Set the parameter in the parameter library. */
status |= setIntegerParam(channel, function, value);
/* Fetch the parameter string name for possible use in debugging */
getParamName(function, ¶mName);
if (function == P_Acquire) {
if (value) {
epicsRingBytesFlush(ringBuffer_);
ringCount_ = 0;
}
status |= setAcquire(value);
}
else if (function == P_AcquireMode) {
if (value != QEAcquireModeContinuous) {
status |= setAcquire(0);
setIntegerParam(P_Acquire, 0);
}
status |= setAcquireMode(value);
status |= readStatus();
}
else if (function == P_BiasState) {
status |= setBiasState(value);
status |= readStatus();
}
else if (function == P_BiasInterlock) {
status |= setBiasInterlock(value);
status |= readStatus();
}
else if (function == P_NumChannels) {
status |= setNumChannels(value);
status |= readStatus();
}
else if (function == P_NumAcquire) {
status |= setNumAcquire(value);
status |= readStatus();
}
else if (function == P_PingPong) {
status |= setPingPong(value);
status |= readStatus();
}
else if (function == P_Range) {
status |= setRange(value);
status |= readStatus();
}
else if (function == P_ReadData) {
status |= doDataCallbacks();
}
else if (function == P_Resolution) {
status |= setResolution(value);
status |= readStatus();
}
else if (function == P_TriggerMode) {
status |= setTriggerMode(value);
status |= readStatus();
}
else if (function == P_ValuesPerRead) {
valuesPerRead_ = value;
status |= setValuesPerRead(value);
status |= readStatus();
}
else if (function == P_ReadFormat) {
status |= setReadFormat(value);
status |= readStatus();
}
else if (function == P_ReadStatus) {
// We don't do this if we are acquiring, too disruptive
if (!acquiring_) {
status |= readStatus();
}
}
else if (function == P_Reset) {
status |= reset();
status |= readStatus();
}
else {
/* All other parameters just get set in parameter list, no need to
* act on them here */
}
/* Do callbacks so higher layers see any changes */
status |= (asynStatus) callParamCallbacks();
if (status)
epicsSnprintf(pasynUser->errorMessage, pasynUser->errorMessageSize,
"%s:%s: status=%d, function=%d, name=%s, value=%d",
driverName, functionName, status, function, paramName, value);
//.........这里部分代码省略.........
示例6: setRange
/*!
A convenience function which just calls
setRange( i, maxValue() )
\sa setRange()
*/
void QSlider::setMinValue( int i )
{
setRange( i, maxValue() );
}
示例7: copy
/**
* Copies the contents of fromMsg to the contents of toMsg. Both must be
* instances of LinkMessage. The toLink object must be an instance of Link.
* It's filled in if the contents of fromMsg are a Link. Returns KNI_TRUE if
* successful, otherwise KNI_FALSE.
*/
static jboolean
copy(jobject fromMsg, jobject toMsg, jobject toLink) {
jboolean retval;
KNI_StartHandles(6);
KNI_DeclareHandle(byteArrayClass);
KNI_DeclareHandle(stringClass);
KNI_DeclareHandle(linkClass);
KNI_DeclareHandle(fromContents);
KNI_DeclareHandle(newString);
KNI_DeclareHandle(newByteArray);
KNI_FindClass("[B", byteArrayClass);
KNI_FindClass("java/lang/String", stringClass);
KNI_FindClass("com/sun/midp/links/Link", linkClass);
getContents(fromMsg, fromContents);
if (KNI_IsInstanceOf(fromContents, byteArrayClass)) {
/* do a byte array copy */
jint fromOffset;
jint fromLength;
getRange(fromMsg, &fromOffset, &fromLength);
SNI_NewArray(SNI_BYTE_ARRAY, fromLength, newByteArray);
if (KNI_IsNullHandle(newByteArray)) {
retval = KNI_FALSE;
} else {
KNI_GetRawArrayRegion(fromContents, fromOffset, fromLength,
SNI_GetRawArrayPointer(newByteArray));
setContents(toMsg, newByteArray);
setRange(toMsg, 0, fromLength);
retval = KNI_TRUE;
}
} else if (KNI_IsInstanceOf(fromContents, stringClass)) {
/* do a string copy */
jchar *buf;
jsize slen = KNI_GetStringLength(fromContents);
SNI_NewArray(SNI_BYTE_ARRAY, slen*sizeof(jchar), newByteArray);
if (KNI_IsNullHandle(newByteArray)) {
retval = KNI_FALSE;
} else {
buf = SNI_GetRawArrayPointer(newByteArray);
KNI_GetStringRegion(fromContents, 0, slen, buf);
KNI_NewString(buf, slen, newString);
setContents(toMsg, newString);
retval = KNI_TRUE;
}
} else if (KNI_IsInstanceOf(fromContents, linkClass)) {
/* copy the link */
rendezvous *rp = getNativePointer(fromContents);
setNativePointer(toLink, rp);
rp_incref(rp);
setContents(toMsg, toLink);
retval = KNI_TRUE;
} else {
retval = KNI_FALSE;
}
KNI_EndHandles();
return retval;
}
示例8: setRange
Palette::Palette(const Color &base, double imin, double imax)
{
setRange(imin,imax);
setColor(imin,base);
setColor(imax,base);
}
示例9: WiresharkDialog
SequenceDialog::SequenceDialog(QWidget &parent, CaptureFile &cf, seq_analysis_info_t *sainfo) :
WiresharkDialog(parent, cf),
ui(new Ui::SequenceDialog),
sainfo_(sainfo),
num_items_(0),
packet_num_(0),
node_label_w_(20)
{
ui->setupUi(this);
QCustomPlot *sp = ui->sequencePlot;
setWindowSubtitle(sainfo ? tr("Call Flow") : tr("Flow"));
if (!sainfo_) {
sainfo_ = sequence_analysis_info_new();
sainfo_->type = SEQ_ANALYSIS_ANY;
sainfo_->all_packets = TRUE;
} else {
num_items_ = sequence_analysis_get_nodes(sainfo_);
}
seq_diagram_ = new SequenceDiagram(sp->yAxis, sp->xAxis2, sp->yAxis2);
sp->addPlottable(seq_diagram_);
sp->axisRect()->setRangeDragAxes(sp->xAxis2, sp->yAxis);
sp->xAxis->setVisible(false);
sp->xAxis->setPadding(0);
sp->xAxis->setLabelPadding(0);
sp->xAxis->setTickLabelPadding(0);
sp->xAxis2->setVisible(true);
sp->yAxis2->setVisible(true);
one_em_ = QFontMetrics(sp->yAxis->labelFont()).height();
ui->horizontalScrollBar->setSingleStep(100 / one_em_);
ui->verticalScrollBar->setSingleStep(100 / one_em_);
sp->setInteractions(QCP::iRangeDrag);
ui->gridLayout->setSpacing(0);
connect(sp->yAxis, SIGNAL(rangeChanged(QCPRange)), sp->yAxis2, SLOT(setRange(QCPRange)));
ctx_menu_.addAction(ui->actionReset);
ctx_menu_.addSeparator();
ctx_menu_.addAction(ui->actionMoveRight10);
ctx_menu_.addAction(ui->actionMoveLeft10);
ctx_menu_.addAction(ui->actionMoveUp10);
ctx_menu_.addAction(ui->actionMoveDown10);
ctx_menu_.addAction(ui->actionMoveRight1);
ctx_menu_.addAction(ui->actionMoveLeft1);
ctx_menu_.addAction(ui->actionMoveUp1);
ctx_menu_.addAction(ui->actionMoveDown1);
ctx_menu_.addSeparator();
ctx_menu_.addAction(ui->actionGoToPacket);
ui->showComboBox->blockSignals(true);
ui->showComboBox->setCurrentIndex(0);
ui->showComboBox->blockSignals(false);
ui->addressComboBox->blockSignals(true);
ui->addressComboBox->setCurrentIndex(0);
ui->addressComboBox->blockSignals(false);
QComboBox *fcb = ui->flowComboBox;
fcb->addItem(ui->actionFlowAny->text(), SEQ_ANALYSIS_ANY);
fcb->addItem(ui->actionFlowTcp->text(), SEQ_ANALYSIS_TCP);
ui->flowComboBox->blockSignals(true);
ui->flowComboBox->setCurrentIndex(sainfo_->type);
if (sainfo_->type == SEQ_ANALYSIS_VOIP) {
ui->controlFrame->hide();
} else {
ui->flowComboBox->blockSignals(false);
}
QPushButton *save_bt = ui->buttonBox->button(QDialogButtonBox::Save);
save_bt->setText(tr("Save As..."));
// XXX Use recent settings instead
resize(parent.width(), parent.height() * 4 / 5);
connect(ui->horizontalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(hScrollBarChanged(int)));
connect(ui->verticalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(vScrollBarChanged(int)));
connect(sp->xAxis2, SIGNAL(rangeChanged(QCPRange)), this, SLOT(xAxisChanged(QCPRange)));
connect(sp->yAxis, SIGNAL(rangeChanged(QCPRange)), this, SLOT(yAxisChanged(QCPRange)));
connect(sp, SIGNAL(mousePress(QMouseEvent*)), this, SLOT(diagramClicked(QMouseEvent*)));
connect(sp, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(mouseMoved(QMouseEvent*)));
connect(sp, SIGNAL(mouseRelease(QMouseEvent*)), this, SLOT(mouseReleased(QMouseEvent*)));
connect(this, SIGNAL(goToPacket(int)), seq_diagram_, SLOT(setSelectedPacket(int)));
disconnect(ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
fillDiagram();
}
示例10: setRange
void QRoundProgressBar::setMaximun(double max)
{
setRange(m_min, max);
}
示例11: setRange
void Deadband::setRange(double lower, double upper) {
setRange(lower, upper, (lower + upper) / 2);
}
示例12: setRange
void XIntegrationControl::setWholeRange() {
setRange(m_totalMinimum, m_totalMaximum);
}
示例13: maxValue
/*!
Set the maximum value.
\param max Maximum value
\sa maxValue(), setMinValue()
*/
void QwtThermo::setMaxValue(double max)
{
setRange(d_data->minValue, max);
}
示例14: QMainWindow
/*****************************************************************************
* Function Name: MainWindow()
******************************************************************************
* Summary:
* Create and initialize every items used by the main window.
*
* Parameters:
* Parent.
*
* Return:
* Address of the new MainWindow.
*
* Note:
* Using a Model-Controller-View approach.
*
*****************************************************************************/
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
// Create the controller
try {
controller = new MV_Controller(this);
}
catch(int e) {
throw e;
}
// .ui form
ui->setupUi(this);
// Window title
this->setWindowTitle("CapSense data acquisition");
// COMBOBOX: Characteristic selection
for (int i = 0; i < controller->getNumServices(); i++) {
for (int j = 0; j < controller->getNumCharacteristics(i); j++) {
if ( !controller->isCharacteristicNameEmpty(i, j) )
ui->characteristicSelection->addItem(controller->getCharacteristicName(i, j),
qVariantFromValue((void *)controller->getCharacteristicAddress(i, j)));
}
}
if (ui->characteristicSelection->count() > 0)
controller->setCurrChar( (Characteristic *)ui->characteristicSelection->currentData().value<void *>() );
// PUSH BUTTON: Start acquisition
ui->startAcquisition->setEnabled(false);
// PUSH BUTTON: Stop acquisition
ui->stopAcquisition->setEnabled(false);
// PUSH BUTTON: Download data
ui->downloadData->setEnabled(false);
// PUSH BUTTON: Clear
if (ui->characteristicSelection->count() > 0)
ui->clear->setEnabled(true);
// LCD NUMBER: Elapsed time (acquisition)
lcdTimer = new QLabel;
timerAcquisition = new QTimer();
timerAcquisition->setInterval(1000);
connect(timerAcquisition, SIGNAL(timeout()), this, SLOT(setLCD()));
timerSending = new QTime();
lcdTimer->setText("Acquisition: 00:00.000\tSending: 00:00:000");
ui->statusBar->addWidget(lcdTimer);
// LABELS: Status
ui->Ind_Ready_Acq->setVisible(false);
ui->Ind_Acq->setVisible(false);
ui->Ind_Ready_Send->setVisible(false);
ui->Ind_Send->setVisible(false);
// PROGRESS BARS: Sensors' last values
int max = 0xFFFF;
ui->sensor0->setRange(0, max);
ui->sensor0->setValue(0);
ui->value_sensor0->setText(QString::number(0));
ui->sensor1->setRange(0, max);
ui->sensor1->setValue(0);
ui->value_sensor1->setText(QString::number(0));
ui->sensor2->setRange(0, max);
ui->sensor2->setValue(0);
ui->value_sensor2->setText(QString::number(0));
ui->sensor3->setRange(0, max);
ui->sensor3->setValue(0);
ui->value_sensor3->setText(QString::number(0));
ui->sensor4->setRange(0, max);
ui->sensor4->setValue(0);
ui->value_sensor4->setText(QString::number(0));
ui->sensor5->setRange(0, max);
//.........这里部分代码省略.........
示例15: minValue
/*!
Set the minimum value.
\param min Minimum value
\sa minValue(), setMaxValue()
*/
void QwtThermo::setMinValue(double min)
{
setRange(min, d_data->maxValue);
}