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); }
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; }
void Console::setDoubleValidator(QLineEdit* const lineEdit){ QDoubleValidator* doubleValidator = new QDoubleValidator(lineEdit); doubleValidator->setNotation(QDoubleValidator::StandardNotation); doubleValidator->setDecimals(10); lineEdit->setValidator(doubleValidator); }
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); }
//================================================================================ void customLineEdit::setRange(double min, double max, int decimals) { QDoubleValidator * v = new QDoubleValidator(min,max,decimals,this) ; v->setNotation(QDoubleValidator::ScientificNotation); // this->setValidator(v) ; }
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; }
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))); }
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 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 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; } }
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(); }
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); }
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; }
GraphicalValue * GraphicalValue::createFromOption(Option::ConstPtr option, QWidget * parent) { GraphicalValue * value = nullptr; if(option.get() == nullptr) return value; std::string tag(option->tag()); if(tag != "array" ) { if(option->has_restricted_list()) value = new GraphicalRestrictedList(option, parent); else { std::string type(option->type()); if(type == Protocol::Tags::type<bool>()) // bool option value = new GraphicalBool(option->value<bool>(), parent); else if(type == Protocol::Tags::type<Real>()) // Real option value = new GraphicalDouble(option->value<Real>(), parent); else if(type == Protocol::Tags::type<int>()) // int option value = new GraphicalInt(false, option->value<int>(), parent); else if(type == Protocol::Tags::type<Uint>()) // Uint option value = new GraphicalInt(true, option->value<Uint>(), parent); else if(type == Protocol::Tags::type<std::string>()) // string option value = new GraphicalString(option->value<std::string>().c_str(), parent); else if(type == Protocol::Tags::type<URI>()) // URI option value = new GraphicalUri(boost::dynamic_pointer_cast<OptionURI const>(option), parent); else throw CastingFailed(FromHere(), tag + ": Unknown type"); } } else { if(option->has_restricted_list()) value = new GraphicalArrayRestrictedList(option, parent); else { OptionArray::ConstPtr array = boost::dynamic_pointer_cast<OptionArray const>(option); std::string value_str( array->value_str() ); std::string type( array->elem_type() ); QString sep( array->separator().c_str() ); if(type == Protocol::Tags::type<bool>()) // bool option { QRegExp regex("(true)|(false)|(1)|(0)|(on)|(off)"); value = new GraphicalArray(new QRegExpValidator(regex, parent), sep, parent); } else if(type == Protocol::Tags::type<Real>()) // Real option { QDoubleValidator * val = new QDoubleValidator(nullptr); val->setNotation(QDoubleValidator::ScientificNotation); value = new GraphicalArray(val, sep, parent); } else if(type == Protocol::Tags::type<int>()) // int option value = new GraphicalArray(new QIntValidator(), sep, parent); else if(type == Protocol::Tags::type<Uint>()) // Uint option { QIntValidator * val = new QIntValidator(); val->setBottom(0); value = new GraphicalArray(val, sep, parent); } else if(type == Protocol::Tags::type<std::string>()) // string option value = new GraphicalArray(nullptr,sep, parent); else if(type == Protocol::Tags::type<URI>()) // URI option value = new GraphicalUriArray(sep, parent); else throw CastingFailed(FromHere(), tag + ": Unknown type"); value->setValue( QString(value_str.c_str()).split(array->separator().c_str()) ); } } return value; }
DeferredShading::DeferredShading(QWidget *parent, Qt::WFlags flags) : QMainWindow(parent, flags) { ui.setupUi(this); // Layouts QHBoxLayout *mainLayout = new QHBoxLayout; QVBoxLayout *secondLayout = new QVBoxLayout; QHBoxLayout *thirdLayout = new QHBoxLayout; // Menus // File QMenu *fileMenu = menuBar()->addMenu(tr("&File")); QAction *loadModelAct = new QAction(tr("&Load Model"), this); fileMenu->addAction(loadModelAct); // Render QMenu *renderMenu = menuBar()->addMenu(tr("&Render")); QAction *forwardRenderAct = new QAction(tr("&Forward"), this); QAction *forwardBlendRenderAct = new QAction(tr("&Forward(Blend)"), this); QAction *deferredRenderAct = new QAction(tr("&Deferred"), this); QAction *forwardPlusRenderAct = new QAction(tr("&Forward+"), this); QAction *forwardPlusCudaRenderAct = new QAction(tr("&Forward+(CUDA)"), this); QAction *positionRenderAct = new QAction(tr("&Position"), this); QAction *diffuseRenderAct = new QAction(tr("&Diffuse"), this); QAction *normalRenderAct = new QAction(tr("&Normal"), this); QAction *allRenderAct = new QAction(tr("&All"), this); QAction *depthRenderAct = new QAction(tr("&Depth"), this); QAction *gridRenderAct = new QAction(tr("&Lighting Grid"), this); renderMenu->addAction(forwardRenderAct); renderMenu->addAction(forwardBlendRenderAct); renderMenu->addAction(deferredRenderAct); renderMenu->addAction(forwardPlusRenderAct); renderMenu->addAction(forwardPlusCudaRenderAct); renderMenu->addSeparator(); renderMenu->addAction(positionRenderAct); renderMenu->addAction(diffuseRenderAct); renderMenu->addAction(normalRenderAct); renderMenu->addAction(allRenderAct); renderMenu->addSeparator(); renderMenu->addAction(depthRenderAct); renderMenu->addAction(gridRenderAct); // Validators QDoubleValidator *_doubleValidator = new QDoubleValidator(0.01,10.0,2); _doubleValidator->setNotation(QDoubleValidator::StandardNotation); QDoubleValidator *doubleValidator = new QDoubleValidator(0.01,10000.0,2); doubleValidator->setNotation(QDoubleValidator::StandardNotation); QIntValidator *intValidator = new QIntValidator(0,N_MAX_LIGHTS); QIntValidator *intValidator2 = new QIntValidator(0,4096); // Separators QFrame *line = new QFrame(); line->setFrameShape(QFrame::VLine); QFrame *line2 = new QFrame(); line2->setFrameShape(QFrame::VLine); QFrame *line3 = new QFrame(); line3->setFrameShape(QFrame::VLine); QFrame *line4 = new QFrame(); line4->setFrameShape(QFrame::VLine); // Camera Sensitivity QLabel *sensibilityLabel = new QLabel(); sensibilityLabel->setText("Sensitivity: "); QLineEdit *cameraSensitivityIn = new QLineEdit(); cameraSensitivityIn->setValidator(doubleValidator); cameraSensitivityIn->setText("0.1"); // Camera Speed QLabel *speedLabel = new QLabel(); speedLabel->setText("Speed: "); QLineEdit *cameraSpeedIn = new QLineEdit(); cameraSpeedIn->setValidator(doubleValidator); cameraSpeedIn->setText("1.0"); // Threshold (deferred only) QLabel *thresholdLabel = new QLabel(); thresholdLabel->setText("Threshold: "); QLineEdit *thresholdIn = new QLineEdit(); thresholdIn->setValidator(intValidator2); thresholdIn->setText("256"); // Billboards //QLabel *billboardsLabel = new QLabel(); //billboardsLabel->setText("Billboards: "); QCheckBox *billboardsCheckBox = new QCheckBox("Billboards:"); billboardsCheckBox->setLayoutDirection(Qt::RightToLeft); billboardsCheckBox->setChecked(false); // Light bounding box scale QLabel *lightBBScaleLabel = new QLabel(); lightBBScaleLabel->setText(" Bb scale: "); QLineEdit *lighBBScaleIn = new QLineEdit(); lighBBScaleIn->setValidator(doubleValidator); lighBBScaleIn->setText("1.0"); // Attenuation QLabel *attenuationLabel = new QLabel(); attenuationLabel->setText("Attenuation: "); QLineEdit *constantAttIn = new QLineEdit(); constantAttIn->setValidator(doubleValidator); constantAttIn->setText("1.0"); QLineEdit *linearAttIn = new QLineEdit(); linearAttIn->setValidator(doubleValidator); linearAttIn->setText("60.0"); QLineEdit *expAttIn = new QLineEdit(); expAttIn->setValidator(doubleValidator); expAttIn->setText("0.0"); // Light intensity QLabel *lightIntesityLabel = new QLabel(); lightIntesityLabel->setText("Intensity: "); QLineEdit *lighIntensityIn = new QLineEdit(); lighIntensityIn->setValidator(doubleValidator); lighIntensityIn->setText("1.0"); // Number of lights QLabel *nLightsLabel = new QLabel(); nLightsLabel->setText("N: "); std::stringstream sstm; sstm << INITIAL_LIGHTS; std::string s = sstm.str(); // QString::fromStdString desnt work on release #ifdef NDEBUG nLights = "20"; #else nLights = QString::fromStdString(s); #endif QLineEdit *nLightsIn = new QLineEdit(); nLightsIn->setValidator(intValidator); nLightsIn->setText(nLights); QPushButton *genLightsButton = new QPushButton("Gen. Lights"); // Render Mode QLabel *renderModeLabel = new QLabel(); renderModeLabel->setText("Forward"); renderModeLabel->setAlignment(Qt::AlignRight); // FPS QLabel *fpsLabelNum = new QLabel(); fpsLabelNum->setNum(0); fpsLabelNum->setAlignment(Qt::AlignRight); fpsLabelNum->setMaximumHeight(20); QLabel *fpsLabel = new QLabel(); fpsLabel->setText("FPS: "); fpsLabel->setAlignment(Qt::AlignRight); // GLWidget GLWidget *glWidget = new GLWidget; // Connect signals-slots connect(loadModelAct,SIGNAL(triggered()), this, SLOT(loadModelDia())); connect(this,SIGNAL(modelPathChange(std::string)), glWidget, SLOT(loadModel(std::string))); connect(forwardRenderAct,SIGNAL(triggered()), glWidget, SLOT(setForwardRenderMode())); connect(forwardBlendRenderAct,SIGNAL(triggered()), glWidget, SLOT(setForwardBlendRenderMode())); connect(forwardPlusRenderAct,SIGNAL(triggered()), glWidget, SLOT(setForwardPlusRenderMode())); connect(forwardPlusCudaRenderAct,SIGNAL(triggered()), glWidget, SLOT(setForwardPlusCudaRenderMode())); connect(deferredRenderAct,SIGNAL(triggered()), glWidget, SLOT(setDeferredRenderMode())); connect(positionRenderAct,SIGNAL(triggered()), glWidget, SLOT(setPositionRenderMode())); connect(diffuseRenderAct,SIGNAL(triggered()), glWidget, SLOT(setDiffuseRenderMode())); connect(normalRenderAct,SIGNAL(triggered()), glWidget, SLOT(setNormalRenderMode())); connect(allRenderAct,SIGNAL(triggered()), glWidget, SLOT(setAllRenderMode())); connect(depthRenderAct,SIGNAL(triggered()), glWidget, SLOT(setDepthRenderMode())); connect(gridRenderAct,SIGNAL(triggered()), glWidget, SLOT(setForwardDebugRenderMode())); connect(this,SIGNAL(keyPressed(int)), glWidget, SLOT(addKey(int))); connect(this,SIGNAL(keyReleased(int)), glWidget, SLOT(removeKey(int))); connect(cameraSensitivityIn,SIGNAL(textChanged(QString)),glWidget,SLOT(modifyCameraSensitivity(QString))); connect(cameraSpeedIn,SIGNAL(textChanged(QString)),glWidget,SLOT(modifyCameraSpeed(QString))); connect(glWidget, SIGNAL(updateFPSSignal(int)), fpsLabelNum, SLOT(setNum(int))); connect(nLightsIn,SIGNAL(textChanged(QString)),this,SLOT(modifyNLights(QString))); connect(genLightsButton, SIGNAL(clicked()), this, SLOT(genLights())); connect(this, SIGNAL(glGenLights(int)), glWidget, SLOT(genLightning(int))); connect(billboardsCheckBox, SIGNAL(stateChanged(int)), glWidget, SLOT(enableBillboards(int))); connect(lighBBScaleIn, SIGNAL(textChanged(QString)), glWidget, SLOT(modifyBoundingBoxScale(QString))); connect(lighIntensityIn, SIGNAL(textChanged(QString)), glWidget, SLOT(modifyMaxIntensity(QString))); connect(glWidget, SIGNAL(updateLightIntensityIn(QString)), lighIntensityIn, SLOT(setText(QString))); connect(glWidget, SIGNAL(updateRenderMode(QString)), renderModeLabel, SLOT(setText(QString))); connect(thresholdIn, SIGNAL(textChanged(QString)), glWidget, SLOT(modifyThreshold(QString))); connect(constantAttIn, SIGNAL(textChanged(QString)), glWidget, SLOT(modifyConstantAttenuation(QString))); connect(linearAttIn, SIGNAL(textChanged(QString)), glWidget, SLOT(modifyLinearAttenuation(QString))); connect(expAttIn, SIGNAL(textChanged(QString)), glWidget, SLOT(modifyExpAttenuation(QString))); // Set layout content mainLayout->addWidget(glWidget); thirdLayout->addWidget(sensibilityLabel); thirdLayout->addWidget(cameraSensitivityIn); thirdLayout->addWidget(speedLabel); thirdLayout->addWidget(cameraSpeedIn); thirdLayout->addWidget(line); thirdLayout->addWidget(thresholdLabel); thirdLayout->addWidget(thresholdIn); thirdLayout->addWidget(line2); thirdLayout->addWidget(billboardsCheckBox); thirdLayout->addWidget(lightBBScaleLabel); thirdLayout->addWidget(lighBBScaleIn); thirdLayout->addWidget(attenuationLabel); thirdLayout->addWidget(constantAttIn); thirdLayout->addWidget(linearAttIn); thirdLayout->addWidget(expAttIn); thirdLayout->addWidget(lightIntesityLabel); thirdLayout->addWidget(lighIntensityIn); thirdLayout->addWidget(nLightsLabel); thirdLayout->addWidget(nLightsIn); thirdLayout->addWidget(genLightsButton); thirdLayout->addWidget(line3); thirdLayout->addWidget(renderModeLabel); thirdLayout->addWidget(line4); thirdLayout->addWidget(fpsLabel); thirdLayout->addWidget(fpsLabelNum); secondLayout->addLayout(thirdLayout); secondLayout->addLayout(mainLayout); cameraSpeedIn->setFocus(); setWindowTitle("Deferred Shading"); ui.centralWidget->setLayout(secondLayout); setMinimumSize(1024,576); }
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); cancel->setDefault(true); QObject::connect(cancel, SIGNAL(pressed()), this, SLOT(reject())); QHBoxLayout *buttonGroupLayout = new QHBoxLayout; buttonGroupBox = new QGroupBox(); buttonGroupLayout->addWidget(cancel); buttonGroupLayout->addWidget(preview); buttonGroupLayout->addWidget(save); buttonGroupBox->setLayout(buttonGroupLayout); buttonGroupBox->setFlat(true); QLabel *header = new QLabel("Create New Index"); header->setAlignment(Qt::AlignHCenter); QFont f; f.setBold(true); f.setPointSize(12); header->setFont(f); mainLayout->addWidget(header); mainLayout->addWidget(iGroupBox); mainLayout->addWidget(oGroupBox); mainLayout->addWidget(aprioriGroupBox); mainLayout->addWidget(buttonGroupBox); setLayout(mainLayout); iFile->clearFocus(); oFile->clearFocus(); this->setFocus(); }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- 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; }