本文整理汇总了C++中QSlider::maximum方法的典型用法代码示例。如果您正苦于以下问题:C++ QSlider::maximum方法的具体用法?C++ QSlider::maximum怎么用?C++ QSlider::maximum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSlider
的用法示例。
在下文中一共展示了QSlider::maximum方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setValue
void RenderingItem::setValue(QVariant new_value)
{
if(value == new_value)
return;
value = new_value;
if(!GUI)
return;
if(QString(GUI->metaObject()->className()) == "QSlider")
{
QSlider *slider = (QSlider*)GUI;
if(slider->maximum() == 10) // int
slider->setValue(new_value.toInt());
else
slider->setValue(new_value.toFloat()*5.0);
}
if(QString(GUI->metaObject()->className()) == "QColorToolButton")
{
((QColorToolButton*)GUI)->setColor(new_value.toInt());
}
if(QString(GUI->metaObject()->className()) == "QDoubleSpinBox")
{
((QDoubleSpinBox*)GUI)->setValue(new_value.toFloat());
}
if(QString(GUI->metaObject()->className()) == "QSpinBox")
{
((QSpinBox*)GUI)->setValue(new_value.toInt());
}
if(QString(GUI->metaObject()->className()) == "QComboBox")
{
((QComboBox*)GUI)->setCurrentIndex(new_value.toInt());
}
}
示例2: 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!
}
示例3: 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);
}
示例4: 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));
}