本文整理汇总了C++中SpinBox::setMinimum方法的典型用法代码示例。如果您正苦于以下问题:C++ SpinBox::setMinimum方法的具体用法?C++ SpinBox::setMinimum怎么用?C++ SpinBox::setMinimum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpinBox
的用法示例。
在下文中一共展示了SpinBox::setMinimum方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Label
QWidget*
TableItemEditorFactory::createEditor(QVariant::Type type,
QWidget *parent) const
{
switch (type) {
case QVariant::UInt: {
SpinBox *sb = new SpinBox(parent, SpinBox::eSpinBoxTypeInt);
sb->setFrame(false);
sb->setMaximum(INT_MAX);
return sb;
}
case QVariant::Int: {
SpinBox *sb = new SpinBox(parent, SpinBox::eSpinBoxTypeInt);
sb->setFrame(false);
sb->setMinimum(INT_MIN);
sb->setMaximum(INT_MAX);
return sb;
}
case QVariant::Pixmap:
return new Label(parent);
case QVariant::Double: {
SpinBox *sb = new SpinBox(parent, SpinBox::eSpinBoxTypeDouble);
sb->setFrame(false);
sb->setMinimum(-DBL_MAX);
sb->setMaximum(DBL_MAX);
return sb;
}
case QVariant::String:
default: {
// the default editor is a lineedit
ExpandingLineEdit *le = new ExpandingLineEdit(parent);
le->setFrame( le->style()->styleHint(QStyle::SH_ItemView_DrawDelegateFrame, 0, le) );
if ( !le->style()->styleHint(QStyle::SH_ItemView_ShowDecorationSelected, 0, le) ) {
le->setWidgetOwnsGeometry(true);
}
return le;
}
}
return 0;
}
示例2: connectKnobSignalSlots
//.........这里部分代码省略.........
int rowIndex = 0;
int columnIndex = 0;
for (std::size_t i = 0; i < _imp->spinBoxes.size(); ++i) {
QWidget *boxContainer = new QWidget(allSpinBoxesContainer);
boxContainer->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
QHBoxLayout *boxContainerLayout = 0;
boxContainerLayout = new QHBoxLayout(boxContainer);
boxContainerLayout->setContentsMargins(0, 0, 0, 0);
boxContainerLayout->setSpacing(3);
Label *subDesc = 0;
if (nDims != 1 && nbRows == 1) {
subDesc = new Label(QString::fromUtf8(dimensionLabels[i].c_str()), boxContainer);
boxContainerLayout->addWidget(subDesc);
}
SpinBox *box = new KnobSpinBox(layout->parentWidget(), type, thisShared , i);
NumericKnobValidator* validator = new NumericKnobValidator(box,thisShared);
box->setValidator(validator);
QObject::connect( box, SIGNAL(valueChanged(double)), this, SLOT(onSpinBoxValueChanged()) );
// Set the copy/link actions in the right click menu of the SpinBox
enableRightClickMenu(box,i);
#ifdef SPINBOX_TAKE_PLUGIN_RANGE_INTO_ACCOUNT
double min = mins[i];
double max = maxs[i];
valueAccordingToType(false, i, &min);
valueAccordingToType(false, i, &max);
box->setMaximum(max);
box->setMinimum(min);
#endif
if (type == SpinBox::eSpinBoxTypeDouble) {
// Set the number of digits after the decimal point
if (i < decimals.size()) {
box->decimals(decimals[i]);
}
}
if (i < increments.size()) {
double incr = 1;
incr = increments[i];
valueAccordingToType(false, i, &incr);
box->setIncrement(incr);
}
boxContainerLayout->addWidget(box);
if (!spinBoxesGrid) {
containerLayout->addWidget(boxContainer);
} else {
spinBoxesGrid->addWidget(boxContainer, rowIndex, columnIndex);
}
_imp->spinBoxes[i] = std::make_pair(box, subDesc);
++columnIndex;
if (columnIndex >= nItemsPerRow) {
columnIndex = 0;
++rowIndex;
}
}
示例3: addTableRow
void MultiInstancePanelPrivate::addTableRow(Node* node)
{
int newRowIndex = table->rowCount();
table->insertRow(newRowIndex);
std::list<boost::shared_ptr<KnobI> > instanceSpecificKnobs;
getInstanceSpecificKnobs(node, &instanceSpecificKnobs);
///first add the enabled column
{
QWidget* enabledContainer = createCheckBoxForTable(true);
table->setCellWidget(newRowIndex, 0, enabledContainer);
}
int columnIndex = 1;
for (std::list<boost::shared_ptr<KnobI> >::iterator it = instanceSpecificKnobs.begin();it!=instanceSpecificKnobs.end();++it) {
Int_Knob* isInt = dynamic_cast<Int_Knob*>(it->get());
Bool_Knob* isBool = dynamic_cast<Bool_Knob*>(it->get());
Double_Knob* isDouble = dynamic_cast<Double_Knob*>(it->get());
Color_Knob* isColor = dynamic_cast<Color_Knob*>(it->get());
String_Knob* isString = dynamic_cast<String_Knob*>(it->get());
if (!isInt || !isBool || !isDouble || !isColor || !isString) {
continue;
}
bool createCheckBox = false;
bool createSpinBox = false;
if (isBool) {
createCheckBox = true;
} else if (isInt || isDouble || isColor) {
createSpinBox = true;
}
for (int i = 0; i < (*it)->getDimension(); ++it) {
if (createCheckBox) {
assert(isBool);
bool checked = isBool->getValue();
QWidget* enabledContainer = createCheckBoxForTable(checked);
table->setCellWidget(newRowIndex, columnIndex, enabledContainer);
} else if (createSpinBox) {
double mini = INT_MIN,maxi = INT_MAX;
SpinBox::SPINBOX_TYPE type = SpinBox::DOUBLE_SPINBOX;
if (isInt) {
mini = isInt->getMinimums()[i];
maxi = isInt->getMaximums()[i];
type = SpinBox::INT_SPINBOX;
} else if (isDouble) {
mini = isDouble->getMinimums()[i];
maxi = isDouble->getMaximums()[i];
}
SpinBox* sb = new SpinBox(NULL,type);
sb->setMinimum(mini);
sb->setMaximum(maxi);
table->setCellWidget(newRowIndex, columnIndex, sb);
} else {
assert(isString);
std::string value = isString->getValue();
LineEdit* le = new LineEdit(NULL);
le->setText(value.c_str());
table->setCellWidget(newRowIndex, columnIndex, le);
}
++columnIndex;
}
}
}