本文整理汇总了C++中QDoubleValidator::setLocale方法的典型用法代码示例。如果您正苦于以下问题:C++ QDoubleValidator::setLocale方法的具体用法?C++ QDoubleValidator::setLocale怎么用?C++ QDoubleValidator::setLocale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDoubleValidator
的用法示例。
在下文中一共展示了QDoubleValidator::setLocale方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: connect
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void FloatVec3Widget::setupGui()
{
// Catch when the filter is about to execute the preflight
connect(getFilter(), SIGNAL(preflightAboutToExecute()),
this, SLOT(beforePreflight()));
// Catch when the filter is finished running the preflight
connect(getFilter(), SIGNAL(preflightExecuted()),
this, SLOT(afterPreflight()));
// Catch when the filter wants its values updated
connect(getFilter(), SIGNAL(updateFilterParameters(AbstractFilter*)),
this, SLOT(filterNeedsInputParameters(AbstractFilter*)));
connect(xData, SIGNAL(textChanged(const QString&)),
this, SLOT(widgetChanged(const QString&) ) );
connect(yData, SIGNAL(textChanged(const QString&)),
this, SLOT(widgetChanged(const QString&) ) );
connect(zData, SIGNAL(textChanged(const QString&)),
this, SLOT(widgetChanged(const QString&) ) );
QLocale loc = QLocale::system();
QDoubleValidator* xVal = new QDoubleValidator(xData);
xData->setValidator(xVal);
xVal->setLocale(loc);
QDoubleValidator* yVal = new QDoubleValidator(yData);
yData->setValidator(yVal);
yVal->setLocale(loc);
QDoubleValidator* zVal = new QDoubleValidator(zData);
zData->setValidator(zVal);
zVal->setLocale(loc);
if (getFilterParameter() != NULL)
{
label->setText(getFilterParameter()->getHumanLabel() );
FloatVec3_t data = getFilter()->property(PROPERTY_NAME_AS_CHAR).value<FloatVec3_t>();
xData->setText(loc.toString(data.x));
yData->setText(loc.toString(data.y));
zData->setText(loc.toString(data.z));
}
errorLabel->hide();
}
示例2: QAbstractScrollArea
TrackView::TrackView(SyncPage *page, QWidget *parent) :
QAbstractScrollArea(parent),
page(page),
windowRows(0),
readOnly(false),
dragging(false)
{
Q_ASSERT(page);
lineEdit = new QLineEdit(this);
lineEdit->setAutoFillBackground(true);
lineEdit->hide();
QDoubleValidator *lineEditValidator = new QDoubleValidator();
lineEditValidator->setNotation(QDoubleValidator::StandardNotation);
lineEditValidator->setLocale(QLocale::c());
lineEdit->setValidator(lineEditValidator);
QObject::connect(lineEdit, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
viewport()->setAutoFillBackground(false);
setFocus(Qt::OtherFocusReason);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
scrollPosX = 0;
scrollPosY = 0;
editRow = 0;
editTrack = 0;
selectionStart = selectionEnd = QPoint(0, 0);
updateFont(fontMetrics());
updatePalette();
stepPen = QPen();
lerpPen = QPen(QBrush(Qt::red), 2);
smoothPen = QPen(QBrush(Qt::green), 2);
rampPen = QPen(QBrush(Qt::blue), 2);
editBrush = Qt::yellow;
bookmarkBrush = QColor(128, 128, 255);
handCursor = QCursor(Qt::OpenHandCursor);
setMouseTracking(true);
setupScrollBars();
QObject::connect(horizontalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(onHScroll(int)));
QObject::connect(verticalScrollBar(), SIGNAL(valueChanged(int)), this, SLOT(onVScroll(int)));
QObject::connect(page, SIGNAL(trackHeaderChanged(int)), this, SLOT(onTrackHeaderChanged(int)));
QObject::connect(page, SIGNAL(trackDataChanged(int, int, int)), this, SLOT(onTrackDataChanged(int, int, int)));
}
示例3: createEditor
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
QWidget* ComparisonSelectionItemDelegate::createEditor(QWidget* widgetParent, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
QLineEdit* featureValue = NULL;
QDoubleValidator* featureValueValidator = NULL;
QComboBox* operatorCombo = NULL;
ComparisonSelectionTableModel* tableModel = qobject_cast<ComparisonSelectionTableModel*>(parent());
QStringList operators;
operators << (SIMPL::Comparison::Strings::LessThan)
<< (SIMPL::Comparison::Strings::GreaterThan)
<< (SIMPL::Comparison::Strings::Equal);
//QComboBox* phaseCombo = NULL;
QStringList phases;
for(int i = 0; i < m_NumberOfPhases; ++i)
{
phases << QString::number(i + 1);
}
bool ok = false;
qint32 col = index.column();
switch(col)
{
case ComparisonSelectionTableModel::FeatureName:
operatorCombo = new QComboBox(widgetParent);
operatorCombo->addItems(m_FeatureList);
operatorCombo->setAutoFillBackground(true);
if(tableModel)
{
connect(operatorCombo, SIGNAL(currentIndexChanged(int)),
this, SLOT(arrayNameChangedData(int)));
}
return operatorCombo;
case ComparisonSelectionTableModel::FeatureValue:
{
featureValue = new QLineEdit(widgetParent);
featureValue->setFrame(false);
featureValueValidator = new QDoubleValidator(featureValue);
featureValueValidator->setRange(-1.0f * std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), 6);
featureValueValidator->setLocale(QLocale::system());
featureValue->setValidator(featureValueValidator);
QVariant var = index.model()->data(index);
featureValue->setText(QString::number(var.toDouble(&ok), 'g', 6));
if (tableModel)
{
connect(featureValue, SIGNAL(textChanged(const QString&)),
this, SLOT(valueChangedData(const QString&)));
}
return featureValue;
}
case ComparisonSelectionTableModel::FeatureOperator:
operatorCombo = new QComboBox(widgetParent);
operatorCombo->addItems(operators);
operatorCombo->setAutoFillBackground(true);
if (tableModel)
{
connect(operatorCombo, SIGNAL(currentIndexChanged(int)),
this, SLOT(operatorChangedData(int)));
}
return operatorCombo;
// case ComparisonSelectionTableModel::FeaturePhaseValue:
// phaseCombo = new QComboBox(parent);
// phaseCombo->addItems(phases);
// phaseCombo->setAutoFillBackground(true);
// return phaseCombo;
default:
break;
}
return QStyledItemDelegate::createEditor(widgetParent, option, index);
}
示例4: setupGui
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void PrimaryPhaseWidget::setupGui()
{
distributionTypeCombo->addItem(DREAM3D::StringConstants::BetaDistribution.toLatin1().data());
distributionTypeCombo->addItem(DREAM3D::StringConstants::LogNormalDistribution.toLatin1().data());
distributionTypeCombo->addItem(DREAM3D::StringConstants::PowerLawDistribution.toLatin1().data());
distributionTypeCombo->setCurrentIndex(DREAM3D::DistributionType::LogNormal);
// Turn off all the plot widgets
setTabsPlotTabsEnabled(false);
QLocale loc = QLocale::system();
microstructurePresetCombo->blockSignals(true);
// Register all of our Microstructure Preset Factories
AbstractMicrostructurePresetFactory::Pointer presetFactory = AbstractMicrostructurePresetFactory::NullPointer();
//Register the Equiaxed Preset
presetFactory = RegisterPresetFactory<PrimaryEquiaxedPresetFactory>(microstructurePresetCombo);
QString presetName = (presetFactory->displayName());
MicrostructurePresetManager::Pointer manager = MicrostructurePresetManager::instance();
m_MicroPreset = manager->createNewPreset(presetName);
// Register the Rolled Preset
presetFactory = RegisterPresetFactory<PrimaryRolledPresetFactory>(microstructurePresetCombo);
m_MuValidator = new QDoubleValidator(m_Mu_SizeDistribution);
m_MuValidator->setLocale(loc);
m_MuValidator->setRange(0.0001, 10.0, 4);
m_Mu_SizeDistribution->setValidator(m_MuValidator);
m_SigmaValidator = new QDoubleValidator(m_Sigma_SizeDistribution);
m_SigmaValidator->setLocale(loc);
m_SigmaValidator->setRange(0.0000, 1.0, 4);
m_Sigma_SizeDistribution->setValidator(m_SigmaValidator);
QDoubleValidator* minVal = new QDoubleValidator(0.000, std::numeric_limits<double>::infinity(), 4, m_MinSigmaCutOff);
minVal->setLocale(loc);
m_MinSigmaCutOff->setValidator(minVal);
QDoubleValidator* maxVal = new QDoubleValidator(0.000, std::numeric_limits<double>::infinity(), 4, m_MinSigmaCutOff);
maxVal->setLocale(loc);
m_MaxSigmaCutOff->setValidator(maxVal);
// Select the first Preset in the list
microstructurePresetCombo->setCurrentIndex(0);
microstructurePresetCombo->blockSignals(false);
float mu = 1.0f;
float sigma = 0.1f;
float minCutOff = 5.0f;
float maxCutOff = 5.0f;
float binStepSize = 0.5f;
StatsGenPlotWidget* w = m_Omega3Plot;
w->setPlotTitle(QString("Size Vs. Omega 3"));
w->setXAxisName(QString("Omega 3"));
w->setYAxisName(QString("Frequency"));
w->setDistributionType(DREAM3D::DistributionType::Beta);
w->setStatisticsType(DREAM3D::StatisticsType::Feature_SizeVOmega3);
w->blockDistributionTypeChanges(true);
w->setRowOperationEnabled(false);
w->setMu(mu);
w->setSigma(sigma);
w->setMinCutOff(minCutOff);
w->setMaxCutOff(maxCutOff);
w->setBinStep(binStepSize);
connect(m_Omega3Plot, SIGNAL(userEditedData()),
this, SLOT(dataWasEdited()));
w = m_BOverAPlot;
w->setPlotTitle(QString("B/A Shape Distribution"));
w->setXAxisName(QString("B/A"));
w->setYAxisName(QString("Frequency"));
w->setDistributionType(DREAM3D::DistributionType::Beta);
w->setStatisticsType(DREAM3D::StatisticsType::Feature_SizeVBoverA);
w->blockDistributionTypeChanges(true);
w->setRowOperationEnabled(false);
w->setMu(mu);
w->setSigma(sigma);
w->setMinCutOff(minCutOff);
w->setMaxCutOff(maxCutOff);
w->setBinStep(binStepSize);
connect(m_BOverAPlot, SIGNAL(userEditedData()),
this, SLOT(dataWasEdited()));
w = m_COverAPlot;
w->setPlotTitle(QString("C/A Shape Distribution"));
w->setXAxisName(QString("C/A"));
w->setYAxisName(QString("Frequency"));
w->setDistributionType(DREAM3D::DistributionType::Beta);
w->setStatisticsType(DREAM3D::StatisticsType::Feature_SizeVCoverA);
w->blockDistributionTypeChanges(true);
//.........这里部分代码省略.........