本文整理汇总了C++中SpinBox::setValidator方法的典型用法代码示例。如果您正苦于以下问题:C++ SpinBox::setValidator方法的具体用法?C++ SpinBox::setValidator怎么用?C++ SpinBox::setValidator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpinBox
的用法示例。
在下文中一共展示了SpinBox::setValidator方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connectKnobSignalSlots
//.........这里部分代码省略.........
if (nbRows == 1) {
allSpinBoxesContainer = _imp->container;
} else {
allSpinBoxesContainer = new QWidget(_imp->container);
spinBoxesGrid = new QGridLayout(allSpinBoxesContainer);
spinBoxesGrid->setContentsMargins(0, 0, 0, 0);
spinBoxesGrid->setVerticalSpacing(TO_DPIY(1));
spinBoxesGrid->setHorizontalSpacing(TO_DPIX(1));
}
_imp->spinBoxes.resize(nDims);
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);