本文整理汇总了C++中QSpinBox::setMaxValue方法的典型用法代码示例。如果您正苦于以下问题:C++ QSpinBox::setMaxValue方法的具体用法?C++ QSpinBox::setMaxValue怎么用?C++ QSpinBox::setMaxValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSpinBox
的用法示例。
在下文中一共展示了QSpinBox::setMaxValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QSpinBox
QWidget *KFileMetaInfoWidget::makeIntWidget()
{
QSpinBox *sb = new QSpinBox(this, "metainfo integer widget");
sb->setValue(m_item.value().toInt());
if(m_validator)
{
if(m_validator->inherits("QIntValidator"))
{
sb->setMinValue(static_cast< QIntValidator * >(m_validator)->bottom());
sb->setMaxValue(static_cast< QIntValidator * >(m_validator)->top());
}
reparentValidator(sb, m_validator);
sb->setValidator(m_validator);
}
// make sure that an uint cannot be set to a value < 0
if(m_item.type() == QVariant::UInt)
sb->setMinValue(QMAX(sb->minValue(), 0));
connect(sb, SIGNAL(valueChanged(int)), this, SLOT(slotChanged(int)));
return sb;
}
示例2: QMainWindow
QSofaMainWindow::QSofaMainWindow(QWidget *parent) :
QMainWindow(parent)
{
setFocusPolicy(Qt::ClickFocus);
mainViewer = new QSofaViewer(&sofaScene,this);
setCentralWidget(mainViewer);
QToolBar* toolbar = addToolBar(tr("Controls"));
QMenu* fileMenu = menuBar()->addMenu(tr("&File"));
QMenu* simulationMenu = menuBar()->addMenu(tr("&Simulation"));
QMenu* viewMenu = menuBar()->addMenu(tr("&View"));
// find icons at https://www.iconfinder.com/search
// start/stop
{
_playPauseAct = new QAction(QIcon(":/icons/start.svg"), tr("&Play..."), this);
_playPauseAct->setIcon(this->style()->standardIcon(QStyle::SP_MediaPlay));
_playPauseAct->setShortcut(QKeySequence(Qt::Key_Space));
_playPauseAct->setToolTip(tr("Play/Pause simulation"));
connect(_playPauseAct, SIGNAL(triggered()), &sofaScene, SLOT(playpause()));
connect(&sofaScene, SIGNAL(sigPlaying(bool)), this, SLOT(isPlaying(bool)) );
this->addAction(_playPauseAct);
simulationMenu->addAction(_playPauseAct);
toolbar->addAction(_playPauseAct);
}
// reset
{
QAction* resetAct = new QAction(QIcon(":/icons/reset.svg"), tr("&Reset..."), this);
resetAct->setIcon(this->style()->standardIcon(QStyle::SP_MediaSkipBackward));
resetAct->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_R));
resetAct->setToolTip(tr("Restart from the beginning, without reloading"));
connect(resetAct, SIGNAL(triggered()), &sofaScene, SLOT(reset()));
this->addAction(resetAct);
simulationMenu->addAction(resetAct);
toolbar->addAction(resetAct);
}
// open
{
QAction* openAct = new QAction(QIcon(":/icons/reset.svg"), tr("&Open..."), this);
openAct->setIcon(this->style()->standardIcon(QStyle::SP_FileIcon));
openAct->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_O));
openAct->setToolTip(tr("Open new scene"));
openAct->setStatusTip(tr("Opening scene…"));
connect(openAct, SIGNAL(triggered()), this, SLOT(open()));
this->addAction(openAct);
fileMenu->addAction(openAct);
toolbar->addAction(openAct);
}
// time step
{
QSpinBox* spinBox = new QSpinBox(this);
toolbar->addWidget(spinBox);
spinBox->setValue(40);
spinBox->setMaxValue(40000);
spinBox->setToolTip(tr("Simulation time step (ms)"));
connect(spinBox,SIGNAL(valueChanged(int)), this, SLOT(setDt(int)));
}
// reload
{
QAction* reloadAct = new QAction(QIcon(":/icons/reload.svg"), tr("&Reload..."), this);
reloadAct->setIcon(this->style()->standardIcon(QStyle::SP_BrowserReload));
reloadAct->setShortcut(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_R));
reloadAct->setStatusTip(tr("Reloading scene…"));
reloadAct->setToolTip(tr("Reload file and restart from the beginning"));
connect(reloadAct, SIGNAL(triggered()), &sofaScene, SLOT(reload()));
this->addAction(reloadAct);
fileMenu->addAction(reloadAct);
toolbar->addAction(reloadAct);
}
// viewAll
{
QAction* viewAllAct = new QAction(QIcon(":/icons/eye.svg"), tr("&ViewAll..."), this);
viewAllAct->setShortcut(QKeySequence(Qt::CTRL+Qt::SHIFT+Qt::Key_V));
viewAllAct->setToolTip(tr("Adjust camera to view all"));
connect(viewAllAct, SIGNAL(triggered()), mainViewer, SLOT(viewAll()));
this->addAction(viewAllAct);
simulationMenu->addAction(viewAllAct);
toolbar->addAction(viewAllAct);
}
// print
{
QAction* printAct = new QAction( QIcon(":/icons/print.svg"), tr("&PrintGraph..."), this);
printAct->setShortcut(QKeySequence(Qt::CTRL+Qt::Key_P));
printAct->setToolTip(tr("Print the graph on the standard output"));
connect(printAct, SIGNAL(triggered()), &sofaScene, SLOT(printGraph()));
this->addAction(printAct);
simulationMenu->addAction(printAct);
toolbar->addAction(printAct);
}
// {
// QAction* toggleFullScreenAct = new QAction( tr("&FullScreen"), this );
//.........这里部分代码省略.........