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); }
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; }
// ----------------------------------------------------------------------------- // // ----------------------------------------------------------------------------- QWidget* ComparisonSelectionItemDelegate::createEditor(QWidget* widgetParent, const QStyleOptionViewItem& option, const QModelIndex& index) const { QLineEdit* featureValue = NULL; QDoubleValidator* featureValueValidator = NULL; QComboBox* operatorCombo = NULL; ComparisonSelectionTableModel* tableModel = qobject_cast<ComparisonSelectionTableModel*>(parent()); QStringList operators; operators << (SIMPL::Comparison::Strings::LessThan) << (SIMPL::Comparison::Strings::GreaterThan) << (SIMPL::Comparison::Strings::Equal); //QComboBox* phaseCombo = NULL; QStringList phases; for(int i = 0; i < m_NumberOfPhases; ++i) { phases << QString::number(i + 1); } bool ok = false; qint32 col = index.column(); switch(col) { case ComparisonSelectionTableModel::FeatureName: operatorCombo = new QComboBox(widgetParent); operatorCombo->addItems(m_FeatureList); operatorCombo->setAutoFillBackground(true); if(tableModel) { connect(operatorCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(arrayNameChangedData(int))); } return operatorCombo; case ComparisonSelectionTableModel::FeatureValue: { featureValue = new QLineEdit(widgetParent); featureValue->setFrame(false); featureValueValidator = new QDoubleValidator(featureValue); featureValueValidator->setRange(-1.0f * std::numeric_limits<float>::max(), std::numeric_limits<float>::max(), 6); featureValueValidator->setLocale(QLocale::system()); featureValue->setValidator(featureValueValidator); QVariant var = index.model()->data(index); featureValue->setText(QString::number(var.toDouble(&ok), 'g', 6)); if (tableModel) { connect(featureValue, SIGNAL(textChanged(const QString&)), this, SLOT(valueChangedData(const QString&))); } return featureValue; } case ComparisonSelectionTableModel::FeatureOperator: operatorCombo = new QComboBox(widgetParent); operatorCombo->addItems(operators); operatorCombo->setAutoFillBackground(true); if (tableModel) { connect(operatorCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(operatorChangedData(int))); } return operatorCombo; // case ComparisonSelectionTableModel::FeaturePhaseValue: // phaseCombo = new QComboBox(parent); // phaseCombo->addItems(phases); // phaseCombo->setAutoFillBackground(true); // return phaseCombo; default: break; } return QStyledItemDelegate::createEditor(widgetParent, option, index); }
ConversionDlg::ConversionDlg ( QWidget*parent ) : QWidget(parent) { inValueChanged = false; QVBoxLayout *vbox = new QVBoxLayout(this); grid* g = new grid(3,this); g->setContentsMargins(3,3,3,3); vbox->addWidget(g); new QWidget(g); new QLabel(" Hex:",g); leditors[HexLE] = new QLineEdit(g); new QWidget(g); new QLabel(" ASCII:",g); leditors[AsciiLE] = new QLineEdit(g); byteSwapFlag[IntegerBS] = new QCheckBox("b/s",g); new QLabel(" Int:",g); leditors[IntegerLE] = new QLineEdit(g); byteSwapFlag[FloatBS] = new QCheckBox("b/s",g); new QLabel(" Float:",g); leditors[FloatLE] = new QLineEdit(g); byteSwapFlag[DoubleBS] = new QCheckBox("b/s",g); new QLabel(" Double:",g); leditors[DoubleLE] = new QLineEdit(g); // make sure to do an update if any of the byte swap flags toggle for(int i = MinBS; i < MaxBS; ++i) { connect(byteSwapFlag[i],SIGNAL(clicked()), this,SLOT(valueChanged())); // add tool tip byteSwapFlag[i]->setToolTip("Byte Swap Data"); } // setup validators leditors[DoubleLE]->setValidator( new QDoubleValidator(this) ); QDoubleValidator *vd = new QDoubleValidator(this); vd->setRange( FLT_MAX, FLT_MAX ); leditors[FloatLE]->setValidator( vd ); leditors[IntegerLE]->setValidator( new QIntValidator(this) ); leditors[HexLE]->setValidator( new HexValidator(this) ); // setup editor connections connect(leditors[DoubleLE],SIGNAL(textChanged(const QString& )), this,SLOT(doubleChanged(const QString&)) ); connect(leditors[FloatLE],SIGNAL(textChanged(const QString& )), this,SLOT(floatChanged(const QString&)) ); connect(leditors[IntegerLE],SIGNAL(textChanged(const QString&)), this,SLOT(integerChanged(const QString&)) ); connect(leditors[HexLE],SIGNAL(textChanged(const QString&)), this,SLOT(valueChanged(const QString&))); connect(leditors[AsciiLE],SIGNAL(textChanged(const QString&)), this,SLOT(asciiChanged(const QString&))); for( int i = MinLE; i < MaxLE; ++i ) { connect(leditors[i],SIGNAL(returnPressed()), this,SIGNAL(nextPressed())); } hbox * h = new hbox(this); vbox->addWidget(h); vbox->addStretch(1); QPushButton* prev = new QPushButton("<",h); QPushButton* next = new QPushButton(">",h); connect(prev,SIGNAL(clicked()),this,SIGNAL(prevPressed())); connect(next,SIGNAL(clicked()),this,SIGNAL(nextPressed())); setWindowTitle("Conversion Dialog"); }
MapViewer::MapViewer(QWidget *parent) : QWidget(parent) { // setup layout QHBoxLayout *mainLayout = new QHBoxLayout; // create viewport m_viewport = new Viewport; m_viewport->setFixedSize(800,480); mainLayout->addWidget(m_viewport); // vertical line QFrame * divViewportAndPanel = new QFrame; divViewportAndPanel->setFrameShape(QFrame::VLine); divViewportAndPanel->setFrameShadow(QFrame::Sunken); mainLayout->addWidget(divViewportAndPanel); // setup side panel QVBoxLayout *sideLayout = new QVBoxLayout; // map directory line edit m_mapLabel = new QLabel("Map Directory:"); m_mapLine = new QLineEdit; m_mapButton = new QPushButton("Browse"); QHBoxLayout *mapLocateBox = new QHBoxLayout; mapLocateBox->addWidget(m_mapLine); mapLocateBox->addWidget(m_mapButton); sideLayout->addWidget(m_mapLabel); sideLayout->addLayout(mapLocateBox); // style file line edit m_styleLabel = new QLabel("Style File:"); m_styleLine = new QLineEdit; m_styleButton = new QPushButton("Browse"); QHBoxLayout *styleLocateBox = new QHBoxLayout; styleLocateBox->addWidget(m_styleLine); styleLocateBox->addWidget(m_styleButton); sideLayout->addWidget(m_styleLabel); sideLayout->addLayout(styleLocateBox); // horizontal line QFrame * divLoadButtonTop = new QFrame; divLoadButtonTop->setFrameShape(QFrame::HLine); divLoadButtonTop->setFrameShadow(QFrame::Sunken); sideLayout->addWidget(divLoadButtonTop); // camera settings m_camLatLabel = new QLabel("Latitude:"); m_camLonLabel = new QLabel("Longitude:"); m_camAltLabel = new QLabel("Altitude:"); m_camLatLine = new QLineEdit; m_camLonLine = new QLineEdit; m_camAltLine = new QLineEdit; sideLayout->addWidget(m_camLatLabel); sideLayout->addWidget(m_camLatLine); sideLayout->addWidget(m_camLonLabel); sideLayout->addWidget(m_camLonLine); sideLayout->addWidget(m_camAltLabel); sideLayout->addWidget(m_camAltLine); QDoubleValidator * latValidator = new QDoubleValidator; latValidator->setRange(-90.0,90.0,7); m_camLatLine->setValidator(latValidator); QDoubleValidator * lonValidator = new QDoubleValidator; lonValidator->setRange(-180.0,180.0,7); m_camLonLine->setValidator(lonValidator); QDoubleValidator * altValidator = new QDoubleValidator; altValidator->setRange(10.0,10000.0,7); m_camAltLine->setValidator(altValidator); // horizontal line QFrame * divLoadButtonBtm = new QFrame; divLoadButtonBtm->setFrameShape(QFrame::HLine); divLoadButtonBtm->setFrameShadow(QFrame::Sunken); sideLayout->addWidget(divLoadButtonBtm); QHBoxLayout * buttonLayout = new QHBoxLayout; m_loadButton = new QPushButton("Load Map"); m_camButton = new QPushButton("Set Camera Position"); buttonLayout->addWidget(m_loadButton); buttonLayout->addWidget(m_camButton); sideLayout->addLayout(buttonLayout); // horizontal line QFrame * divButtonLayoutBtm = new QFrame; divButtonLayoutBtm->setFrameShape(QFrame::HLine); divButtonLayoutBtm->setFrameShadow(QFrame::Sunken); sideLayout->addWidget(divButtonLayoutBtm); m_camRotate = new QRadioButton("Rotate"); m_camRotate->setChecked(true); m_camPan = new QRadioButton("Pan"); m_camZoom = new QRadioButton("Zoom"); // sideLayout->addWidget(m_camRotate); // sideLayout->addWidget(m_camPan); // sideLayout->addWidget(m_camZoom); QLabel * usageNotes = new QLabel; usageNotes->setWordWrap(true); usageNotes->setAlignment(Qt::AlignTop); usageNotes->setMinimumHeight(140); usageNotes->setText("Select a directory containing valid " "map data and choose a style file. Then " "click on the Load Map button to load " "the map into the viewport. Use the mouse " "to rotate, zoom and pan the view. The " "camera's position can be manually " "specified by entering the desired " "latitude, longitude and altitude in " "the boxes above, and then pressing " "the Set Camera Position button."); sideLayout->addWidget(usageNotes); mainLayout->addLayout(sideLayout); // debug m_mapLine->setText("?"); m_styleLine->setText("/home/preet/Dev/projects/libosmscout-render/res/styles/debug.json"); // set size this->setFixedSize(800+300,480+24); // set layout this->setLayout(mainLayout); // set title this->setWindowTitle("libosmscout-render mapviewer"); // setup connections connect(this, SIGNAL(loadMap(QString,QString)), m_viewport,SLOT(onLoadMap(QString,QString))); connect(this, SIGNAL(setCameraLLA(double,double,double)), m_viewport,SLOT(onSetCameraLLA(double,double,double))); connect(m_loadButton,SIGNAL(clicked()), this,SLOT(onLoadButtonClicked())); connect(m_camButton,SIGNAL(clicked()), this,SLOT(onCamButtonClicked())); connect(m_camRotate, SIGNAL(clicked()), this,SLOT(onCamModeRotate())); connect(m_camPan, SIGNAL(clicked()), this,SLOT(onCamModePan())); connect(m_camZoom, SIGNAL(clicked()), this,SLOT(onCamModeZoom())); connect(this,SIGNAL(setCamMode(int)), m_viewport,SLOT(onSetCameraMouseMode(int))); }