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);
}
Exemple #2
0
QWidget*CoordinateItemDelegate::createEditor( QWidget* parent, const QStyleOptionViewItem&, const QModelIndex& index ) const
{
  QLineEdit* lineEdit = new QLineEdit( parent );
  QDoubleValidator* validator = new QDoubleValidator();
  if ( !index.data( MinRadiusRole ).isNull() )
    validator->setBottom( index.data( MinRadiusRole ).toDouble() );
  lineEdit->setValidator( validator );
  return lineEdit;
}
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");
}
Exemple #4
0
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;
	}
void PropertyEditDelegate::setModelData(QWidget* editor_,
                                        QAbstractItemModel* model_,
                                        const QModelIndex& index) const
{
    const QVariant& data = index.data();
    GeneratorPropertiesModel* model =
        static_cast<GeneratorPropertiesModel*>(model_);

    switch (data.type())
    {
    case QVariant::Double:
    {
        QLineEdit* editor = static_cast<QLineEdit*>(editor_);
        model->setData(index, editor->text().toDouble(), Qt::EditRole);
        break;
    }
    case QVariant::Int:
    {
        QSpinBox* editor = static_cast<QSpinBox*>(editor_);
        editor->interpretText();
        model->setData(index, editor->value(), Qt::EditRole);
        break;
    }
    case QVariant::Bool:
    {
        QCheckBox* editor = static_cast<QCheckBox*>(editor_);
        const bool value = editor->checkState() == Qt::Checked;
        model->setData(index, value, Qt::EditRole);
        break;
    }
    case QVariant::List:
    {
        QLineEdit* editor = static_cast<QLineEdit*>(editor_);
        QStringList list = editor->text().split(",");
        QVariantList varList;
        QDoubleValidator validator;
        for (QString& str : list)
        {
            if (str == "")
                continue;

            int pos = 0;
            if (validator.validate(str, pos) == QValidator::Acceptable)
                varList.push_back(QVariant(str.toDouble()));
            else
                varList.push_back(QVariant(-1.0));
        }
        model->setData(index, varList, Qt::EditRole);
        break;
    }
    default:
    {
        break;
    }
    }
}
Exemple #6
0
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)));
}
/*! 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);

}
/* Dialog box for editing location parameters: central body,
 * latitude, longitude, and altitude.
 */
