当前位置: 首页>>代码示例>>C++>>正文


C++ QDoubleValidator::setDecimals方法代码示例

本文整理汇总了C++中QDoubleValidator::setDecimals方法的典型用法代码示例。如果您正苦于以下问题:C++ QDoubleValidator::setDecimals方法的具体用法?C++ QDoubleValidator::setDecimals怎么用?C++ QDoubleValidator::setDecimals使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QDoubleValidator的用法示例。


在下文中一共展示了QDoubleValidator::setDecimals方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setupAmountWidget

void setupAmountWidget(QLineEdit *widget, QWidget *parent)
{
    QDoubleValidator *amountValidator = new QDoubleValidator(parent);
    amountValidator->setDecimals(8);
    amountValidator->setBottom(0.0);
    widget->setValidator(amountValidator);
    widget->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
}
开发者ID:gollumcoin,项目名称:gollumcoin,代码行数:8,代码来源:guiutil.cpp

示例2: setupAmountWidget

void setupAmountWidget(QLineEdit *widget, QWidget *parent)
{
    QDoubleValidator *amountValidator = new QDoubleValidator(parent);
    amountValidator->setDecimals(8);
    amountValidator->setBottom(0.0);
    widget->setValidator(amountValidator);
    widget->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
    widget->setStyleSheet("color: white; background: transparent");
}
开发者ID:coinkeeper,项目名称:2015-06-22_19-17_bitcredits,代码行数:9,代码来源:guiutil.cpp

示例3: QDialog

/*! Constructor */
AnalysisParameterDialog::AnalysisParameterDialog(QWidget* parent, const AnalysisInfo &analysisInfo) : QDialog(parent){
	//Store variables
	this->info = analysisInfo;

	//Create layouts
	QVBoxLayout* mainVerticalBox = new QVBoxLayout(this);
	QGridLayout* gridLayout = new QGridLayout();
	gridLayout->setMargin(10);

	//Validators for double and integer parameters
	QDoubleValidator* doubleValidator = new QDoubleValidator(this);
	doubleValidator->setDecimals(5);
	QIntValidator* intValidator = new QIntValidator(0, 50, this);

	//Add the description
	gridLayout->addWidget(new QLabel("Analysis description: "), 0, 0);
	descriptionEdit = new QLineEdit(info.getDescription());
	gridLayout->addWidget(descriptionEdit, 0, 1);

	//Add the number of threads
	gridLayout->addWidget(new QLabel("Number of simultaneous threads: "), 1, 0);
	numThreadsEdit = new QLineEdit(QString::number(info.getNumberOfThreads()));
	numThreadsEdit->setValidator(intValidator);
	gridLayout->addWidget(numThreadsEdit, 1, 1);

	//Add the parameters
	int cntr = 2;
	for(QHash<QString, double>::iterator iter = info.getParameterMap().begin(); iter != info.getParameterMap().end(); ++iter){
		gridLayout->addWidget(new QLabel(iter.key()), cntr, 0);
		QLineEdit* tmpEdit = new QLineEdit(QString::number(iter.value(), 'g', 10));//'g' sets the output similar to sprintf; 10 is the maximum precision
		tmpEdit->setValidator(doubleValidator);
		//Disable parameter editing if it is loaded from the database
		if(analysisInfo.getID() != 0){
			tmpEdit->setEnabled(false);
		}
		gridLayout->addWidget(tmpEdit, cntr, 1);
		editMap[iter.key()] = tmpEdit;
		++cntr;
	}
	mainVerticalBox->addLayout(gridLayout);

	//Add Ok and Cancel buttons
	QHBoxLayout *okCanButtonBox = new QHBoxLayout();
	QPushButton *okPushButton = new QPushButton("Ok");
	connect(okPushButton, SIGNAL(clicked()), this, SLOT(okButtonClicked()));
	QPushButton *cancelPushButton = new QPushButton("Cancel");
	connect(cancelPushButton, SIGNAL(clicked()), this, SLOT(reject()));
	okCanButtonBox->addWidget(okPushButton);
	okCanButtonBox->addWidget(cancelPushButton);
	mainVerticalBox->addLayout(okCanButtonBox);

}
开发者ID:nico202,项目名称:spikestream,代码行数:53,代码来源:AnalysisParameterDialog.cpp

示例4: setupGui

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void TiltAngleGroupBox::setupGui()
{
  // Put a file path completer to help out the user to select a valid file
  QFileCompleter* com = new QFileCompleter(this, false);
  rawTltFile->setCompleter(com);
  QObject::connect( com, SIGNAL(activated(const QString&)),
                    this, SLOT(on_rawTltFile_textChanged(const QString&)));

  {
    QDoubleValidator* dVal = new QDoubleValidator(this);
    dVal->setDecimals(6);
    startingAngle->setValidator(dVal);
  }

  {
    QDoubleValidator* dVal = new QDoubleValidator(this);
    dVal->setDecimals(6);
    increment->setValidator(dVal);
  }

  rawTltBtn->toggle();
  rawTltBtn->toggle();
  noTilts->setChecked(true);
}
开发者ID:OpenMBIR,项目名称:openmbir,代码行数:27,代码来源:TiltAngleGroupBox.cpp

示例5: SubQLineEdit

   QWidget *DynamicFloatControl::createEditor(QWidget* parent,
      const QStyleOptionViewItem& option, const QModelIndex& index)
   {
      // create and init the edit box
      mTemporaryEditControl = new SubQLineEdit(parent, this);
      QDoubleValidator* validator = new QDoubleValidator(mTemporaryEditControl);
      validator->setDecimals(NUM_DECIMAL_DIGITS_FLOAT);
      mTemporaryEditControl->setValidator(validator);

      if (!mInitialized)
      {
         LOG_ERROR("Tried to add itself to the parent widget before being initialized");
         return mTemporaryEditControl;
      }

      updateEditorFromModel(mTemporaryEditControl);

      mTemporaryEditControl->setToolTip(getDescription());

      return mTemporaryEditControl;
   }
开发者ID:VRAC-WATCH,项目名称:deltajug,代码行数:21,代码来源:dynamicfloatcontrol.cpp

示例6: QLineEdit

QWidget* GCF::Components::NumberEditorCreator::createEditor(QWidget* parent)
{
    QLineEdit* lineEdit = new QLineEdit(parent);
    lineEdit->setFrame(true);

    QValidator* validator = 0;
    if(mType == QVariant::Double)
    {
        QDoubleValidator* dv = new QDoubleValidator(lineEdit);
        dv->setDecimals(2);
        validator = dv;
    }
    else
    {
        QIntValidator* iv = new QIntValidator(lineEdit);
        validator = iv;
    }

    lineEdit->setValidator(validator);
    return lineEdit;
}
开发者ID:banduladh,项目名称:levelfour,代码行数:21,代码来源:ValueEditorCreators.cpp

示例7: 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;
}
开发者ID:BlueQuartzSoftware,项目名称:SIMPLView,代码行数:12,代码来源:DynamicTableItemDelegate.cpp


注:本文中的QDoubleValidator::setDecimals方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。