本文整理汇总了C++中SpinBox::decimals方法的典型用法代码示例。如果您正苦于以下问题:C++ SpinBox::decimals方法的具体用法?C++ SpinBox::decimals怎么用?C++ SpinBox::decimals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SpinBox
的用法示例。
在下文中一共展示了SpinBox::decimals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connectKnobSignalSlots
void
KnobGuiValue::createWidget(QHBoxLayout* layout)
{
connectKnobSignalSlots();
_imp->container = new QWidget(layout->parentWidget());
QHBoxLayout *containerLayout = new QHBoxLayout(_imp->container);
layout->addWidget(_imp->container);
containerLayout->setContentsMargins(0, 0, 0, 0);
containerLayout->setSpacing(3);
if (getKnobsCountOnSameLine() > 1) {
disableSlider();
}
if (!isSliderDisabled()) {
layout->parentWidget()->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed);
}
KnobPtr knob = _imp->getKnob();
const int nDims = knob->getDimension();
std::vector<double> increments, displayMins, displayMaxs, mins, maxs;
std::vector<int> decimals;
boost::shared_ptr<Knob<double> > doubleKnob = _imp->getKnobAsDouble();
boost::shared_ptr<Knob<int> > intKnob = _imp->getKnobAsInt();
if (doubleKnob) {
displayMins = doubleKnob->getDisplayMinimums();
displayMaxs = doubleKnob->getDisplayMaximums();
mins = doubleKnob->getMinimums();
maxs = doubleKnob->getMaximums();
} else {
const std::vector<int>& intDmins = intKnob->getDisplayMinimums();
const std::vector<int>& intDMaxs = intKnob->getDisplayMaximums();
const std::vector<int>& intMins = intKnob->getMinimums();
const std::vector<int>& intMaxs = intKnob->getMaximums();
assert(intDMaxs.size() == intDmins.size() && intDmins.size() == intMins.size() && intMins.size() == intMaxs.size());
displayMins.resize(intDmins.size());
displayMaxs.resize(intDmins.size());
mins.resize(intDmins.size());
maxs.resize(intDmins.size());
for (std::size_t i = 0; i < intMins.size(); ++i) {
displayMins[i] = intDmins[i];
displayMaxs[i] = intDMaxs[i];
mins[i] = intMins[i];
maxs[i] = intMaxs[i];
}
}
getIncrements(&increments);
getDecimals(&decimals);
std::vector<std::string> dimensionLabels(nDims);
bool isRectangleParam = isRectangleType();
// This is a rectangle parameter
if (isRectangleParam) {
dimensionLabels[0] = "x";
dimensionLabels[1] = "y";
dimensionLabels[2] = "w";
dimensionLabels[3] = "h";
} else {
for (int i = 0; i < nDims; ++i) {
dimensionLabels[i] = knob->getDimensionName(i);
}
}
KnobGuiPtr thisShared = shared_from_this();
SpinBox::SpinBoxTypeEnum type;
if (doubleKnob) {
type = SpinBox::eSpinBoxTypeDouble;
} else {
type = SpinBox::eSpinBoxTypeInt;
}
int nItemsPerRow = nDims;
if (std::floor(nDims / 3. + 0.5) == nDims / 3.) {
nItemsPerRow = 3;
}
if (std::floor(nDims / 4. + 0.5) == nDims / 4.) {
nItemsPerRow = 4;
}
int nbRows = nDims / nItemsPerRow;
assert(nbRows >= 1);
QWidget* allSpinBoxesContainer = 0;
QGridLayout* spinBoxesGrid = 0;
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));
//.........这里部分代码省略.........