本文整理汇总了C++中QDoubleValidator::setNotation方法的典型用法代码示例。如果您正苦于以下问题:C++ QDoubleValidator::setNotation方法的具体用法?C++ QDoubleValidator::setNotation怎么用?C++ QDoubleValidator::setNotation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDoubleValidator
的用法示例。
在下文中一共展示了QDoubleValidator::setNotation方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QLabel
MapEditorPopup::MapEditorPopup(QPoint pos,QPointF value, int i,QWidget * parent)
:QWidget(parent)
// :QWidget(parent,Qt::Popup)
// :QDialog(parent,Qt::Popup)
{
index = i;
pos.rx() += 5;
pos.ry() -= 5;
QGridLayout * layout = new QGridLayout;
layout->addWidget(new QLabel("Iteration:"),1,0);
xEdit = new QLineEdit;
xEdit->setText(QString::number(value.x(),'g',6));
xEdit->setMaximumWidth(80);
QDoubleValidator * sv = new QDoubleValidator(xEdit);
sv->setNotation(QDoubleValidator::ScientificNotation);
xEdit->setValidator(sv);
layout->addWidget(xEdit,1,1);
layout->addWidget(new QLabel("Value:"),0,0);
yEdit = new QLineEdit;
yEdit->setText(QString::number(value.y(),'g',6));
yEdit->setMaximumWidth(80);
sv = new QDoubleValidator(yEdit);
sv->setNotation(QDoubleValidator::ScientificNotation);
yEdit->setValidator(sv);
layout->addWidget(yEdit,0,1);
setLayout(layout);
pos.ry() -= sizeHint().height()/2;
// move(parent->mapToGlobal(pos));
move(pos);
xEdit->setFocus(Qt::ActiveWindowFocusReason);
// setAttribute(Qt::WA_DeleteOnClose,true);
}
示例2: validate
QValidator::State cwClinoValidator::validate ( QString & input, int & pos ) const {
if(input.isEmpty()) {
return QValidator::Acceptable;
}
QDoubleValidator doubleValidator;
doubleValidator.setTop(90);
doubleValidator.setBottom(-90);
doubleValidator.setNotation(QDoubleValidator::StandardNotation);
QValidator::State state = doubleValidator.validate(input, pos);
switch(state) {
case QValidator::Invalid: {
QRegExpValidator upDownValidator;
QRegExp regexp("up|down", Qt::CaseInsensitive);
upDownValidator.setRegExp(regexp);
return upDownValidator.validate(input, pos);
}
case QValidator::Acceptable: {
//Just make sure we can convert the input
bool okay;
double value = input.toDouble(&okay);
if(!okay || !check(value)) {
//The validator is dump ... this handle use case input="5,5"
return QValidator::Invalid;
}
break;
}
default:
break;
}
return state;
}
示例3: setDoubleValidator
void Console::setDoubleValidator(QLineEdit* const lineEdit){
QDoubleValidator* doubleValidator = new QDoubleValidator(lineEdit);
doubleValidator->setNotation(QDoubleValidator::StandardNotation);
doubleValidator->setDecimals(10);
lineEdit->setValidator(doubleValidator);
}
示例4: QMainWindow
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
this->setFixedSize(832, 717);
// Validadores para los parametros del algoritmo
QValidator * validatorCognitiveParameter = new QIntValidator(0, 9, this);
ui->lineEditCognitiveParameter->setValidator(validatorCognitiveParameter);
ui->lineEditCognitiveParameter->setToolTip("[0..9]");
QValidator * validatorSocialParameter = new QIntValidator(0, 9, this);
ui->lineEditSocialParameter->setValidator(validatorSocialParameter);
ui->lineEditSocialParameter->setToolTip("[0..9]");
QDoubleValidator * validatorInertia = new QDoubleValidator(0.0, 1.0, 2, this);
validatorInertia->setNotation(QDoubleValidator::StandardNotation);
ui->lineEditInertiaParameter->setValidator(validatorInertia);
ui->lineEditInertiaParameter->setToolTip("[0..1]");
QValidator * validatorSpeedParameter = new QIntValidator(1, 9, this);
ui->lineEditMaxSpeedParameter->setValidator(validatorSpeedParameter);
ui->lineEditMaxSpeedParameter->setToolTip("[1..9]");
QValidator * validatorParticlesParameter = new QIntValidator(1, 400, this);
ui->lineEditParticlesParameter->setValidator(validatorParticlesParameter);
ui->lineEditParticlesParameter->setToolTip("[1..400]");
QValidator * validatorIterationsParameter = new QIntValidator(1, 1000, this);
ui->lineEditIterationsParameter->setValidator(validatorIterationsParameter);
ui->lineEditIterationsParameter->setToolTip("[1..1000]");
QValidator * validatorSubintervalsParameter = new QIntValidator(2, 10, this);
ui->lineEditSubintervals->setValidator(validatorSubintervalsParameter);
ui->lineEditSubintervals->setToolTip("[2..10]");
connect(ui->pushButtonExecute, SIGNAL(clicked()), this, SLOT(executeAlgorithm()));
connect(ui->pushButtonCompareAlgorithms, SIGNAL(clicked()), this, SLOT(compareAlgorithms()));
connect(ui->checkBoxGrid, SIGNAL(stateChanged(int)), this, SLOT(activateGridSelection(int)));
ui->label_9->setEnabled(false);
ui->lineEditSubintervals->setEnabled(false);
connect(ui->checkBoxComparation, SIGNAL(stateChanged(int)), this, SLOT(activateComparationButton(int)));
ui->pushButtonCompareAlgorithms->setEnabled(false);
ui->label_PSO_generico->setVisible(false);
ui->psoGenericNumber->setVisible(false);
ui->label_PSO_modificado->setVisible(false);
ui->psoModifiedNumber->setVisible(false);
ui->psoGenericTime->setVisible(false);
ui->psoModifiedTime->setVisible(false);
ui->label_tiempo_generico->setVisible(false);
ui->label_tiempo_modificado->setVisible(false);
}
示例5: setRange
//================================================================================
void customLineEdit::setRange(double min,
double max,
int decimals)
{
QDoubleValidator * v = new QDoubleValidator(min,max,decimals,this) ;
v->setNotation(QDoubleValidator::ScientificNotation);
// this->setValidator(v) ;
}
示例6: collectExtraInfo
bool Ruler::collectExtraInfo(QWidget * parent, const QString & family, const QString & prop, const QString & value, bool swappingEnabled, QString & returnProp, QString & returnValue, QWidget * & returnWidget)
{
bool result = PaletteItem::collectExtraInfo(parent, family, prop, value, swappingEnabled, returnProp, returnValue, returnWidget);
if (prop.compare("width", Qt::CaseInsensitive) == 0) {
returnProp = tr("width");
int units = m_modelPart->localProp("width").toString().contains("cm") ? IndexCm : IndexIn;
QLineEdit * e1 = new QLineEdit();
QDoubleValidator * validator = new QDoubleValidator(e1);
validator->setRange(1.0, 20 * ((units == IndexCm) ? 2.54 : 1), 2);
validator->setNotation(QDoubleValidator::StandardNotation);
e1->setValidator(validator);
e1->setEnabled(swappingEnabled);
QString temp = m_modelPart->localProp("width").toString();
temp.chop(2);
e1->setText(temp);
e1->setObjectName("infoViewLineEdit");
e1->setMaximumWidth(80);
m_widthEditor = e1;
m_widthValidator = validator;
QComboBox * comboBox = new QComboBox(parent);
comboBox->setEditable(false);
comboBox->setEnabled(swappingEnabled);
comboBox->addItem("cm");
comboBox->addItem("in");
comboBox->setCurrentIndex(units);
m_unitsEditor = comboBox;
comboBox->setObjectName("infoViewComboBox");
comboBox->setMinimumWidth(60);
QHBoxLayout * hboxLayout = new QHBoxLayout();
hboxLayout->setAlignment(Qt::AlignLeft);
hboxLayout->setContentsMargins(0, 0, 0, 0);
hboxLayout->setSpacing(0);
hboxLayout->setMargin(0);
hboxLayout->addWidget(e1);
hboxLayout->addWidget(comboBox);
QFrame * frame = new QFrame();
frame->setLayout(hboxLayout);
frame->setObjectName("infoViewPartFrame");
connect(e1, SIGNAL(editingFinished()), this, SLOT(widthEntry()));
connect(comboBox, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(unitsEntry(const QString &)));
returnValue = temp + QString::number(units);
returnWidget = frame;
return true;
}
示例7: 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)));
}
示例8: QWidget
GeoReverse::GeoReverse(QWidget *parent) :
QWidget(parent),
ui(new Ui::GeoReverse)
{
ui->setupUi(this);
m_oauthTwitter = new OAuthTwitter(this);
m_oauthTwitter->setNetworkAccessManager(new QNetworkAccessManager(this));
m_oauthTwitter->setOAuthToken("");
m_oauthTwitter->setOAuthTokenSecret("");
QDoubleValidator *latValidator = new QDoubleValidator(ui->latitudeLineEdit);
latValidator->setNotation(QDoubleValidator::StandardNotation);
ui->latitudeLineEdit->setValidator(latValidator);
QDoubleValidator *longValidator = new QDoubleValidator(ui->longitudeLineEdit);
longValidator->setNotation(QDoubleValidator::StandardNotation);
ui->longitudeLineEdit->setValidator(longValidator);
connect(ui->searchPushButton, SIGNAL(clicked()), SLOT(onSearchPushButtonClicked()));
}
示例9: prepareUi
void Advanced::prepareUi()
{
Selection *s = new Selection(this);
connect(ui->actionOpen, SIGNAL(triggered()), this, SLOT(openRaster()));
connect(ui->actionSave_Reprojection, SIGNAL(triggered()), this, SLOT(saveReprojection()));
connect(ui->actionSelection_Screen, SIGNAL(triggered()), s, SLOT(showSelection()));
connect(ui->actionSelection_Screen, SIGNAL(triggered()), this, SLOT(close()));
connect(ui->actionExit, SIGNAL(triggered()), this, SLOT(close()));
connect(ui->actionLoad_Projection_Info, SIGNAL(triggered()), this, SLOT(loadParams()));
connect(ui->actionSave_Projection_Info, SIGNAL(triggered()), this, SLOT(saveParams()));
connect(ui->actionToggle_Preview, SIGNAL(triggered()), this, SLOT(togglePreview()));
connect(ui->actionAbout_dRasterBlaster, SIGNAL(triggered()), s, SLOT(about()));
connect(ui->actionAbout_Qt, SIGNAL(triggered()), s, SLOT(aboutQt()));
connect(ui->actionEdit_Author, SIGNAL(triggered()), s, SLOT(showEditAuthor()));
connect(ui->actionUser_Guide, SIGNAL(triggered()), s, SLOT(showUserGuide()));
connect(ui->fillEnable, SIGNAL(stateChanged(int)), this, SLOT(fillEnable(int)));
connect(ui->noDataValueEnable, SIGNAL(stateChanged(int)), this, SLOT(noDataEnable(int)));
//Validators
QIntValidator *intValid = new QIntValidator(this);
intValid->setBottom(0);
QDoubleValidator *doubleValid = new QDoubleValidator(this);
doubleValid->setNotation(QDoubleValidator::StandardNotation);
doubleValid->setBottom(0.0);
ui->Rows->setValidator(intValid);
ui->Cols->setValidator(intValid);
ui->FillValue->setValidator(intValid);
ui->noDataValue->setValidator(intValid);
ui->pixelSize->setValidator(doubleValid);
//projections p;
//p.callGenerate(_UTM);
//ui->tabProjectionInfo->setLayout(p.projVLayout);
}
示例10: QWidget
ddmFrictionCountyFilterWidget::ddmFrictionCountyFilterWidget( ddmFrictionCountyFilter* filter, QWidget *parent) :
QWidget(parent),
ui(new Ui::ddmFrictionCountyFilterWidget)
{
ui->setupUi( this );
ui->gridLayout->setContentsMargins( 0,0,0,0 );
this->setContentsMargins( 0,0,0,0 );
ui->m_lbTitle->setWordWrap( true );
ui->m_lbWarning->setWordWrap( true );
ui->m_lbWarning->setText( "Некорректно заданны входные значения!" );
ui->m_lbWarning->setStyleSheet( "QLabel { background-color : yellow; }");
ui->m_lbWarning->hide();
int decimals = 7;
double minValue = 0.0, maxValue = 999.0;
QDoubleValidator* leValidator = new QDoubleValidator( minValue, maxValue, decimals, this );
leValidator->setNotation( QDoubleValidator::StandardNotation );
ui->m_leFrom->setValidator( leValidator );
ui->m_leTo->setValidator( leValidator );
ui->m_leFrom->setText( "0,0" );
ui->m_leTo->setText( "0,5" );
m_filter = filter;
installEvents();
}
示例11: Init
void GridSetupUi::Init()
{
east_label_ = new QLabel(STRING_GRID_SETUP_UI_EAST + "(m)");
north_label_ = new QLabel(STRING_GRID_SETUP_UI_NORTH + "(m)");
deep_label_ = new QLabel(STRING_GRID_SETUP_UI_DEEP + "(m)");
n_max_label_ = new QLabel(STRING_GRID_SETUP_UI_MAX_NUM);
e_max_label_ = new QLabel(STRING_GRID_SETUP_UI_MAX_NUM);
d_max_label_ = new QLabel(STRING_GRID_SETUP_UI_MAX_NUM);
n_min_label_ = new QLabel(STRING_GRID_SETUP_UI_MIN_NUM);
e_min_label_ = new QLabel(STRING_GRID_SETUP_UI_MIN_NUM);
d_min_label_ = new QLabel(STRING_GRID_SETUP_UI_MIN_NUM);
n_max_edit_ = new QLineEdit;
e_max_edit_ = new QLineEdit;
d_max_edit_ = new QLineEdit;
n_min_edit_ = new QLineEdit;
e_min_edit_ = new QLineEdit;
d_min_edit_ = new QLineEdit;
QDoubleValidator *validator = new QDoubleValidator(-1000000, 1000000, 1);
validator->setNotation(QDoubleValidator::StandardNotation);
n_max_edit_->setValidator(validator);
e_max_edit_->setValidator(validator);
d_max_edit_->setValidator(validator);
n_min_edit_->setValidator(validator);
e_min_edit_->setValidator(validator);
d_min_edit_->setValidator(validator);
QString strstyle =
"QGroupBox {border-width:1px;border-style:solid;border-color:#DCDCDC;margin-top: 1ex;}"
"QGroupBox::title{subcontrol-origin:margin;subcontrol-position:top left;left:10px;margin-left:0px;padding:0px}";
this->setStyleSheet(strstyle);
}
示例12: rx
PrMpixRead::PrMpixRead(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::PrMpixRead)
{
MPix = new matrixofpixels ;
ZoomInd = true;
ui->setupUi(this);
// QHBoxLayout *layout = new QHBoxLayout(ui->graph_frame);
// layout->setContentsMargins( 0, 0, 0, 0 );
layout = new QHBoxLayout(ui->graph_frame);
layout->setContentsMargins( 0, 0, 0, 0 );
ui->scrool_frame->setVisible(false);
ui->Button_graph->setEnabled(false);
QDoubleValidator *doublevalidator = new QDoubleValidator;
doublevalidator->setNotation(QDoubleValidator::ScientificNotation);
ui->lineEdit_xmin->setValidator(doublevalidator);
ui->lineEdit_xmax->setValidator(doublevalidator);
QRegExp rx("[1-9]\\d{0,3}");
QValidator *v = new QRegExpValidator(rx, this);
ui->lineEdit_nbins->setValidator(v);
// QObject *df = new QObject;
//scene = new QGraphicsScene;
}
示例13: QDialog
CreateIndexDialog::CreateIndexDialog(QWidget *parent, SPHINXProgram::PARAS *pInstance) :
QDialog(parent)
{
this->pInstance = pInstance;
setWindowTitle(tr("Create new PSpace Index"));
setWindowModality(Qt::WindowModal);
previewWindow = new CreateIndexPreview(this);
//handle layout
QVBoxLayout *mainLayout = new QVBoxLayout;
//Construct the file selection box
//input file
this->setStyleSheet("*[valid='false'] { background-color: gray }");
iFile = new QLineEdit(this);
iBtn = new QPushButton("Browse", this);
QObject::connect(iBtn, SIGNAL(pressed()), this, SLOT(GetInputFile()));
iFile->setPlaceholderText("Select a Data File");
QHBoxLayout *iGroupLayout = new QHBoxLayout;
iGroupLayout->addWidget(iFile);
iGroupLayout->addWidget(iBtn);
iGroupBox = new QGroupBox(tr("Data File"));
iGroupBox->setLayout(iGroupLayout);
//output file
oFile = new QLineEdit(this);
oBtn = new QPushButton("Browse", this);
QObject::connect(oBtn, SIGNAL(pressed()), this, SLOT(GetOutputFile()));
oFile->setPlaceholderText("Save Location");
QHBoxLayout *oGroupLayout = new QHBoxLayout;
oGroupLayout->addWidget(oFile);
oGroupLayout->addWidget(oBtn);
oGroupBox = new QGroupBox(tr("Output File"));
oGroupBox->setLayout(oGroupLayout);
//construct the Apriori input box
QDoubleValidator *supConfVal = new QDoubleValidator( 0.01, .99, 2, this );
QDoubleValidator *precisionVal = new QDoubleValidator( 0.00000001, 10000000, 8, this );
supConfVal->setNotation(QDoubleValidator::StandardNotation);
precisionVal->setNotation(QDoubleValidator::StandardNotation);
//minsup
minSup = new QLineEdit(this);
minSup->setValidator(supConfVal);
minSup->setText("0.3");
//minconf
minConf = new QLineEdit(this);
minConf->setValidator(supConfVal);
minConf->setText("0.3");
//size threshold
threshold = new QLineEdit(this);
threshold->setValidator(new QIntValidator(this));
threshold->setText("1");
//precision
precision = new QLineEdit(this);
precision->setValidator(precisionVal);
precision->setText("1.0");
//delimiter
delimiter = new QLineEdit(this);
delimiter->setText(",");
//compression
compressed = new QCheckBox(this);
compressed->setChecked(false);
//quote stripping
stripQuotes = new QCheckBox(this);
stripQuotes->setChecked(true);
QFormLayout *aprioriFormLayout = new QFormLayout;
aprioriGroupBox = new QGroupBox(tr("Import Parameters"));
aprioriFormLayout->addRow(tr("&Minimum Support:"), minSup);
aprioriFormLayout->addRow(tr("&Minimum Confidence:"), minConf);
aprioriFormLayout->addRow(tr("&Threshold Value:"), threshold);
aprioriFormLayout->addRow(tr("&Number Precision:"), precision);
aprioriFormLayout->addRow(tr("&Delimiter:"), delimiter);
aprioriFormLayout->addRow(tr("&Compress JSON:"), compressed);
aprioriFormLayout->addRow(tr("&Strip Quotes:"), stripQuotes);
aprioriGroupBox->setLayout(aprioriFormLayout);
//Construct the save and cancel buttons
save = new QPushButton("Create Index", this);
QObject::connect(save, SIGNAL(pressed()), this, SLOT(CreateIndex()));
//QObject::connect(this, SIGNAL(accepted()), this, SLOT(CreateIndex()));
preview = new QPushButton("Preview Data", this);
QObject::connect(preview, SIGNAL(pressed()), this, SLOT(ShowPreview()));
cancel = new QPushButton(" Cancel ", this);
//.........这里部分代码省略.........
示例14: createEditor
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
QWidget* DynamicTableItemDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
QLineEdit* editor = new QLineEdit(parent);
QDoubleValidator* validator = new QDoubleValidator();
validator->setDecimals(5);
validator->setNotation(QDoubleValidator::StandardNotation);
editor->setValidator(validator);
return editor;
}