本文整理汇总了C++中QSlider::minimum方法的典型用法代码示例。如果您正苦于以下问题:C++ QSlider::minimum方法的具体用法?C++ QSlider::minimum怎么用?C++ QSlider::minimum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSlider
的用法示例。
在下文中一共展示了QSlider::minimum方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setChOutRange
/**
Sets the minimum/maximum value of the channel 0 to seven output sliders.
Have to do it here because setMinimum is not a slot.
One added trick: if the slider is at either its max or its min when the value
is changed, then keep it on the max/min.
*/
void ConfigServoWidget::setChOutRange()
{
QSpinBox *spinbox = (QSpinBox*)QObject::sender();
int index = outMin.indexOf(spinbox); // This is the channel number
if (index < 0)
index = outMax.indexOf(spinbox); // We can't know if the signal came from min or max
QSlider *slider = outSliders[index];
int oldMini = slider->minimum();
int oldMaxi = slider->maximum();
if (outMin[index]->value()<outMax[index]->value())
{
slider->setRange(outMin[index]->value(), outMax[index]->value());
reversals[index]->setChecked(false);
}
else
{
slider->setRange(outMax[index]->value(), outMin[index]->value());
reversals[index]->setChecked(true);
}
if (slider->value() == oldMini)
slider->setValue(slider->minimum());
// if (slider->value() == oldMaxi)
// slider->setValue(slider->maximum()); // this can be dangerous if it happens to be controlling a motor at the time!
}
示例2: setLogoRatio
void SettingsWindow::setLogoRatio(int sliderValue)
{
QSlider *slider = reinterpret_cast<QSlider *>(sender());
qreal steps = slider->maximum() - slider->minimum();
qreal ratio = sliderValue / steps;
_settings->setLogoSizeRatio(ratio);
}
示例3: checkLimits
void checkLimits(HI::GUITestOpStatus &os, int minVal, int maxVal){
QSlider* thresholdSlider = qobject_cast<QSlider*>(GTWidget::findWidget(os, "thresholdSlider"));
CHECK_SET_ERR(thresholdSlider != NULL, "thresholdSlider not found");
int actualSliderMin = thresholdSlider->minimum();
int actualSliderMax = thresholdSlider->maximum();
CHECK_SET_ERR(actualSliderMin == minVal, QString("wrong minimal value for slider. Expected: %1, actual: %2").arg(minVal).arg(actualSliderMin));
CHECK_SET_ERR(actualSliderMax == maxVal, QString("wrong maximim value for slider. Expected: %1, actual: %2").arg(maxVal).arg(actualSliderMin));
QSpinBox* thresholdSpinBox = qobject_cast<QSpinBox*>(GTWidget::findWidget(os, "thresholdSpinBox"));
CHECK_SET_ERR(thresholdSpinBox != NULL, "thresholdSpin not found");
int actualSpinMin = thresholdSpinBox->minimum();
int actualSpinMax = thresholdSpinBox->maximum();
CHECK_SET_ERR(actualSpinMin == minVal, QString("wrong minimal value for spin. Expected: %1, actual: %2").arg(minVal).arg(actualSpinMin));
CHECK_SET_ERR(actualSpinMax == maxVal, QString("wrong maximim value for spin. Expected: %1, actual: %2").arg(maxVal).arg(actualSpinMin));
}
示例4: setZoom
void ZoomWidget::setZoom(qreal zoom)
{
int intZoom = qRound(zoom * 100);
d->mZoomLabel->setText(QString("%1%").arg(intZoom));
// Don't change slider value if we come here because the slider change,
// avoids choppy sliding scroll.
if (!d->mZoomUpdatedBySlider) {
QSlider* slider = d->mZoomSlider->slider();
SignalBlocker blocker(slider);
int value = sliderValueForZoom(zoom);
if (value < slider->minimum()) {
// It is possible that we are called *before* setMinimumZoom() as
// been called. In this case, define the minimum ourself.
d->mZoomSlider->setMinimum(value);
}
d->mZoomSlider->setValue(value);
}
}