本文整理汇总了C++中QSpinBox::setDisplayIntegerBase方法的典型用法代码示例。如果您正苦于以下问题:C++ QSpinBox::setDisplayIntegerBase方法的具体用法?C++ QSpinBox::setDisplayIntegerBase怎么用?C++ QSpinBox::setDisplayIntegerBase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSpinBox
的用法示例。
在下文中一共展示了QSpinBox::setDisplayIntegerBase方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createSpinBoxes
void Window::createSpinBoxes() {
/// \brief spinBoxesGroup
///
/// spinBoxesGroup is used to contains spinBox.
///
spinBoxesGroup = new QGroupBox(tr("Spinboxes"));
QLabel *integerLabel =
new QLabel(tr("Enter a value between %1 and %2:").arg(0).arg(1000));
QSpinBox *integerSpinBox = new QSpinBox;
integerSpinBox->setRange(-20, 20);
integerSpinBox->setSingleStep(1);
integerSpinBox->setValue(0);
QLabel *zoomLabel =
new QLabel(tr("Enter a zoom value between %1 and %2:").arg(0).arg(1000));
QSpinBox *zoomSpinBox = new QSpinBox;
zoomSpinBox->setRange(0, 1000);
zoomSpinBox->setSingleStep(10);
zoomSpinBox->setSuffix("%"); ///< a suffix
zoomSpinBox->setSpecialValueText(tr("Automatic"));
zoomSpinBox->setValue(100);
QLabel *priceLabel =
new QLabel(tr("Enter a price between %1 and %2:").arg(0).arg(999));
QSpinBox *priceSpinBox = new QSpinBox;
priceSpinBox->setRange(0, 999);
priceSpinBox->setPrefix("$");
priceSpinBox->setValue(99);
QLabel *hexLabel = new QLabel(tr("Enter a value between %1 and %2:")
.arg('-' + QString::number(31, 16))
.arg(QString::number(31, 16)));
QSpinBox *hexSpinBox = new QSpinBox;
hexSpinBox->setRange(-31, 31);
hexSpinBox->setSingleStep(1);
hexSpinBox->setDisplayIntegerBase(16);
groupSeparatorSpinBox = new QSpinBox;
groupSeparatorSpinBox->setRange(-9999999, 9999999);
groupSeparatorSpinBox->setValue(1000);
groupSeparatorSpinBox->setGroupSeparatorShown(true);
QCheckBox *groupSeparatorChkBox = new QCheckBox;
groupSeparatorChkBox->setText(tr("Show group separator"));
groupSeparatorChkBox->setChecked(true);
connect(groupSeparatorChkBox, &QCheckBox::toggled, groupSeparatorSpinBox,
&QSpinBox::setGroupSeparatorShown);
QVBoxLayout *spinBoxLayout = new QVBoxLayout;
spinBoxLayout->addWidget(integerLabel);
spinBoxLayout->addWidget(integerSpinBox);
spinBoxLayout->addWidget(zoomLabel);
spinBoxLayout->addWidget(zoomSpinBox);
spinBoxLayout->addWidget(priceLabel);
spinBoxLayout->addWidget(priceSpinBox);
spinBoxLayout->addWidget(hexLabel);
spinBoxLayout->addWidget(hexSpinBox);
spinBoxLayout->addWidget(groupSeparatorChkBox);
spinBoxLayout->addWidget(groupSeparatorSpinBox);
spinBoxesGroup->setLayout(spinBoxLayout);
}