本文整理汇总了C++中QSpinBox::setSpecialValueText方法的典型用法代码示例。如果您正苦于以下问题:C++ QSpinBox::setSpecialValueText方法的具体用法?C++ QSpinBox::setSpecialValueText怎么用?C++ QSpinBox::setSpecialValueText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSpinBox
的用法示例。
在下文中一共展示了QSpinBox::setSpecialValueText方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createSpinBoxes
//! [1]
void Window::createSpinBoxes()
{
spinBoxesGroup = new QGroupBox(tr("Spinboxes"));
QLabel *integerLabel = new QLabel(tr("Enter a value between "
"%1 and %2:").arg(-20).arg(20));
QSpinBox *integerSpinBox = new QSpinBox;
integerSpinBox->setRange(-20, 20);
integerSpinBox->setSingleStep(1);
integerSpinBox->setValue(0);
//! [1]
//! [2]
QLabel *zoomLabel = new QLabel(tr("Enter a zoom value between "
"%1 and %2:").arg(0).arg(1000));
//! [3]
QSpinBox *zoomSpinBox = new QSpinBox;
zoomSpinBox->setRange(0, 1000);
zoomSpinBox->setSingleStep(10);
zoomSpinBox->setSuffix("%");
zoomSpinBox->setSpecialValueText(tr("Automatic"));
zoomSpinBox->setValue(100);
//! [2] //! [3]
//! [4]
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->setSingleStep(1);
priceSpinBox->setPrefix("$");
priceSpinBox->setValue(99);
//! [4] //! [5]
QVBoxLayout *spinBoxLayout = new QVBoxLayout;
spinBoxLayout->addWidget(integerLabel);
spinBoxLayout->addWidget(integerSpinBox);
spinBoxLayout->addWidget(zoomLabel);
spinBoxLayout->addWidget(zoomSpinBox);
spinBoxLayout->addWidget(priceLabel);
spinBoxLayout->addWidget(priceSpinBox);
spinBoxesGroup->setLayout(spinBoxLayout);
}
示例2: QueryPage
QueryPage:: QueryPage(QWidget *parent)
: QWidget(parent)
{
QGroupBox *packagesGroup = new QGroupBox("Look for packages");
QLabel *nameLabel = new QLabel("Name:");
QLineEdit *nameLineEdit = new QLineEdit;
QLabel *dateLabel = new QLabel("Released after:");
QDateTimeEdit *dateEdit = new QDateTimeEdit(QDate::currentDate());
QCheckBox *releaseCheckBox = new QCheckBox("Releases");
QCheckBox *upgradesCheckBox = new QCheckBox("Upgrades");
QSpinBox *hitsSpinBox = new QSpinBox;
hitsSpinBox->setPrefix("Return up to");
hitsSpinBox->setSuffix(" results");
hitsSpinBox->setSpecialValueText("Return only the first result");
hitsSpinBox->setMinimum(1);
hitsSpinBox->setMaximum(100);
hitsSpinBox->setSingleStep(10);
QPushButton *startQueryButton = new QPushButton("Start query");
QGridLayout *packagesLayout = new QGridLayout;
packagesLayout->addWidget(nameLabel, 0, 0);
packagesLayout->addWidget(nameLineEdit, 0, 1);
packagesLayout->addWidget(dateLabel, 1, 0);
packagesLayout->addWidget(dateEdit, 1, 1);
packagesLayout->addWidget(releaseCheckBox, 2, 0);
packagesLayout->addWidget(upgradesCheckBox, 3, 0);
packagesLayout->addWidget(hitsSpinBox, 4, 0, 1, 2);
packagesGroup->setLayout(packagesLayout);
QVBoxLayout *mainLayout = new QVBoxLayout;
mainLayout->addWidget(packagesGroup);
mainLayout->addSpacing(12);
mainLayout->addWidget(startQueryButton);
mainLayout->addStretch(1);
setLayout(mainLayout);
}
示例3: QSpinBox
QWidget *SpinBoxItem::createEditor() const
{
// create a spinbox editor
QSpinBox *spinbox = new QSpinBox(table()->viewport());
spinbox->setSuffix(" ns");
if (field_ == OFFSET) {
spinbox->setRange(-1, INT_MAX);
spinbox->setValue(node_->autoOffset() ? -1 : (int)node_->offset());
spinbox->setSpecialValueText
(QString("Auto (%1 ns)").arg(node_->offset()));
}
else {
spinbox->setRange(0, INT_MAX);
spinbox->setValue(field_ == CLOCK
? node_->clock()
: node_->runtime());
}
return spinbox;
}
示例4: createEditor
//.........这里部分代码省略.........
QList<QVariant> range = v.toList();
double min_ = range[0].toDouble();
double max_ = range[1].toDouble();
spinner->setFrame(false);
spinner->setRange(min_, max_);
editor = spinner;
break;
}
case SettingsValue::DOUBLE_RANGE_EXT:
{
QVariant v = index.model()->data(index, SettingsModel::ExtRangeRole);
QList<QVariant> range = v.toList();
double min_ = range[0].toDouble();
double max_ = range[1].toDouble();
QString ext_min_ = range[2].toString();
DoubleSpinBox* spinner = new DoubleSpinBox(parent);
spinner->setFrame(false);
spinner->setRange(min_, max_);
spinner->setMinText(ext_min_);
editor = spinner;
break;
}
case SettingsValue::DATE_TIME:
{
// Date and time editors.
QLineEdit* line = new QLineEdit(parent);
line->setFrame(false);
editor = line;
break;
}
case SettingsValue::TIME:
{
// Time editors.
QLineEdit* line = new QLineEdit(parent);
line->setFrame(false);
editor = line;
break;
}
case SettingsValue::RANDOM_SEED:
{
// Random seed editors.
QSpinBox* spinner = new QSpinBox(parent);
spinner->setFrame(false);
spinner->setRange(0, INT_MAX);
spinner->setSpecialValueText("time");
editor = spinner;
break;
}
case SettingsValue::INT_RANGE_EXT:
{
QVariant v = index.model()->data(index, SettingsModel::ExtRangeRole);
QList<QVariant> range = v.toList();
int min_ = range[0].toInt();
int max_ = range[1].toInt();
QString ext_min_ = range[2].toString();
QSpinBox* spinner = new QSpinBox(parent);
spinner->setFrame(false);
spinner->setRange(min_, max_);
spinner->setSpecialValueText(ext_min_);
editor = spinner;
break;
}
case SettingsValue::OPTION_LIST:
{
// Options list.
QComboBox* list = new QComboBox(parent);
QVariant data = index.model()->data(index,
SettingsModel::OptionsRole);
QStringList options = data.toStringList();
list->setFrame(false);
list->addItems(options);
connect(list, SIGNAL(activated(int)),
this, SLOT(commitAndCloseEditor(int)));
editor = list;
break;
}
case SettingsValue::DOUBLE_LIST:
{
// Floating-point arrays.
QLineEdit* line = new QLineEdit(parent);
QRegExp regex("^[+-]?\\d+(?:\\.\\d+)?(,[+-]?\\d+(?:\\.\\d+)?)*$");
QValidator* validator = new QRegExpValidator(regex, line);
line->setFrame(false);
line->setValidator(validator);
editor = line;
break;
}
default:
{
// Line editors.
QLineEdit* line = new QLineEdit(parent);
line->setFrame(false);
editor = line;
break;
}
}
editor->setAutoFillBackground(true);
return editor;
}
示例5: CreateActiveMQConnectivityWidgets
void ConfigScreen::CreateActiveMQConnectivityWidgets()
{
QLineEdit* activemquri = new QLineEdit ( _activemqscreen );
activemquri->setObjectName ( "kcfg_ActiveMQURI" );
_lactivemqscreen->addRow ( "ActiveMQ URI:", activemquri );
_confman->addWidget ( activemquri );
QLineEdit* activemqusername = new QLineEdit ( _activemqscreen );
activemqusername->setObjectName ( "kcfg_ActiveMQUsername" );
_lactivemqscreen->addRow ( "ActiveMQ username:", activemqusername );
_confman->addWidget ( activemqusername );
QLineEdit* activemqpassword = new QLineEdit ( _activemqscreen );
activemqpassword->setObjectName ( "kcfg_ActiveMQPassword" );
_lactivemqscreen->addRow ( "ActiveMQ password:", activemqpassword );
_confman->addWidget ( activemqpassword );
QLineEdit* activemqtopicname = new QLineEdit ( _activemqscreen );
activemqtopicname->setObjectName ( "kcfg_ActiveMQTopicName" );
_lactivemqscreen->addRow ( "CSS Alarm Server topic name:", activemqtopicname );
_confman->addWidget ( activemqtopicname );
QSpinBox* laboratorynotificationtimeout = new QSpinBox ( _activemqscreen );
laboratorynotificationtimeout->setMinimum ( 0 );
laboratorynotificationtimeout->setMaximum ( 3600 );
laboratorynotificationtimeout->setSuffix ( QString::fromUtf8 ( " seconds" ) );
laboratorynotificationtimeout->setSpecialValueText ( QString::fromUtf8 ( "Notification disabled" ) );
laboratorynotificationtimeout->setObjectName ( "kcfg_LaboratoryNotificationTimeout" );
_lactivemqscreen->addRow ( "Laboratory notification timeout:", laboratorynotificationtimeout );
_confman->addWidget ( laboratorynotificationtimeout );
QSpinBox* desktopnotificationtimeout = new QSpinBox ( _activemqscreen );
desktopnotificationtimeout->setMinimum ( 0 );
desktopnotificationtimeout->setMaximum ( 3600 );
desktopnotificationtimeout->setSuffix ( QString::fromUtf8 ( " seconds" ) );
desktopnotificationtimeout->setSpecialValueText ( QString::fromUtf8 ( "Notification disabled" ) );
desktopnotificationtimeout->setObjectName ( "kcfg_DesktopNotificationTimeout" );
_lactivemqscreen->addRow ( "Desktop notification timeout:", desktopnotificationtimeout );
_confman->addWidget ( desktopnotificationtimeout );
QSpinBox* emailnotificationtimeout = new QSpinBox ( _activemqscreen );
emailnotificationtimeout->setMinimum ( 0 );
emailnotificationtimeout->setMaximum ( 3600 );
emailnotificationtimeout->setSuffix ( QString::fromUtf8 ( " seconds" ) );
emailnotificationtimeout->setSpecialValueText ( QString::fromUtf8 ( "Notification disabled" ) );
emailnotificationtimeout->setObjectName ( "kcfg_EMailNotificationTimeout" );
_lactivemqscreen->addRow ( "E-Mail notification timeout:", emailnotificationtimeout );
_confman->addWidget ( emailnotificationtimeout );
QLineEdit* emailnotificationfrom = new QLineEdit ( _activemqscreen );
emailnotificationfrom->setObjectName ( "kcfg_EMailNotificationFrom" );
_lactivemqscreen->addRow ( "E-Mail notification sender address:", emailnotificationfrom );
_confman->addWidget ( emailnotificationfrom );
QLineEdit* emailnotificationto = new QLineEdit ( _activemqscreen );
emailnotificationto->setObjectName ( "kcfg_EMailNotificationTo" );
_lactivemqscreen->addRow ( "E-Mail notification recipient address:", emailnotificationto );
_confman->addWidget ( emailnotificationto );
QLineEdit* emailnotificationservername = new QLineEdit ( _activemqscreen );
emailnotificationservername->setObjectName ( "kcfg_EMailNotificationServerName" );
_lactivemqscreen->addRow ( "SMTP server name:", emailnotificationservername );
_confman->addWidget ( emailnotificationservername );
QSpinBox* emailnotificationserverport = new QSpinBox ( _activemqscreen );
emailnotificationserverport->setMinimum ( 0 ); // Minimum port number in TCP standard
emailnotificationserverport->setMaximum ( 65535 ); // Maximum port number in TCP standard
emailnotificationserverport->setObjectName ( "kcfg_EMailNotificationServerPort" );
_lactivemqscreen->addRow ( "SMTP server port:", emailnotificationserverport );
_confman->addWidget ( emailnotificationserverport );
QLineEdit* flashlightrelaisdevicenode = new QLineEdit ( _activemqscreen );
flashlightrelaisdevicenode->setObjectName ( QString::fromUtf8 ( "kcfg_FlashLightRelaisDeviceNode" ) );
_lactivemqscreen->addRow ( QString::fromUtf8 ( "Device node of relais for red flash light:" ), flashlightrelaisdevicenode );
_confman->addWidget ( flashlightrelaisdevicenode );
}
示例6: QSpinBox
QWidget *synthv1widget_controls_item_delegate::createEditor ( QWidget *pParent,
const QStyleOptionViewItem& /*option*/, const QModelIndex& index ) const
{
QWidget *pEditor = NULL;
switch (index.column()) {
case 0: // Channel.
{
QSpinBox *pSpinBox = new QSpinBox(pParent);
pSpinBox->setMinimum(0);
pSpinBox->setMaximum(16);
pSpinBox->setSpecialValueText(tr("Auto"));
pEditor = pSpinBox;
break;
}
case 1: // Type.
{
QComboBox *pComboBox = new QComboBox(pParent);
pComboBox->setEditable(false);
pComboBox->addItem(
synthv1_controls::textFromType(synthv1_controls::CC));
pComboBox->addItem(
synthv1_controls::textFromType(synthv1_controls::RPN));
pComboBox->addItem(
synthv1_controls::textFromType(synthv1_controls::NRPN));
pComboBox->addItem(
synthv1_controls::textFromType(synthv1_controls::CC14));
pEditor = pComboBox;
break;
}
case 2: // Parameter.
{
const QModelIndex& ctype_index = index.sibling(index.row(), 1);
const QString& sType = ctype_index.data().toString();
const synthv1_controls::Type ctype
= synthv1_controls::typeFromText(sType);
pEditor = controlParamComboBox(ctype, pParent);
break;
}
case 3: // Subject.
{
QComboBox *pComboBox = new QComboBox(pParent);
pComboBox->setEditable(false);
for (uint32_t i = 0; i < synthv1::NUM_PARAMS; ++i)
pComboBox->addItem(
synthv1_param::paramName(synthv1::ParamIndex(i)));
pEditor = pComboBox;
break;
}
default:
break;
}
#ifdef CONFIG_DEBUG_0
qDebug("synthv1widget_controls_item_delegate::createEditor(%p, %d, %d) = %p",
pParent, index.row(), index.column(), pEditor);
#endif
return pEditor;
}
示例7: 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);
}