本文整理汇总了C++中QSpinBox::text方法的典型用法代码示例。如果您正苦于以下问题:C++ QSpinBox::text方法的具体用法?C++ QSpinBox::text怎么用?C++ QSpinBox::text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSpinBox
的用法示例。
在下文中一共展示了QSpinBox::text方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void
pcl::modeler::IntParameter::getEditorData(QWidget *editor)
{
QSpinBox *spinBox = static_cast<QSpinBox*>(editor);
int value = spinBox->text().toInt();
current_value_ = value;
}
示例2: eventFilter
bool IpAddressWidget::eventFilter(QObject *object, QEvent *event)
{
//如果object不是四个输入框,则返回
int nowBox = -1;
for(int i=0; i<4; i++)
{
if( object == m_SpinBox[i] )
nowBox = i;
}
if( -1 == nowBox )
return false;
QSpinBox *spinBox = dynamic_cast<QSpinBox*>(object);
//如果某个输入框得到了输入焦点,则将它们设为全选状态
if( QEvent::FocusIn == event->type() )
{
spinBox->selectAll();
return true;
}
//如果输入框内的字符为0,则清空该输入框(防止用户输入多个0)
else if( QEvent::KeyPress == event->type() )
{
QString context = spinBox->text();
if( "0" == context )
spinBox->clear();
}
//如果输入框内的数字大于25,则输入焦点自动跳到下一格
else if( QEvent::KeyRelease == event->type() )
{
int val = spinBox->value();
if( spinBox->value() > 25 && nowBox < 3 )
{
m_SpinBox[nowBox+1]->setFocus();
}
}
return false;
}
示例3: configFromNextWidget
/**
@copydoc Configurable::configFromWidget
*/
void Configurable::configFromNextWidget(QObject* cur,ConfigParamList& paramList){
//parametres de configuration
const QObjectList& list = cur->children();
for(int i=0;i<list.size();i++)
{
QObject* child = list.at(i);
if(!child->objectName().isEmpty() && child->isWidgetType())
{
QString value;
// QLineEdit ?
QLineEdit *lineEdit = qobject_cast<QLineEdit *>(child);
if(lineEdit)
value = lineEdit->text();
// QComboBox ?
QComboBox *comboBox = qobject_cast<QComboBox *>(child);
if(comboBox)
value = comboBox->currentText();
// QSpinBox ?
QSpinBox *spinBox = qobject_cast<QSpinBox *>(child);
if(spinBox)
value = spinBox->text();
// QDoubleSpinBox ?
QDoubleSpinBox *doubleSpinBox = qobject_cast<QDoubleSpinBox *>(child);
if(doubleSpinBox)
value = doubleSpinBox->text();
// QTextEdit ?
QTextEdit *textEdit = qobject_cast<QTextEdit *>(child);
if(textEdit)
value = textEdit->toPlainText();
// QPlainTextEdit ?
QPlainTextEdit *plainTextEdit = qobject_cast<QPlainTextEdit *>(child);
if(plainTextEdit)
value = plainTextEdit->toPlainText();
// QTimeEdit ?
QTimeEdit *timeEdit = qobject_cast<QTimeEdit *>(child);
if(timeEdit)
value = timeEdit->text();
// QDateTimeEdit ?
QDateTimeEdit *dateTimeEdit = qobject_cast<QDateTimeEdit *>(child);
if(dateTimeEdit)
value = timeEdit->text();
// QDateEdit ?
QDateEdit *dateEdit = qobject_cast<QDateEdit *>(child);
if(dateEdit)
value = dateEdit->text();
// QDial ?
QDial *dial = qobject_cast<QDial *>(child);
if(dial)
value = QString::number(dial->value());
// QSlider ?
QSlider *slider = qobject_cast<QSlider *>(child);
if(slider)
value = QString::number(slider->value());
//sauvegarde la valeur
if(!value.isNull()){
/*#ifdef _DEBUG
QPRINT("loadConfig >> "+child->objectName()+"="+value);
#endif*/
if(paramList.find(child->objectName()) != paramList.end())
paramList[child->objectName()]->setValue(value);
else
paramList[child->objectName()] = new ConfigParam(value,"");
}
}
Configurable::configFromNextWidget(child,paramList);
}
}
示例4: validerCategoriesFormation
void gererFormation::validerCategoriesFormation()
{
TemplateManager<Categorie>& tCategorie=TemplateManager<Categorie>::getInstance();
for(int i=0; i<ui->tableWidgetCategorie->rowCount();i++)
{
QSpinBox *creds = qobject_cast<QSpinBox*>(ui->tableWidgetCategorie->cellWidget(i,1));
if(creds!=0)
{
nbCredits[tCategorie.getElement(ui->tableWidgetCategorie->item(i,0)->text())]=creds->text().toUInt();
qDebug()<<"test : "<<nbCredits[tCategorie.getElement(ui->tableWidgetCategorie->item(i,0)->text())];
}
else
{
throw FormationException("Erreur gérerFormation : le qobject_cast n'a pas marché");
}
}
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(true);
ui->Suivant->setEnabled(true);
}