本文整理汇总了C++中QSpinBox::setSuffix方法的典型用法代码示例。如果您正苦于以下问题:C++ QSpinBox::setSuffix方法的具体用法?C++ QSpinBox::setSuffix怎么用?C++ QSpinBox::setSuffix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSpinBox
的用法示例。
在下文中一共展示了QSpinBox::setSuffix方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QSpinBox
QList<QWidget *> Object::getControls()
{
QSpinBox *bonus = new QSpinBox();
bonus->setObjectName("bonus");
bonus->setMaximum(1000);
bonus->setValue(_bonus);
connect(bonus,SIGNAL(valueChanged(int)),this,SLOT(setAttribute()));
Control *c_bonus = new Control("Bonificación de armadura", bonus);
QSpinBox *time = new QSpinBox();
time->setSuffix(" seg");
time->setObjectName("time");
time->setMinimum(1);
time->setMaximum(1000);
time->setValue(_time);
connect(time,SIGNAL(valueChanged(int)),this,SLOT(setAttribute()));
Control *c_time = new Control("Tiempo de efecto", time);
QSpinBox *cooldown = new QSpinBox();
cooldown->setSuffix(" seg");
cooldown->setObjectName("cooldown");
cooldown->setMinimum(1);
cooldown->setMaximum(1000);
cooldown->setValue(_cooldown);
connect(cooldown,SIGNAL(valueChanged(int)),this,SLOT(setAttribute()));
Control *c_cooldown = new Control("Tiempo de reaparición", cooldown);
QList<QWidget*> controls = IObject::getControls();
controls.append(c_bonus);
controls.append(c_time);
controls.append(c_cooldown);
return controls;
}
示例2: updateUnits
void ColumnList::updateUnits()
{
// Replace widget suffices and table headers
for(Column *col : columns)
{
col->colDisplayName = Unit::replacePlaceholders(col->colOrigDisplayName);
QSpinBox *sb = col->getSpinBoxWidget();
if(sb != nullptr)
sb->setSuffix(Unit::replacePlaceholders(sb->suffix(), col->colWidgetSuffix));
sb = col->getMinSpinBoxWidget();
if(sb != nullptr)
sb->setSuffix(Unit::replacePlaceholders(sb->suffix(), col->colMinWidgetSuffix));
sb = col->getMaxSpinBoxWidget();
if(sb != nullptr)
sb->setSuffix(Unit::replacePlaceholders(sb->suffix(), col->colMaxWidgetSuffix));
}
if(minDistanceWidget != nullptr)
minDistanceWidget->setSuffix(
Unit::replacePlaceholders(minDistanceWidget->suffix(), minDistanceWidgetSuffix));
if(maxDistanceWidget != nullptr)
maxDistanceWidget->setSuffix(
Unit::replacePlaceholders(maxDistanceWidget->suffix(), maxDistanceWidgetSuffix));
}
示例3: settings
AntiDosWindow::AntiDosWindow(QSettings &settings) : settings(settings)
{
setAttribute(Qt::WA_DeleteOnClose, true);
QFormLayout *mylayout = new QFormLayout(this);
QSpinBox *mppip = new QSpinBox();
mppip->setRange(1,8);
mppip->setValue(settings.value("AntiDOS/MaxPeoplePerIp").toInt());
mylayout->addRow(tr("Max number of people connected with the same ip"), mppip);
QSpinBox *mcpus = new QSpinBox();
mcpus->setRange(15,150);
mcpus->setValue(settings.value("AntiDOS/MaxCommandsPerUser").toInt());
mylayout->addRow(tr("Max number of times someone is active within a minute"), mcpus);
QSpinBox *mkbpus = new QSpinBox();
mkbpus->setRange(5,150);
mkbpus->setValue(settings.value("AntiDOS/MaxKBPerUser").toInt());
mkbpus->setSuffix(" kB");
mylayout->addRow(tr("Maximum upload from user per minute"), mkbpus);
QSpinBox *mlpip = new QSpinBox();
mlpip->setRange(2,30);
mlpip->setValue(settings.value("AntiDOS/MaxConnectionRatePerIP").toInt());
mylayout->addRow(tr("Max number of times the same ip attempts to log in per minute"), mlpip);
QSpinBox *baxk = new QSpinBox();
baxk->setRange(1,30);
baxk->setValue(settings.value("AntiDOS/NumberOfInfractionsBeforeBan").toInt());
mylayout->addRow(tr("Bans after X antidos kicks per 15 minutes"), baxk);
trusted_ips = new QLineEdit();
trusted_ips->setText(settings.value("AntiDOS/TrustedIps").toString());
mylayout->addRow(tr("Trusted IPs (separated by comma)"),trusted_ips);
notificationsChannel = new QLineEdit(settings.value("AntiDOS/NotificationsChannel").toString());
mylayout->addRow(tr("Channel in which to display overactive messages: "), notificationsChannel);
QCheckBox *aDosOn = new QCheckBox(tr("Turn AntiDos ON"));
aDosOn->setChecked(!settings.value("AntiDOS/Disabled").toBool());
mylayout->addWidget(aDosOn);
QPushButton *ok = new QPushButton("&Apply");
QPushButton *cancel = new QPushButton("&Cancel");
mylayout->addRow(ok, cancel);
connect(cancel, SIGNAL(clicked()), SLOT(close()));
connect(ok, SIGNAL(clicked()), SLOT(apply()));
max_people_per_ip = mppip;
max_commands_per_user = mcpus;
max_kb_per_user = mkbpus;
max_login_per_ip = mlpip;
ban_after_x_kicks = baxk;
this->aDosOn = aDosOn;
}
示例4: QSpinBox
QWidget *SpinBoxDelegate::createEditor( QWidget *parent, const QStyleOptionViewItem &/* option */, const QModelIndex &/* index */ ) const
{
QSpinBox *editor = new QSpinBox( parent );
editor->setMinimum( 1 );
editor->setMaximum( 999 );
editor->setSuffix( "min" );
return editor;
}
示例5: if
TtipMelody::TtipMelody(TquestionPoint *point) :
TtipChart(point)
{
setBgColor(point->color());
setPlainText(" ");
m_w = new QWidget();
m_w->setObjectName("m_melodyView");
m_w->setStyleSheet("QWidget#m_melodyView { background: transparent }");
QString txt;
if (point->nr())
txt = QString(TquestionAsWdg::questionTxt() + " <big><b>%1.</b></big>").arg(point->nr());
if (point->question()->questionAsNote() && point->question()->answerAsSound())
txt += (" <b>" + TexTrans::playMelodyTxt() + "</b>");
else if (point->question()->questionAsSound() && point->question()->answerAsNote())
txt += (" <b>" + TexTrans::writeMelodyTxt() + "</b>");
QLabel *headLab = new QLabel(txt, m_w);
headLab->setAlignment(Qt::AlignCenter);
m_score = new TmelodyView(qa()->question()->melody(), m_w);
m_score->setFixedHeight(qApp->desktop()->availableGeometry().height() / 12);
if (point->question()->exam()) {
if (point->question()->exam()->level()->showStrNr)
m_score->showStringNumbers(true);
}
QSpinBox *spinAtt = new QSpinBox(m_w);
spinAtt->setRange(0, qa()->question()->attemptsCount());
spinAtt->setPrefix(TexTrans::attemptTxt() + " ");
spinAtt->setSuffix(" " + tr("of", "It will give text: 'Attempt x of y'") + QString(" %1").arg(qa()->question()->attemptsCount()));
m_attemptLabel = new QLabel(m_w);
m_resultLabel = new QLabel(wasAnswerOKtext(point->question(), point->color()).replace("<br>", " "), m_w);
m_resultLabel->setAlignment(Qt::AlignCenter);
// txt = wasAnswerOKtext(point->question(), point->color()).replace("<br>", " ") + "<br>";
txt = tr("Melody was played <b>%n</b> times", "", qa()->question()->totalPlayBacks()) + "<br>";
txt += TexTrans::effectTxt() + QString(": <big><b>%1%</b></big>, ").arg(point->question()->effectiveness(), 0, 'f', 1, '0');
txt += TexTrans::reactTimeTxt() + QString("<big><b> %1</b></big>").arg(Texam::formatReactTime(point->question()->time, true));
QLabel *sumLab = new QLabel(txt, m_w);
sumLab->setAlignment(Qt::AlignCenter);
QVBoxLayout *lay = new QVBoxLayout;
lay->addWidget(headLab);
lay->addWidget(m_score, 0, Qt::AlignCenter);
QHBoxLayout *attLay = new QHBoxLayout;
attLay->addStretch();
attLay->addWidget(spinAtt);
attLay->addStretch();
lay->addLayout(attLay);
lay->addWidget(m_attemptLabel);
lay->addWidget(m_resultLabel);
lay->addWidget(sumLab);
m_w->setLayout(lay);
m_widget = point->scene()->addWidget(m_w);
m_widget->setParentItem(this);
connect(spinAtt, SIGNAL(valueChanged(int)), this, SLOT(attemptChanged(int)));
}
示例6: createEditor
QWidget *BrainTreeDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option , const QModelIndex& index) const
{
const BrainTreeModel* pBrainTreeModel = static_cast<const BrainTreeModel*>(index.model());
const AbstractTreeItem* pAbstractItem = static_cast<const AbstractTreeItem*>(pBrainTreeModel->itemFromIndex(index));
switch(pAbstractItem->type()) {
case BrainTreeModelItemTypes::SurfaceColorGyri: {
QColorDialog *pColorDialog = new QColorDialog(parent);
pColorDialog->show();
return pColorDialog;
}
case BrainTreeModelItemTypes::SurfaceColorSulci: {
QColorDialog *pColorDialog = new QColorDialog(parent);
pColorDialog->show();
return pColorDialog;
}
case BrainTreeModelItemTypes::SurfaceColorInfoOrigin: {
QComboBox* pComboBox = new QComboBox(parent);
pComboBox->addItem("Color from curvature");
pComboBox->addItem("Color from annotation");
return pComboBox;
}
case BrainTreeModelItemTypes::RTDataColormapType: {
QComboBox* pComboBox = new QComboBox(parent);
pComboBox->addItem("Hot Negative 1");
pComboBox->addItem("Hot Negative 2");
pComboBox->addItem("Hot");
return pComboBox;
}
case BrainTreeModelItemTypes::RTDataNormalizationValue: {
QDoubleSpinBox* pDoubleSpinBox = new QDoubleSpinBox(parent);
pDoubleSpinBox->setMinimum(0.01);
pDoubleSpinBox->setMaximum(10.0);
pDoubleSpinBox->setSingleStep(0.01);
pDoubleSpinBox->setValue(index.model()->data(index, BrainTreeItemRoles::RTDataNormalizationValue).toDouble());
return pDoubleSpinBox;
break;
}
case BrainTreeModelItemTypes::RTDataTimeInterval: {
QSpinBox* pSpinBox = new QSpinBox(parent);
pSpinBox->setSuffix(" mSec");
pSpinBox->setMinimum(17);
pSpinBox->setMaximum(5000);
pSpinBox->setValue(index.model()->data(index, BrainTreeItemRoles::RTDataTimeInterval).toInt());
return pSpinBox;
break;
}
}
return QItemDelegate::createEditor(parent, option, index);
}
示例7: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QSpinBox* nextentry = new QSpinBox;
nextentry->setSuffix(")");
nextentry->setSuffix(" MB");
QSlider* on_moverecords_sliderMoved = new QSlider(Qt::Horizontal);
QHBoxLayout* layout = new QHBoxLayout;
layout->addWidget(nextentry);
layout->addWidget(on_moverecords_sliderMoved);
QObject::connect(nextentry, SIGNAL(valueChanged(int)),
on_moverecords_sliderMoved, SLOT(setValue(int)));
QObject::connect(on_moverecords_sliderMoved, SIGNAL(valueChanged(int)),
nextentry, SLOT(setValue(int)));
nextentry->setValue(99);
DiplomWork w;
w.show();
return a.exec();
}
示例8: QGridLayout
HzW::HzW(int c, const QStringList &freqs)
{
QGridLayout *layout = new QGridLayout(this);
for (int i = 0; i < c; ++i)
{
QSpinBox *sB = new QSpinBox;
sB->setRange(0, 96000);
sB->setSuffix(" Hz");
if (freqs.count() > i)
sB->setValue(freqs[i].toInt());
else
sB->setValue(440);
hzB.append(sB);
layout->addWidget(sB, i/4, i%4);
}
}
示例9: main
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QSpinBox *spinBox = new QSpinBox;
spinBox->setRange(1,100); //set range of spinBox's values
spinBox->setSuffix(" MB"); // set suffix after our values
spinBox->setButtonSymbols(QSpinBox::PlusMinus);
spinBox->setWrapping(true); // loop mode activating
spinBox->setFixedHeight(100);
spinBox->setFixedWidth(100);
spinBox->move(430,340);
spinBox->show();
return a.exec();
}
示例10: create_integer_input
QSpinBox* RenderSettingsWindow::create_integer_input(
const string& widget_key,
const int min,
const int max,
const QString& label)
{
QSpinBox* spinbox = create_integer_input(widget_key, min, max);
const QString suffix = " " + label;
spinbox->setSuffix(suffix);
QString text;
text.setNum(max);
text.append(suffix);
set_widget_width_for_text(spinbox, text, SpinBoxMargin, SpinBoxMinWidth);
return spinbox;
}
示例11: 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);
}
示例12: 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);
}
示例13: setEditorData
void ProgressDelegate::setEditorData(QWidget *editor,
const QModelIndex &index) const {
auto model = index.model();
auto id =
model->data(model->index(index.row(), ListRoles::ID), Qt::DisplayRole);
AnimePtr anime = User::sharedUser()->getAnimeByID(id.toString());
auto episodes_watched = anime->episodesWatched();
auto total_episodes = anime->totalEpisodes();
if (total_episodes == 0) {
total_episodes = std::numeric_limits<int>::max();
}
QSpinBox *spinBox = static_cast<QSpinBox *>(editor);
spinBox->setMaximum(total_episodes);
spinBox->setValue(episodes_watched);
spinBox->setSuffix(" / " + QString::number(anime->totalEpisodes()));
}
示例14: 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;
}
示例15: main
int main(int argc, char** argv) {
QApplication app(argc, argv);
QWidget wgt;
wgt.setWindowTitle("Spin Boxes");
QLabel* plblCount = new QLabel("Megabytes:");
QLabel* plblDate = new QLabel("Date and Time:");
QLabel* plblValid = new QLabel("Name:");
QSpinBox spb;
spb.setRange(1, 100);
spb.setSuffix(" MB");
spb.setButtonSymbols(QSpinBox::PlusMinus);
spb.setWrapping(true);
spb.resize(100, 30);
plblCount->setBuddy(&spb);
QObject::connect(&spb, SIGNAL(valueChanged(const QString&)), plblCount, SLOT(setText(const QString&)));
QDateTimeEdit dateTimeEdit(QDateTime::currentDateTime());
QLineEdit* ptxt = new QLineEdit;
NameValidator* pnameValidator = new NameValidator(ptxt);
ptxt->setValidator(pnameValidator);
plblValid->setBuddy(ptxt);
QVBoxLayout* pvbxLayout = new QVBoxLayout;
pvbxLayout->addWidget(plblCount);
pvbxLayout->addWidget(&spb);
pvbxLayout->addWidget(plblDate);
pvbxLayout->addWidget(&dateTimeEdit);
pvbxLayout->addWidget(plblValid);
pvbxLayout->addWidget(ptxt);
wgt.setLayout(pvbxLayout);
wgt.resize(230, 180);
wgt.show();
return app.exec();
}