LocationEditorDialog::LocationEditorDialog(QWidget* parent) :
    QDialog(parent)
{
    setupUi(this);

    // Set up the input validators
    QDoubleValidator* doubleValidator = new QDoubleValidator(this);
    QDoubleValidator* angleValidator = new QDoubleValidator(this);
    angleValidator->setBottom(-360.0);
    angleValidator->setTop(360.0);
    
    latitudeEdit->setValidator(angleValidator);
    longitudeEdit->setValidator(angleValidator);
    altitudeEdit->setValidator(doubleValidator);
}
// Default constructor
QGAppParamInputReal::QGAppParamInputReal(qgar::QgarAppParamDescr * descr,
					 QGAppDialogMediator * med,
					 QWidget * parent,
					 QGridLayout * layout)

  : QGAbstractAppParamInput(descr, med, parent, layout)
{
  //-- create value box and validator

  _value = new QLineEdit(this);
  QDoubleValidator * valid = new QDoubleValidator(_value);
  _value->setValidator(valid);

  _value->setAlignment(Qt::AlignRight);
  _value->setSizePolicy(QSizePolicy(QSizePolicy::Maximum,
				    QSizePolicy::Maximum));

  //-- Set value bounds and default value

  if (_descr->defaultValue() != "")
    _value->setText(_descr->defaultValue().c_str());


  double val;
  bool ok; 

  val = QString(_descr->minValue().c_str()).toDouble(&ok);
 
  if (ok)
    valid->setBottom(val);

  val = QString(_descr->maxValue().c_str()).toDouble(&ok);
  if (ok)
    valid->setTop(val);
  

  this->setEnabled(enabled());
  

  _layout->addWidget(_value);

  // Connect line edit to the slot that fwds notification to the
  // mediator
  connect(_value, 
	  SIGNAL(textChanged(const QString&)),
	  SLOT(valueChanged()));
}
/*!
  This checks the validators to make sure the number of friction cone vectors
  and the dynamic time step are within their ranges.  If they aren't, a
  warning box explaining the problem is created.  Otherwise, the dialog
  is closed and accepted.
*/
void SettingsDlg::validateDlg()
{
  int zero=0;
  QString tst = dlgUI->timeStepLine->text();
  QString msg;
  QDoubleValidator *tsv = (QDoubleValidator *)dlgUI->timeStepLine->validator();

  if (tsv->validate(tst,zero) != QValidator::Acceptable) {
    msg = QString("Dynamic time step must be between %1 and %2").arg(tsv->bottom()).arg(tsv->top()); 
  }
     
  if (!msg.isEmpty()) {
    QMessageBox::warning(NULL,"GraspIt!",msg,QMessageBox::Ok, Qt::NoButton,Qt::NoButton);
  } else {
    dlgImpl->accept();
  }
}
void ICParameterRange::UpdateConfigRangeValidator(uint type, double min, double max)
{
    if(!configsRangeCache_.contains(type)) return;
    QDoubleValidator* dv = static_cast<QDoubleValidator*>(configsRangeCache_.value(type));
    if(dv != NULL)
    {
        dv->setBottom(min);
        dv->setTop(max);
        return;
    }
    QIntValidator* iv = static_cast<QIntValidator*>(configsRangeCache_.value(type));
    if(iv != NULL)
    {
        iv->setBottom(min);
        iv->setTop(max);
    }
}
transmitterPayloadDialog::transmitterPayloadDialog( QWidget * parent, Qt::WindowFlags f) : QDialog(parent,f)
{
	setupUi(this);

    QDoubleValidator* positiveDoubleValidator = new QDoubleValidator(this);
    positiveDoubleValidator->setBottom(0.0);

    QDoubleValidator* efficiencyValidator = new QDoubleValidator(this);
    efficiencyValidator->setBottom(0.0);
    efficiencyValidator->setTop(100.0);

    // changed this to range -90, 90 to turn antennas also in direction of space (need it for ground stations with antennas)
    QDoubleValidator* elevationValidator = new QDoubleValidator(this);
    elevationValidator->setRange(-90, 90, 2);

    ElLineEdit->setValidator(elevationValidator);
    //ElLineEdit->setValidator(positiveDoubleValidator);

    TxFeederLossLineEdit->setValidator(positiveDoubleValidator);
    TxDepointingLossLineEdit->setValidator(positiveDoubleValidator);
    GainLineEdit->setValidator(positiveDoubleValidator);
    DiameterLineEdit->setValidator(positiveDoubleValidator);
    BeamLineEdit->setValidator(positiveDoubleValidator);
    TiltLineEdit->setValidator(positiveDoubleValidator);
    EfficiencyLineEdit->setValidator(efficiencyValidator);
    FrequencyLineEdit->setValidator(positiveDoubleValidator);
    PowerLineEdit->setValidator(positiveDoubleValidator);
    DataRateLineEdit->setValidator(positiveDoubleValidator);

    ConeAngleLineEdit->setValidator(positiveDoubleValidator);
    HorAngleLineEdit->setValidator(positiveDoubleValidator);
    VertAngleLineEdit->setValidator(positiveDoubleValidator);
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void TextureDialog::setupGui()
{
  if(Ebsd::CrystalStructure::Check::IsCubic(m_CrystalStructure) )
  {
    m_Presets = CubicTexturePresets::getTextures();
  }
  else if(Ebsd::CrystalStructure::Check::IsHexagonal(m_CrystalStructure) )
  {
    m_Presets = HexTexturePresets::getTextures();
  }

  // Clear the list view;
  presetListWidget->clear();

  // Now push the list into the List View
  for (TexturePreset::Container::iterator iter = m_Presets.begin(); iter != m_Presets.end(); ++iter)
  {
    presetListWidget->addItem(QString::fromStdString((*iter)->getName()));
  }

  {
    QDoubleValidator* validator = new QDoubleValidator(euler1);
    validator->setDecimals(4);
    euler1->setValidator(validator);
  }
  {
    QDoubleValidator* validator = new QDoubleValidator(euler2);
    validator->setDecimals(4);
    euler2->setValidator(validator);
  }
  {
    QDoubleValidator* validator = new QDoubleValidator(euler3);
    validator->setDecimals(4);
    euler3->setValidator(validator);
  }
  {
    QDoubleValidator* validator = new QDoubleValidator(weight);
    validator->setDecimals(4);
    weight->setValidator(validator);
  }
  {
    sigma->setRange(1.0, 1.0);
    if (Ebsd::CrystalStructure::Check::IsCubic(m_CrystalStructure ) )
    {
      sigma->setRange(1.0, 18.0);
    }
    else if (Ebsd::CrystalStructure::Check::IsHexagonal(m_CrystalStructure) )
    {
      sigma->setRange(1.0, 36.0);
    }
  }
}
void ICParameterRange::UpdateConfigRangeValidator(const ICAddrWrapper *addr, double value)
{
//    QMap<const ICAddrWrapper*, uint>::iterator p = addrToMaxValidator_.find(addr);
    value /= qPow(10, addr->Decimal());
    QList<uint> vs = addrToMaxValidator_.values(addr);
    for(int i = 0; i != vs.size(); ++i)
    {
        if(!configsRangeCache_.contains(vs.at(i))) continue;
        QDoubleValidator* dv = static_cast<QDoubleValidator*>(configsRangeCache_.value(vs.at(i)));
        if(dv != NULL)
        {
            dv->setTop(value);
//            ++p;
            continue;
        }
        QIntValidator* iv = static_cast<QIntValidator*>(configsRangeCache_.value(vs.at(i)));
        if(iv != NULL)
        {
            iv->setTop(value);
        }
    }

    vs  = addrToMinValidator_.values(addr);
    for(int i = 0; i != vs.size(); ++i)
    {
        if(!configsRangeCache_.contains(vs.at(i))) continue;
        QDoubleValidator* dv = static_cast<QDoubleValidator*>(configsRangeCache_.value(vs.at(i)));
        if(dv != NULL)
        {
            dv->setBottom(value);
//            ++p;
            continue;
        }
        QIntValidator* iv = static_cast<QIntValidator*>(configsRangeCache_.value(vs.at(i)));
        if(iv != NULL)
        {
            iv->setBottom(value);
        }
    }

}
Exemple #15
0
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()));
}
void DigDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex& index) const {
    QLineEdit *le = qobject_cast<QLineEdit*>(editor);
    QString value = le->text();
    int pos = 0;

    if (m_type == "DBL") {
        QDoubleValidator *dv = new QDoubleValidator(le);
        QValidator::State state = dv->validate(value,pos);
        if (state != QValidator::Acceptable) {
            return;
        }
    }
    if (m_type == "INT") {
        QIntValidator *iv = new QIntValidator(le);
        QValidator::State state = iv->validate(value,pos);
        if (state != QValidator::Acceptable) {
            return;
        }
    }
    model->setData(index, value);
}
   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;
   }
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;
}
Exemple #19
0
picPunto::picPunto(QWidget *parent) :  QDialog(parent)
{
    cnt = 0;    
    QStringList txtformats;

    QGridLayout *mainLayout = new QGridLayout;
//readSettings();

    QPushButton *filebut = new QPushButton(tr("File..."));
    fileedit = new QLineEdit();

    QDoubleValidator *val = new QDoubleValidator(0);
    val->setBottom ( 0.0 );
    scaleedit = new QLineEdit();
    scaleedit->setValidator(val);

    QFormLayout *flo = new QFormLayout;
    flo->addRow( filebut, fileedit);
    flo->addRow( tr("Scale:"), scaleedit);
    mainLayout->addLayout(flo, 0, 0);

    QHBoxLayout *loacceptcancel = new QHBoxLayout;
    QPushButton *acceptbut = new QPushButton(tr("Accept"));
    loacceptcancel->addStretch();
    loacceptcancel->addWidget(acceptbut);

    QPushButton *cancelbut = new QPushButton(tr("Cancel"));
    loacceptcancel->addWidget(cancelbut);
    mainLayout->addLayout(loacceptcancel, 1, 0);

    setLayout(mainLayout);
    readSettings();

    connect(cancelbut, SIGNAL(clicked()), this, SLOT(reject()));
    connect(acceptbut, SIGNAL(clicked()), this, SLOT(checkAccept()));

    connect(filebut, SIGNAL(clicked()), this, SLOT(dptFile()));
}
Exemple #20
0
void CDSAttrQLineEdit::chaosValueTypeChanged(int new_type) {
    //setup the input patter according to the type
    switch(new_type) {
    case chaos::DataType::TYPE_BOOLEAN: {
        QRegExpValidator *validator = new QRegExpValidator(QRegExp(tr("[01]{1}")), this);
        setValidator(validator);
        break;
    }
    case chaos::DataType::TYPE_INT32: {
        QIntValidator *validator = new QIntValidator(std::numeric_limits<int32_t>::min(),
                                                     std::numeric_limits<int32_t>::max(),
                                                     this);
        setValidator(validator);
        break;
    }
    case chaos::DataType::TYPE_INT64:{
        QIntValidator *validator = new QIntValidator(std::numeric_limits<int64_t>::min(),
                                                     std::numeric_limits<int64_t>::max(),
                                                     this);
        setValidator(validator);
        break;
    }
    case chaos::DataType::TYPE_DOUBLE:{
        QDoubleValidator *validator = new QDoubleValidator(-1 * std::numeric_limits<double>::max(),
                                                           std::numeric_limits<double>::max(),
                                                           2,
                                                           this);
        validator->setNotation(QDoubleValidator::StandardNotation);
        setValidator(validator);
        break;
    }
    case chaos::DataType::TYPE_STRING:
        break;
    default:
        break;
    }
}
Exemple #21
0
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);
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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);
}
Exemple #23
0
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;
}
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();
}
Exemple #25
0
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);
}
Exemple #26
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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();

}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
QWidget* SGPowerLawItemDelegate::createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
  QLineEdit* alpha;
  QLineEdit* beta;
  QDoubleValidator* alphaValidator;
  QDoubleValidator* betaValidator;
  QLineEdit* k;
  QDoubleValidator* kValidator;

  QComboBox* colorCombo;

  qint32 col = index.column();
  switch(col)
  {
    case SGPowerLawTableModel::BinNumber:
      return NULL;
      break;

    case SGPowerLawTableModel::Alpha:
      alpha = new QLineEdit(parent);
      alpha->setFrame(false);
      alphaValidator = new QDoubleValidator(alpha);
      alphaValidator->setDecimals(6);
      alpha->setValidator(alphaValidator);
      return alpha;
    case SGPowerLawTableModel::K:
      k = new QLineEdit(parent);
      k->setFrame(false);
      kValidator = new QDoubleValidator(k);
      kValidator->setDecimals(6);
      k->setValidator(kValidator);
      return k;
    case SGPowerLawTableModel::Beta:
      beta = new QLineEdit(parent);
      beta->setFrame(false);
      betaValidator = new QDoubleValidator(beta);
      betaValidator->setDecimals(6);
      beta->setValidator(betaValidator);
      return beta;
    case SGPowerLawTableModel::LineColor:
      colorCombo = new QtSColorComboPicker(parent);
      return colorCombo;
    default:
      break;
  }
  return QStyledItemDelegate::createEditor(parent, option, index);
}
Exemple #28
0
QWidget * ExtArgNumber::createEditor(QWidget * parent)
{
    QString storeValue;
    QString text = defaultValue();

    if ( _argument->storeval )
    {
        QString storeValue = _argument->storeval;

        if ( storeValue.length() > 0 && storeValue.compare(text) != 0 )
            text = storeValue;
    }

    textBox = (QLineEdit *)ExtArgText::createEditor(parent);
    textBox->disconnect(SIGNAL(textChanged(QString)));

    if ( _argument->arg_type == EXTCAP_ARG_INTEGER || _argument->arg_type == EXTCAP_ARG_UNSIGNED )
    {
        QIntValidator * textValidator = new QIntValidator(parent);
        if ( _argument->range_start != NULL )
        {
            int val = 0;
            if ( _argument->arg_type == EXTCAP_ARG_INTEGER )
                val = extcap_complex_get_int(_argument->range_start);
            else if ( _argument->arg_type == EXTCAP_ARG_UNSIGNED )
            {
                guint tmp = extcap_complex_get_uint(_argument->range_start);
                if ( tmp > G_MAXINT )
                {
                    g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "Defined value for range_start of %s exceeds valid integer range", _argument->call );
                    val = G_MAXINT;
                }
                else
                    val = (gint)tmp;
            }

            textValidator->setBottom(val);
        }
        if ( _argument->arg_type == EXTCAP_ARG_UNSIGNED && textValidator->bottom() < 0 )
        {
            g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "%s sets negative bottom range for unsigned value, setting to 0", _argument->call );
            textValidator->setBottom(0);
        }

        if ( _argument->range_end != NULL )
        {
            int val = 0;
            if ( _argument->arg_type == EXTCAP_ARG_INTEGER )
                val = extcap_complex_get_int(_argument->range_end);
            else if ( _argument->arg_type == EXTCAP_ARG_UNSIGNED )
            {
                guint tmp = extcap_complex_get_uint(_argument->range_end);
                if ( tmp > G_MAXINT )
                {
                    g_log(LOG_DOMAIN_CAPTURE, G_LOG_LEVEL_DEBUG, "Defined value for range_end of %s exceeds valid integer range", _argument->call );
                    val = G_MAXINT;
                }
                else
                    val = (gint)tmp;
            }

            textValidator->setTop(val);
        }
        textBox->setValidator(textValidator);
    }
    else if ( _argument->arg_type == EXTCAP_ARG_DOUBLE )
    {
        QDoubleValidator * textValidator = new QDoubleValidator(parent);
        if ( _argument->range_start != NULL )
            textValidator->setBottom(extcap_complex_get_double(_argument->range_start));
        if ( _argument->range_end != NULL )
            textValidator->setTop(extcap_complex_get_double(_argument->range_end));

        textBox->setValidator(textValidator);
    }

    textBox->setText(text.trimmed());

    connect(textBox, SIGNAL(textChanged(QString)), SLOT(onStringChanged(QString)));

    return textBox;
}
Exemple #29
0
void reassignLotSerial::sReassign()
{
  XSqlQuery reassignReassign;
  if (_expirationDate->isEnabled())
  {
    if (!_expirationDate->isValid() || _expirationDate->isNull())
    {
      QMessageBox::critical( this, tr("Enter a valid date"),
                             tr("You must enter a valid expiration date before you can continue.") );
      _expirationDate->setFocus();
      return;
    }
  }
	
  if (_source->currentItem() == 0)
  {
    QMessageBox::critical( this, tr("Select Source Location"),
                           tr("You must select a Source Location before reassigning its Lot/Serial #.") );
    _source->setFocus();
    return;
  }

  if (_qty->toDouble() == 0)
  {
    QMessageBox::critical( this, tr("Enter Quantity to Reassign"),
                           tr("You must enter a quantity to reassign.") );
    _qty->setFocus();
    return;
  }

  if (_lotNumber->text().length() == 0)
  {
    QMessageBox::critical( this, tr("Enter New Lot Number to Reassign"),
                           tr("You must enter a New Lot Number to reassign.") );
    _qty->setFocus();
    return;
  }

  QDoubleValidator* qtyVal = (QDoubleValidator*)(_qty->validator());
  reassignReassign.prepare("SELECT reassignLotSerial(:source, CAST (:qty AS NUMERIC(100,:decimals)), "
	    "                         :lotNumber, :expirationDate, :warrantyDate) AS result;");
  reassignReassign.bindValue(":source", _source->id());
  reassignReassign.bindValue(":qty", _qty->toDouble());
  reassignReassign.bindValue(":decimals", qtyVal->decimals());
  reassignReassign.bindValue(":lotNumber", _lotNumber->text());

  if (_expirationDate->isEnabled())
    reassignReassign.bindValue(":expirationDate", _expirationDate->date());
  else
    reassignReassign.bindValue(":expirationDate", omfgThis->endOfTime());

  if (_warrantyDate->isEnabled())
    reassignReassign.bindValue(":warrantyDate", _warrantyDate->date());

  reassignReassign.exec();
  if (reassignReassign.first())
  {
    int result = reassignReassign.value("result").toInt();
    if (result < 0)
    {
      systemError(this, storedProcErrorLookup("reassignLotSerial", result),
		  __FILE__, __LINE__);
      return;
    }
  }
  else if (reassignReassign.lastError().type() != QSqlError::NoError)
  {
    systemError(this, reassignReassign.lastError().databaseText(), __FILE__, __LINE__);
    return;
  }

  if (_captive)
    accept();
  else
  {
    _close->setText(tr("&Close"));

    sFillList();

    if (_qty->isEnabled())
      _qty->clear();

    _qty->setFocus();
    _lotNumber->clear();
    _expirationDate->setNull();
    _warrantyDate->setNull();
  }
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
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;
}