void CTestSummaryWindow::updateTestSummary() { _testSummaryTree->clear(); int i; QCheckBox* check; for(i=0;i <= INIT_TEST_COUNT;i++) { if(i == 0) _initTreeItem[i] = new QTreeWidgetItem(_testSummaryTree,QStringList(QString(tr(initTArray[i]._title.toLatin1().data())))); else { _initTreeItem[i] = new QTreeWidgetItem(_initTreeItem[0],QStringList(QString(tr(initTArray[i]._title.toLatin1().data())))); //_testSummaryTree->model()->setData(QModelIndex(1), Qt::TextAlignmentRole, Qt::AlignCenter); _testSummaryTree->model()->setData(_testSummaryTree->model()->index(0,i), Qt::TextAlignmentRole, Qt::AlignCenter); } check = new QCheckBox; check->setEnabled(false); _testSummaryTree->setItemWidget(_initTreeItem[i], 1, check); } for(i=0; i <= FULL_TEST_COUNT;i++) { if(i == 0) _fullTreeItem[i] = new QTreeWidgetItem(_testSummaryTree,QStringList(QString(tr(fullTArray[i]._title.toLatin1().data())))); else _fullTreeItem[i] = new QTreeWidgetItem(_fullTreeItem[0],QStringList(QString(tr(fullTArray[i]._title.toLatin1().data())))); check = new QCheckBox; check->setEnabled(false); _testSummaryTree->setItemWidget(_fullTreeItem[i], 1, check); } for(i=0; i <= ADJUST_TEST_COUNT;i++) { if(i == 0) _adjustTreeItem[i] = new QTreeWidgetItem(_testSummaryTree,QStringList(QString(tr(adjustTArray[i]._title.toLatin1().data())))); else _adjustTreeItem[i] = new QTreeWidgetItem(_adjustTreeItem[0],QStringList(QString(tr(adjustTArray[i]._title.toLatin1().data())))); check = new QCheckBox; check->setEnabled(false); _testSummaryTree->setItemWidget(_adjustTreeItem[i], 1, check); } for(i=0;i <= FUNCTION_TEST_COUNT;i++) { if(i == 0) _functionTreeItem[i] = new QTreeWidgetItem(_testSummaryTree,QStringList(QString(tr(functionTArray[i]._title.toLatin1().data())))); else _functionTreeItem[i] = new QTreeWidgetItem(_functionTreeItem[0],QStringList(QString(tr(functionTArray[i]._title.toLatin1().data())))); check = new QCheckBox; check->setEnabled(false); _testSummaryTree->setItemWidget(_functionTreeItem[i], 1, check); } _testSummaryTree->expandAll(); }
static void setSize(QLineEdit & widthED, LengthCombo & widthUnitCO, QLineEdit & heightED, LengthCombo & heightUnitCO, QCheckBox & aspectratioCB, external::ResizeData const & data) { bool using_scale = data.usingScale(); string scale = data.scale; if (data.no_resize()) { // Everything is zero, so default to this! using_scale = true; scale = "100"; } if (using_scale) { doubleToWidget(&widthED, scale); widthUnitCO.setCurrentItem("scale"); } else lengthToWidgets(&widthED, &widthUnitCO, data.width.asString(), Length::defaultUnit()); string const h = data.height.zero() ? string() : data.height.asString(); Length::UNIT const default_unit = data.width.zero() ? Length::defaultUnit() : data.width.unit(); lengthToWidgets(&heightED, &heightUnitCO, h, default_unit); heightED.setEnabled(!using_scale); heightUnitCO.setEnabled(!using_scale); aspectratioCB.setChecked(data.keepAspectRatio); bool const disable_aspectRatio = using_scale || data.width.zero() || data.height.zero(); aspectratioCB.setEnabled(!disable_aspectRatio); }
QWidget* CObjectProperty::returnWidget(QWidget *parent_) { if(m_visible) { if(m_type == "string") { QLineEdit* newWidget = new QLineEdit(parent_); if(!m_editable) newWidget->setEnabled(false); newWidget->setText(m_property.toString()); QObject::connect(this,SIGNAL(signal_propertyChanged(QString)),newWidget,SLOT(setText(QString))); QObject::connect(newWidget,SIGNAL(textChanged(QString)),this,SLOT(slot_propertyChanged(QString))); return newWidget; } else if(m_type == "longlong") { QLineEdit* newWidget = new QLineEdit(parent_); if(!m_editable) newWidget->setEnabled(false); QValidator* validator = new QIntValidator(); newWidget->setValidator(validator); newWidget->setText(m_property.toString()); QObject::connect(this,SIGNAL(signal_propertyChanged(QString)),newWidget,SLOT(setText(QString))); QObject::connect(newWidget,SIGNAL(textChanged(QString)),this,SLOT(slot_propertyChanged(QString))); return newWidget; } else if(m_type == "bool") { QCheckBox* newWidget = new QCheckBox(parent_); if(!m_editable) newWidget->setEnabled(false); newWidget->setChecked(m_property.toBool()); QObject::connect(this,SIGNAL(signal_propertyChanged(bool)),newWidget,SLOT(setChecked(bool))); QObject::connect(newWidget,SIGNAL(toggled(bool)),this,SLOT(slot_propertyChanged(bool))); return newWidget; } }
// _____________________________________________________________________ void CRaspiGPIO::setPinModeOutput(unsigned int gpio_num, unsigned int init_state) { pinMode(gpio_num, OUTPUT); digitalWrite(gpio_num, init_state); QString txt = "O"; QString tooltip = "Digital Output"; QLabel *lbl = m_ihm.findChild<QLabel*>(PREFIX_MODE_GPIO + QString::number(gpio_num)); if (lbl) { lbl->setText(txt); lbl->setToolTip(tooltip); lbl->setEnabled(true); } QLabel *lbl_name = m_ihm.findChild<QLabel*>(PREFIX_GPIO_NAME + QString::number(gpio_num)); if (lbl_name) { lbl_name->setEnabled(true); } QCheckBox *checkbox = m_ihm.findChild<QCheckBox*>(PREFIX_CHECKBOX_WRITE + QString::number(gpio_num)); if (checkbox) { checkbox->setEnabled(true); } m_raspi_pins_config[gpio_num] = tRaspiPinConfig { OUTPUT, PUD_OFF, init_state}; // Crée la data dans le data manager et l'associe à une callback pour déclencher l'écriture sur le port sur changement de valeur de la data QString dataname = PREFIX_RASPI_OUT_DATANAME + QString::number(gpio_num); m_application->m_data_center->write(dataname, init_state); CData *data = m_application->m_data_center->getData(dataname); if (data) { connect (data, SIGNAL(valueUpdated(QVariant)), this, SLOT(onDataChangeWrite(QVariant))); } }
void AbstractCameraManager::setProperties(std::vector<CameraProperty> &properties) { cameraProperties = std::vector<CameraProperty>(properties); for(unsigned int i=0; i<cameraProperties.size(); i++) { CameraProperty &property = cameraProperties.at(i); //qDebug() << property.getName().c_str() << reinterpret_cast<quintptr>(&property); QTreeWidgetItem* it = new QTreeWidgetItem(); it->setText( Ui::PropertyName, property.getName().c_str()); propertiesList.addTopLevelItem(it); //checkbox QCheckBox* box = new QCheckBox(); box->setProperty("CameraProperty", QVariant::fromValue(reinterpret_cast<quintptr>(&property)) ); if(!property.getCanAuto()) box->setEnabled(false); propertiesList.setItemWidget(it, Ui::PropertyAuto, box); connect( box, SIGNAL(stateChanged(int)), this, SLOT(on_propertyCheckbox_changed(int)) ); //slider if( property.getType() == CameraManager::AUTOTRIGGER ) continue; QSlider* slider = new QSlider(Qt::Horizontal); slider->setProperty("CameraProperty", QVariant::fromValue(reinterpret_cast<quintptr>(&property)) ); slider->setProperty("TreeWidgetItem", QVariant::fromValue(reinterpret_cast<quintptr>(it)) ); slider->setTracking(true); //might be wanted slider->setRange(property.getMinToSlider(), property.getMaxToSLider()); propertiesList.setItemWidget(it, Ui::PropertySlider, slider); box->setProperty("TreeWidgetSlider", QVariant::fromValue(reinterpret_cast<quintptr>(slider)) ); connect( slider, SIGNAL(valueChanged(int)), this, SLOT(on_propertySlider_changed(int)) ); } propertiesList.resizeColumnToContents(0); propertiesList.resizeColumnToContents(1); propertiesList.resizeColumnToContents(2); }
QWidget* createWidgets(BasePropertyWidget* parent) { m_checkBox = new QCheckBox(parent); m_checkBox->setEnabled(!parent->readOnly()); QObject::connect(m_checkBox, &QCheckBox::clicked, parent, &BasePropertyWidget::setWidgetDirty); return m_checkBox; }
void OptionsPopup::actionChanged() { QAction *action = qobject_cast<QAction *>(sender()); QTC_ASSERT(action, return); QCheckBox *checkbox = m_checkboxMap.value(action); QTC_ASSERT(checkbox, return); checkbox->setEnabled(action->isEnabled()); }
void SensorsDialog::disableCheckbox(int index) { QCheckBox *cb = getCheckboxPtr(index); if (cb != NULL) { cb->setText(""); cb->setEnabled(false); cb->setVisible(false); } }
void CTicTacToe::setCheckBoxCheckedForPlayer(QObject* sender, int player) { /** * @param: QObject sender: Object to the pressed Checkbox * @param: int player: Player who play */ Qt::CheckState pCheckState = getPlayerCheckBoxState(player); QCheckBox* box = static_cast<QCheckBox*>(sender); box->setCheckState(pCheckState); box->setEnabled(false); }
void onSelectedKnobChanged() { if (!selectedKnob) { return; } KnobParametricPtr isParametric = toKnobParametric( selectedKnob->getKnob() ); if (isParametric) { useAliasCheckBox->setChecked(true); } useAliasLabel->setEnabled(!isParametric); useAliasCheckBox->setEnabled(!isParametric); }
void onSelectedKnobChanged() { if (!selectedKnob) { return; } KnobParametric* isParametric = dynamic_cast<KnobParametric*>( selectedKnob->getKnob().get() ); if (isParametric) { useAliasCheckBox->setChecked(true); } useAliasLabel->setEnabled(!isParametric); useAliasCheckBox->setEnabled(!isParametric); }
QCheckBox *OptionsPopup::createCheckboxForCommand(Id id) { QAction *action = ActionManager::command(id)->action(); QCheckBox *checkbox = new QCheckBox(action->text()); checkbox->setToolTip(action->toolTip()); checkbox->setChecked(action->isChecked()); checkbox->setEnabled(action->isEnabled()); checkbox->installEventFilter(this); // enter key handling QObject::connect(checkbox, &QCheckBox::clicked, action, &QAction::setChecked); QObject::connect(action, &QAction::changed, this, &OptionsPopup::actionChanged); m_checkboxMap.insert(action, checkbox); return checkbox; }
void KRandRModule::addRotationButton(int thisRotation, bool checkbox) { Q_ASSERT(m_rotationGroup); if (!checkbox) { QRadioButton* thisButton = new QRadioButton(RandRScreen::rotationName(thisRotation), m_rotationGroup); thisButton->setEnabled(thisRotation & currentScreen()->rotations()); connect(thisButton, SIGNAL(clicked()), SLOT(slotRotationChanged())); } else { QCheckBox* thisButton = new QCheckBox(RandRScreen::rotationName(thisRotation), m_rotationGroup); thisButton->setEnabled(thisRotation & currentScreen()->rotations()); connect(thisButton, SIGNAL(clicked()), SLOT(slotRotationChanged())); } }
// Create new checkbox widget QtWidgetObject* AtenTreeGuiDialog::addCheck(TreeGuiWidget* widget, QString label) { QtWidgetObject* qtwo = widgetObjects_.add(); QCheckBox *check = new QCheckBox(this); qtwo->set(widget, check); check->setText(label); check->setChecked(widget->valueI()); check->setEnabled(widget->enabled()); check->setVisible(widget->visible()); check->setMinimumHeight(WIDGETHEIGHT); check->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); // Connect signal to master slot QObject::connect(check, SIGNAL(clicked(bool)), this, SLOT(checkBoxWidget_clicked(bool))); return qtwo; }
SGMBeamlineDetectorConnectionView::SGMBeamlineDetectorConnectionView(QWidget *parent) : QWidget(parent) { fl_ = new QFormLayout(); QList<AMOldDetector*> possibleDetectors = SGMBeamline::sgm()->possibleDetectorsForSet(SGMBeamline::sgm()->allDetectors()); for(int x = 0; x < possibleDetectors.count(); x++){ QCheckBox *tempCheckBox = new QCheckBox(); tempCheckBox->setEnabled(false); if(possibleDetectors.at(x)->isConnected()) tempCheckBox->setChecked(true); fl_->addRow(possibleDetectors.at(x)->detectorName(), tempCheckBox); } setLayout(fl_); connect(SGMBeamline::sgm(), SIGNAL(detectorAvailabilityChanged(AMOldDetector*,bool)), this, SLOT(onDetectorAvailabilityChanged(AMOldDetector*,bool))); }
// This function controls whether or not the settings are read-only. void SySettingsModule::setEditableItems(bool itemStatus) { QComboBox * combobox; for (int i = 0; i < editableComboItems.size(); i++) { combobox = editableComboItems.value(i); combobox->setEnabled(itemStatus); } QCheckBox * checkbox; for (int i = 0; i < editableCheckBoxItems.size(); i++) { checkbox = editableCheckBoxItems.value(i); checkbox->setEnabled(itemStatus); } }
void IPEmatch::modified() { int checked = 0; QCheckBox *ptr = NULL; if(ui.RCheck->isChecked()) {checked++; ptr = ui.RCheck;} if(ui.GCheck->isChecked()) {checked++; ptr = ui.GCheck;} if(ui.BCheck->isChecked()) {checked++; ptr = ui.BCheck;} if(checked == 1) ptr->setEnabled(false); else { ui.RCheck->setEnabled(true); ui.GCheck->setEnabled(true); ui.BCheck->setEnabled(true); } }
void JingleContentDialog::setContents(QList<JingleContent*> c) { for (int i = 0; i < c.count(); i++) { QCheckBox *cb = new QCheckBox(typeToString(c[i]->type()), this); cb->setChecked(true); if (c[i]->type() == JingleContent::Unknown) { cb->setChecked(false); cb->setEnabled(false); } m_contentNames << c[i]->name(); ui.verticalLayout->insertWidget(0, cb); m_checkBoxes << cb; } QLabel *label = new QLabel(i18n("Choose the contents you want to accept:"), this); ui.verticalLayout->insertWidget(0, label); }
DlgCreateGame::DlgCreateGame(const ServerInfo_Game &gameInfo, const QMap<int, QString> &_gameTypes, QWidget *parent) : QDialog(parent), room(0), gameTypes(_gameTypes) { sharedCtor(); descriptionEdit->setEnabled(false); maxPlayersEdit->setEnabled(false); passwordEdit->setEnabled(false); onlyBuddiesCheckBox->setEnabled(false); onlyRegisteredCheckBox->setEnabled(false); spectatorsAllowedCheckBox->setEnabled(false); spectatorsNeedPasswordCheckBox->setEnabled(false); spectatorsCanTalkCheckBox->setEnabled(false); spectatorsSeeEverythingCheckBox->setEnabled(false); descriptionEdit->setText(QString::fromStdString(gameInfo.description())); maxPlayersEdit->setValue(gameInfo.max_players()); onlyBuddiesCheckBox->setChecked(gameInfo.only_buddies()); onlyRegisteredCheckBox->setChecked(gameInfo.only_registered()); spectatorsAllowedCheckBox->setChecked(gameInfo.spectators_allowed()); spectatorsNeedPasswordCheckBox->setChecked(gameInfo.spectators_need_password()); spectatorsCanTalkCheckBox->setChecked(gameInfo.spectators_can_chat()); spectatorsSeeEverythingCheckBox->setChecked(gameInfo.spectators_omniscient()); QSet<int> types; for (int i = 0; i < gameInfo.game_types_size(); ++i) types.insert(gameInfo.game_types(i)); QMapIterator<int, QString> gameTypeIterator(gameTypes); while (gameTypeIterator.hasNext()) { gameTypeIterator.next(); QCheckBox *gameTypeCheckBox = gameTypeCheckBoxes.value(gameTypeIterator.key()); gameTypeCheckBox->setEnabled(false); gameTypeCheckBox->setChecked(types.contains(gameTypeIterator.key())); } connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); setWindowTitle(tr("Game information")); }
void QtDataXfer::variableUpdated(const unsigned int index, const std::string& name, const std::string& description, const std::string& value, const bool modifiable) { // Don't pass itemChanged signals generated from the following code. passChangeSignals = false; // Grow the table this this index if past the last row. if (index >= static_cast<unsigned int>(table->rowCount())) { table->setRowCount(index + 1); } // Name table->setItem(index, 0, createWidgetItem(name, false)); // Mutable (checkbox) // So this is irritating. There's no good way to have an enabled, non-user-editable, // centered checkbox in a table item. So we create our own layout. QWidget *pWidget = new QWidget(); QCheckBox *pCheckBox = new QCheckBox(); QHBoxLayout *pLayout = new QHBoxLayout(pWidget); pLayout->addWidget(pCheckBox); pLayout->setAlignment(Qt::AlignCenter); pLayout->setContentsMargins(0, 0, 0, 0); pWidget->setLayout(pLayout); pCheckBox->setChecked(modifiable); pCheckBox->setEnabled(false); table->setCellWidget(index, 1, pWidget); // Value table->setItem(index, 2, createWidgetItem(value, modifiable)); // Description table->setItem(index, 3, createWidgetItem(description, false)); passChangeSignals = true; }
// _____________________________________________________________________ void CRaspiGPIO::setPinModeInput(unsigned int gpio_num, unsigned int pullup_down) { pinMode(gpio_num, INPUT); pullUpDnControl(gpio_num, pullup_down); QString txt; QString tooltip; if (pullup_down == PUD_UP) { txt+="Iu"; tooltip = "Input with pull UP"; } else if (pullup_down == PUD_DOWN) { txt+="Id"; tooltip = "Input with pull DOWN"; } else { txt+="I"; tooltip = "Digital Input"; } QLabel *lbl = m_ihm.findChild<QLabel*>(PREFIX_MODE_GPIO + QString::number(gpio_num)); if (lbl) { lbl->setText(txt); lbl->setToolTip(tooltip); lbl->setEnabled(true); } QLabel *lbl_name = m_ihm.findChild<QLabel*>(PREFIX_GPIO_NAME + QString::number(gpio_num)); if (lbl_name) { lbl_name->setEnabled(true); } // On ne peut pas forcer l'état sur une entrée QCheckBox *checkbox = m_ihm.findChild<QCheckBox*>(PREFIX_CHECKBOX_WRITE + QString::number(gpio_num)); if (checkbox) { checkbox->setEnabled(false); } m_raspi_pins_config[gpio_num] = tRaspiPinConfig { INPUT, pullup_down, 0}; readPin(gpio_num); }
void PluginManager::initGUI() { while (!widgets.isEmpty()) { delete widgets.first(); widgets.removeFirst(); } QStringList hosts = factory->knownHosts(); int row = 1; foreach (QString host, hosts) { QLabel* lHost = new QLabel(host, this); QCheckBox* cbAllow = new QCheckBox("", this); QCheckBox* cbAllowPerm = new QCheckBox("", this); if (factory->isAllowed(host)) { cbAllow->setChecked(true); if (factory->isAllowedPermamently(host)) cbAllowPerm->setChecked(true); } else { cbAllowPerm->setEnabled(false); } PluginHelper* helper = new PluginHelper(this); helper->setHost(host); helper->setAllowCB(cbAllow); helper->setPermCB(cbAllowPerm); connect(cbAllow, SIGNAL(clicked()), helper, SLOT(setAllow())); connect(cbAllowPerm, SIGNAL(clicked()), helper, SLOT(setAllowPerm())); widgets.append(lHost); widgets.append(cbAllow); widgets.append(cbAllowPerm); widgets.append(helper); ui->items->addWidget(lHost, row, 0); ui->items->addWidget(cbAllow, row, 2, Qt::AlignCenter); ui->items->addWidget(cbAllowPerm, row, 4, Qt::AlignCenter); row++; }
void QgsSpatialQueryDialog::evaluateCheckBoxLayer( bool isTarget ) { QgsVectorLayer* lyr = NULL; QCheckBox* checkbox = NULL; if ( isTarget ) { lyr = mLayerTarget; checkbox = ckbUsingSelectedTarget; } else { lyr = mLayerReference; checkbox = ckbUsingSelectedReference; } int selectedCount = lyr->selectedFeatureCount(); bool isCheckBoxValid = ( lyr != NULL && selectedCount > 0 ); checkbox->setChecked( isCheckBoxValid ); checkbox->setEnabled( isCheckBoxValid ); QString textCheckBox = isCheckBoxValid ? tr( "%n selected geometries", "selected geometries", selectedCount ) : tr( "Selected geometries" ); checkbox->setText( textCheckBox ); } // void QgsSpatialQueryDialog::evaluateCheckBoxLayer(bool isTarget)
/* Adds a new line about a UAVObject along with its status (whether it got saved OK or not) */ void ImportSummaryDialog::addLine(QString uavObjectName, QString text, bool status) { ui->importSummaryList->setRowCount(ui->importSummaryList->rowCount() + 1); int row = ui->importSummaryList->rowCount() - 1; ui->importSummaryList->setCellWidget(row, 0, new QCheckBox(ui->importSummaryList)); QTableWidgetItem *objName = new QTableWidgetItem(uavObjectName); ui->importSummaryList->setItem(row, 1, objName); QCheckBox *box = dynamic_cast<QCheckBox *>(ui->importSummaryList->cellWidget(row, 0)); ui->importSummaryList->setItem(row, 2, new QTableWidgetItem(text)); // Disable editability and selectability in table elements ui->importSummaryList->item(row, 1)->setFlags(!Qt::ItemIsEditable); ui->importSummaryList->item(row, 2)->setFlags(!Qt::ItemIsEditable); if (status) { box->setChecked(true); } else { box->setChecked(false); box->setEnabled(false); } this->repaint(); this->showEvent(NULL); }
VESPERSEXAFSScanConfigurationView::VESPERSEXAFSScanConfigurationView(VESPERSEXAFSScanConfiguration *config, QWidget *parent) : VESPERSScanConfigurationView(parent) { config_ = config; AMTopFrame *frame = new AMTopFrame("VESPERS EXAFS Configuration"); // Regions setup regionsView_ = new AMRegionsView(config_->regions()); regionsView_->setMinimumWidth(300); regionsLineView_ = new AMEXAFSLineView(config_->exafsRegions()); // The fluorescence detector setup QGroupBox *fluorescenceDetectorGroupBox = addFluorescenceDetectorSelectionView(); connect(fluorescenceButtonGroup_, SIGNAL(buttonClicked(int)), this, SLOT(onFluorescenceChoiceChanged(int))); connect(config_->dbObject(), SIGNAL(fluorescenceDetectorChanged(int)), this, SLOT(updateFluorescenceDetector(int))); fluorescenceButtonGroup_->button((int)config_->fluorescenceDetector())->setChecked(true); // Ion chamber selection QGroupBox *ItGroupBox = addItSelectionView(); connect(ItGroup_, SIGNAL(buttonClicked(int)), this, SLOT(onItClicked(int))); connect(config_->dbObject(), SIGNAL(transmissionChoiceChanged(int)), this, SLOT(updateItButtons(int))); QGroupBox *I0GroupBox = addI0SelectionView(); connect(I0Group_, SIGNAL(buttonClicked(int)), this, SLOT(onI0Clicked(int))); connect(config_->dbObject(), SIGNAL(incomingChoiceChanged(int)), this, SLOT(updateI0Buttons(int))); I0Group_->button((int)config_->incomingChoice())->click(); ItGroup_->button((int)config_->transmissionChoice())->click(); QHBoxLayout *ionChambersLayout = new QHBoxLayout; ionChambersLayout->addWidget(I0GroupBox); ionChambersLayout->addWidget(ItGroupBox); // Scan name selection scanName_ = addScanNameView(config_->name()); connect(scanName_, SIGNAL(editingFinished()), this, SLOT(onScanNameEdited())); connect(config_, SIGNAL(nameChanged(QString)), scanName_, SLOT(setText(QString))); onScanNameEdited(); QFormLayout *scanNameLayout = new QFormLayout; scanNameLayout->addRow("Scan Name:", scanName_); // Energy (Eo) selection energy_ = new QDoubleSpinBox; energy_->setSuffix(" eV"); energy_->setMinimum(0); energy_->setMaximum(30000); connect(energy_, SIGNAL(editingFinished()), this, SLOT(setEnergy())); elementChoice_ = new QToolButton; connect(elementChoice_, SIGNAL(clicked()), this, SLOT(onElementChoiceClicked())); lineChoice_ = new QComboBox; connect(lineChoice_, SIGNAL(currentIndexChanged(int)), this, SLOT(onLinesComboBoxIndexChanged(int))); if (config_->edge().isEmpty()){ elementChoice_->setText("Cu"); fillLinesComboBox(AMPeriodicTable::table()->elementBySymbol("Cu")); lineChoice_->setCurrentIndex(0); } // Resets the view for the view to what it should be. Using the saved for the energy in case it is different from the original line energy. else onEdgeChanged(); connect(config_, SIGNAL(edgeChanged(QString)), this, SLOT(onEdgeChanged())); QCheckBox *useFixedTime = new QCheckBox("Use fixed time (EXAFS)"); useFixedTime->setEnabled(config_->useFixedTime()); connect(config_->exafsRegions(), SIGNAL(regionsHaveKSpaceChanged(bool)), useFixedTime, SLOT(setEnabled(bool))); connect(useFixedTime, SIGNAL(toggled(bool)), config_, SLOT(setUseFixedTime(bool))); QSpinBox *numberOfScans = new QSpinBox; numberOfScans->setMinimum(1); numberOfScans->setValue(config_->numberOfScans()); numberOfScans->setAlignment(Qt::AlignCenter); connect(numberOfScans, SIGNAL(valueChanged(int)), config_, SLOT(setNumberOfScans(int))); connect(config_, SIGNAL(numberOfScansChanged(int)), this, SLOT(onEstimatedTimeChanged())); QFormLayout *numberOfScansLayout = new QFormLayout; numberOfScansLayout->addRow("Number of Scans:", numberOfScans); QFormLayout *energySetpointLayout = new QFormLayout; energySetpointLayout->addRow("Energy:", energy_); QHBoxLayout *energyLayout = new QHBoxLayout; energyLayout->addLayout(energySetpointLayout); energyLayout->addWidget(elementChoice_); energyLayout->addWidget(lineChoice_); // Setting the scan position. QGroupBox *goToPositionGroupBox = addGoToPositionView(config_->goToPosition(), config_->x(), config_->y()); connect(config_, SIGNAL(gotoPositionChanged(bool)), goToPositionCheckBox_, SLOT(setChecked(bool))); connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), config_, SLOT(setGoToPosition(bool))); connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), setCurrentPositionButton_, SLOT(setEnabled(bool))); connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), savedXPosition_, SLOT(setEnabled(bool))); connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), savedYPosition_, SLOT(setEnabled(bool))); connect(goToPositionCheckBox_, SIGNAL(toggled(bool)), positionsSaved_, SLOT(setEnabled(bool))); connect(setCurrentPositionButton_, SIGNAL(clicked()), this, SLOT(setScanPosition())); setSampleStage(VESPERSBeamline::vespers()->experimentConfiguration()->sampleStageChoice()); // The estimated scan time. estimatedTime_ = new QLabel; estimatedSetTime_ = new QLabel; connect(config_, SIGNAL(totalTimeChanged(double)), this, SLOT(onEstimatedTimeChanged())); onEstimatedTimeChanged(); // The roi text edit. roiText_ = new QTextEdit; roiText_->setReadOnly(true); QPushButton *configureXRFDetectorButton = new QPushButton(QIcon(":/hammer-wrench.png"), "Configure XRF Detector"); connect(configureXRFDetectorButton, SIGNAL(clicked()), this, SLOT(onConfigureXRFDetectorClicked())); QFormLayout *roiTextLayout = new QFormLayout; roiTextLayout->addRow(roiText_); roiTextLayout->addRow(configureXRFDetectorButton); roiTextBox_ = new QGroupBox("Regions Of Interest"); roiTextBox_->setLayout(roiTextLayout); roiTextBox_->setVisible(config_->fluorescenceDetector() == VESPERS::NoXRF ? false : true); // Label showing where the data will be saved. QLabel *exportPath = addExportPathLabel(); // Label with a help message for EXAFS. QLabel *helpMessage = new QLabel("Note when using EXAFS: when using variable integration time, the time column is the maximum time."); // Default XANES and EXAFS buttons. QPushButton *defaultXANESButton = new QPushButton("Default XANES"); connect(defaultXANESButton, SIGNAL(clicked()), this, SLOT(onDefaultXANESScanClicked())); QPushButton *defaultEXAFSButton = new QPushButton("Default EXAFS"); connect(defaultEXAFSButton, SIGNAL(clicked()), this, SLOT(onDefaultEXAFSScanClicked())); // Setting up the steps to show the time offset for scan time estimation. connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(onCustomContextMenuRequested(QPoint))); setContextMenuPolicy(Qt::CustomContextMenu); QGroupBox *timeOffsetBox = addTimeOffsetLabel(config_->timeOffset()); connect(timeOffset_, SIGNAL(valueChanged(double)), this, SLOT(setTimeOffset(double))); QVBoxLayout *defaultLayout = new QVBoxLayout; defaultLayout->addSpacing(35); defaultLayout->addWidget(defaultXANESButton); defaultLayout->addWidget(defaultEXAFSButton); defaultLayout->addStretch(); // Auto-export option. QGroupBox *autoExportGroupBox = addExporterOptionsView(QStringList(), config_->exportSpectraSources()); connect(autoExportSpectra_, SIGNAL(toggled(bool)), config_, SLOT(setExportSpectraSources(bool))); // Setting up the layout. QGridLayout *contentsLayout = new QGridLayout; contentsLayout->addWidget(regionsView_, 1, 1, 2, 2); contentsLayout->addWidget(fluorescenceDetectorGroupBox, 1, 3); contentsLayout->addLayout(scanNameLayout, 4, 1); contentsLayout->addLayout(energyLayout, 0, 1, 1, 3); contentsLayout->addWidget(goToPositionGroupBox, 4, 3, 4, 1); contentsLayout->addLayout(ionChambersLayout, 2, 3, 2, 1); contentsLayout->addWidget(roiTextBox_, 1, 4, 2, 2); contentsLayout->addWidget(useFixedTime, 3, 1); contentsLayout->addWidget(estimatedTime_, 6, 1, 1, 2); contentsLayout->addWidget(estimatedSetTime_, 7, 1, 1, 2); contentsLayout->addLayout(numberOfScansLayout, 5, 1); contentsLayout->addWidget(timeOffsetBox, 8, 1, 1, 2); contentsLayout->addWidget(autoExportGroupBox, 4, 5, 2, 3); QHBoxLayout *squeezeContents = new QHBoxLayout; squeezeContents->addStretch(); squeezeContents->addLayout(defaultLayout); squeezeContents->addLayout(contentsLayout); squeezeContents->addStretch(); QVBoxLayout *configViewLayout = new QVBoxLayout; configViewLayout->addWidget(frame); configViewLayout->addStretch(); configViewLayout->addWidget(regionsLineView_, 0, Qt::AlignCenter); configViewLayout->addSpacing(30); configViewLayout->addLayout(squeezeContents); configViewLayout->addSpacing(30); configViewLayout->addWidget(exportPath, 0, Qt::AlignCenter); configViewLayout->addSpacing(30); configViewLayout->addWidget(helpMessage, 0, Qt::AlignCenter); configViewLayout->addStretch(); setLayout(configViewLayout); }
KScienceSetup::KScienceSetup( QWidget *parent, const char *name ) : KDialogBase( parent, name, true, i18n( "Setup Science Screen Saver" ), Ok|Cancel|Help, Ok, true ), saver( 0 ) { readSettings(); initModeInfo(); QWidget *main = makeMainWidget(); QHBoxLayout *lt = new QHBoxLayout( main, 0, spacingHint()); QVBoxLayout *ltm = new QVBoxLayout; lt->addLayout( ltm ); QVBoxLayout *ltc = new QVBoxLayout; lt->addLayout( ltc ); // mode QLabel *label = new QLabel( i18n("Mode:"), main ); ltm->addWidget( label ); QListBox *c = new QListBox( main ); for(int i = 0; i<MAX_MODES; i++) c->insertItem( modeInfo[i].name ); c->setCurrentItem( mode ); c->setFixedHeight( 5 * c->fontMetrics().height() ); connect( c, SIGNAL( highlighted( int ) ), SLOT( slotMode( int ) ) ); ltm->addWidget( c ); // inverse QCheckBox *cbox = checkInverse = new QCheckBox( i18n("Inverse"), main ); cbox->setEnabled( modeInfo[mode].inverseEnable ); cbox->setChecked( inverse[mode] ); connect( cbox, SIGNAL( clicked() ), SLOT( slotInverse() ) ); ltm->addWidget( cbox ); // gravity cbox = checkGravity = new QCheckBox( i18n("Gravity"), main ); cbox->setChecked( gravity[mode] ); connect( cbox, SIGNAL( clicked() ), SLOT( slotGravity() ) ); ltm->addWidget( cbox ); // hide background cbox = checkHideBG = new QCheckBox( i18n("Hide background"), main ); cbox->setChecked( hideBG[mode] ); connect( cbox, SIGNAL( clicked() ), SLOT( slotHideBG() ) ); ltm->addWidget( cbox ); ltm->addStretch(); // size label = new QLabel( i18n("Size:"), main ); ltc->addWidget( label ); slideSize = new QSlider(9, 50, 5, size[mode], QSlider::Horizontal, main ); slideSize->setMinimumSize( 90, 20 ); slideSize->setTickmarks(QSlider::Below); slideSize->setTickInterval(5); connect( slideSize, SIGNAL( sliderMoved( int ) ), SLOT( slotSize( int ) ) ); connect( slideSize, SIGNAL( sliderPressed() ), SLOT( slotSliderPressed() ) ); connect( slideSize, SIGNAL( sliderReleased() ), SLOT( slotSliderReleased() ) ); ltc->addWidget( slideSize ); // intensity label = new QLabel( i18n("Intensity:"), main ); ltc->addWidget( label ); slideIntensity = new QSlider(0, 10, 1, intensity[mode], QSlider::Horizontal, main ); slideIntensity->setMinimumSize( 90, 20 ); slideIntensity->setTickmarks(QSlider::Below); slideIntensity->setTickInterval(1); connect( slideIntensity, SIGNAL( sliderMoved( int ) ), SLOT( slotIntensity( int )) ); connect( slideIntensity, SIGNAL( sliderPressed() ), SLOT( slotSliderPressed() ) ); connect( slideIntensity, SIGNAL( sliderReleased() ), SLOT( slotSliderReleased() ) ); ltc->addWidget( slideIntensity ); // speed label = new QLabel( i18n("Speed:"), main ); ltc->addWidget( label ); slideSpeed = new QSlider(0, SCI_MAX_SPEED, 10, speed[mode], QSlider::Horizontal, main ); slideSpeed->setMinimumSize( 90, 20 ); slideSpeed->setTickmarks(QSlider::Below); slideSpeed->setTickInterval(10); connect( slideSpeed, SIGNAL( sliderMoved( int ) ), SLOT( slotSpeed( int ) ) ); ltc->addWidget( slideSpeed ); // motion label = new QLabel( i18n("Motion:"), main ); ltc->addWidget( label ); QHBoxLayout *ltcm = new QHBoxLayout; ltc->addLayout( ltcm ); slideMoveX = new QSlider(0, SCI_MAX_MOVE, 5, moveX[mode], QSlider::Horizontal, main ); slideMoveX->setMinimumSize( 40, 20 ); slideMoveX->setTickmarks(QSlider::Below); slideMoveX->setTickInterval(5); connect( slideMoveX, SIGNAL( sliderMoved( int ) ), SLOT( slotMoveX( int ) ) ); ltcm->addWidget( slideMoveX ); slideMoveY = new QSlider(0, SCI_MAX_MOVE, 5, moveY[mode], QSlider::Horizontal, main ); slideMoveY->setMinimumSize( 40, 20 ); slideMoveY->setTickmarks(QSlider::Below); slideMoveY->setTickInterval(5); connect( slideMoveY, SIGNAL( sliderMoved( int ) ), SLOT( slotMoveY( int ) ) ); ltcm->addWidget( slideMoveY ); ltc->addStretch(); // preview preview = new KPreviewWidget( main ); preview->setFixedSize( 220, 170 ); QPixmap p( locate("data", "kscreensaver/pics/kscience.png") ); if( p.isNull() ) preview->setBackgroundColor( black ); else preview->setBackgroundPixmap( p ); preview->show(); // otherwise saver does not get correct size lt->addWidget( preview ); // let the preview window display before creating the saver kapp->processEvents(); saver = new KScienceSaver( preview->winId(), true, !p.isNull() ); preview->notifySaver( saver ); }
///////////////////////////////////////// ///////////////////////////////////////// /// dlg ///////////////////////////////////////// ///////////////////////////////////////// KMPopFilterCnfrmDlg::KMPopFilterCnfrmDlg(QPtrList<KMPopHeaders> *aHeaders, const QString &aAccount, bool aShowLaterMsgs, QWidget *aParent, const char *aName) : KDialogBase(aParent, aName, true, i18n("POP Filter"), Ok | Help, Ok, false) { unsigned int rulesetCount = 0; //mHeaders = aHeaders; mShowLaterMsgs = aShowLaterMsgs; mLowerBoxVisible = false; QWidget *w = new QWidget(this); setMainWidget(w); QVBoxLayout *vbl = new QVBoxLayout(w, 0, spacingHint()); QLabel *l = new QLabel(i18n("Messages to filter found on POP Account: <b>%1</b><p>" "The messages shown exceed the maximum size limit you defined for this account.<br>You can select " "what you want to do with them by checking the appropriate button.").arg(aAccount), w); vbl->addWidget(l); QVGroupBox *upperBox = new QVGroupBox(i18n("Messages Exceeding Size"), w); upperBox->hide(); KMPopHeadersView *lv = new KMPopHeadersView(upperBox, this); vbl->addWidget(upperBox); QVGroupBox *lowerBox = new QVGroupBox(i18n("Ruleset Filtered Messages: none"), w); QString checkBoxText((aShowLaterMsgs) ? i18n("Show messages matched by a ruleset and tagged 'Download' or 'Delete'") : i18n("Show messages matched by a filter ruleset")); QCheckBox *cb = new QCheckBox(checkBoxText, lowerBox); cb->setEnabled(false); mFilteredHeaders = new KMPopHeadersView(lowerBox, this); mFilteredHeaders->hide(); vbl->addWidget(lowerBox); mFilteredHeaders->header()->setResizeEnabled(false, 8); mFilteredHeaders->setColumnWidth(8, 0); // fill the listviews with data from the headers KMPopHeaders *headers; for(headers = aHeaders->first(); headers; headers = aHeaders->next()) { KMPopHeadersViewItem *lvi = 0; if(headers->ruleMatched()) { if(aShowLaterMsgs && headers->action() == Later) { // insert messages tagged 'later' only lvi = new KMPopHeadersViewItem(mFilteredHeaders, headers->action()); mFilteredHeaders->show(); mLowerBoxVisible = true; } else if(aShowLaterMsgs) { // enable checkbox to show 'delete' and 'download' msgs // but don't insert them into the listview yet mDDLList.append(headers); cb->setEnabled(true); } else if(!aShowLaterMsgs) { // insert all messaged tagged by a ruleset, enable // the checkbox, but don't show the listview yet lvi = new KMPopHeadersViewItem(mFilteredHeaders, headers->action()); cb->setEnabled(true); } rulesetCount++; } else { // insert all messages not tagged by a ruleset // into the upper listview lvi = new KMPopHeadersViewItem(lv, headers->action()); upperBox->show(); } if(lvi) { mItemMap[lvi] = headers; setupLVI(lvi, headers->header()); } } if(rulesetCount) lowerBox->setTitle(i18n("Ruleset Filtered Messages: %1").arg(rulesetCount)); // connect signals and slots connect(lv, SIGNAL(pressed(QListViewItem *, const QPoint &, int)), this, SLOT(slotPressed(QListViewItem *, const QPoint &, int))); connect(mFilteredHeaders, SIGNAL(pressed(QListViewItem *, const QPoint &, int)), this, SLOT(slotPressed(QListViewItem *, const QPoint &, int))); connect(cb, SIGNAL(toggled(bool)), this, SLOT(slotToggled(bool))); adjustSize(); QTimer::singleShot(0, this, SLOT(slotUpdateMinimumSize())); }
RenderOptionsDialog::RenderOptionsDialog() : QDialog(0, Qt::CustomizeWindowHint | Qt::WindowTitleHint) { setWindowOpacity(0.75); setWindowTitle(tr("Options (double click to flip)")); QGridLayout *layout = new QGridLayout; setLayout(layout); layout->setColumnStretch(1, 1); int row = 0; QCheckBox *check = new QCheckBox(tr("Dynamic cube map")); check->setCheckState(Qt::Unchecked); // Dynamic cube maps are only enabled when multi-texturing and render to texture are available. check->setEnabled(glActiveTexture && glGenFramebuffersEXT); connect(check, SIGNAL(stateChanged(int)), this, SIGNAL(dynamicCubemapToggled(int))); layout->addWidget(check, 0, 0, 1, 2); ++row; QPalette palette; // Load all .par files // .par files have a simple syntax for specifying user adjustable uniform variables. QSet<QByteArray> uniforms; QList<QString> filter = QStringList("*.par"); QList<QFileInfo> files = QDir(":/res/boxes/").entryInfoList(filter, QDir::Files | QDir::Readable); foreach (QFileInfo fileInfo, files) { QFile file(fileInfo.absoluteFilePath()); if (file.open(QIODevice::ReadOnly)) { while (!file.atEnd()) { QList<QByteArray> tokens = file.readLine().simplified().split(' '); QList<QByteArray>::const_iterator it = tokens.begin(); if (it == tokens.end()) continue; QByteArray type = *it; if (++it == tokens.end()) continue; QByteArray name = *it; bool singleElement = (tokens.size() == 3); // type, name and one value char counter[10] = "000000000"; int counterPos = 8; // position of last digit while (++it != tokens.end()) { m_parameterNames << name; if (!singleElement) { m_parameterNames.back() += "["; m_parameterNames.back() += counter + counterPos; m_parameterNames.back() += "]"; int j = 8; // position of last digit ++counter[j]; while (j > 0 && counter[j] > '9') { counter[j] = '0'; ++counter[--j]; } if (j < counterPos) counterPos = j; } if (type == "color") { layout->addWidget(new QLabel(m_parameterNames.back())); bool ok; ColorEdit *colorEdit = new ColorEdit(it->toUInt(&ok, 16), m_parameterNames.size() - 1); m_parameterEdits << colorEdit; layout->addWidget(colorEdit); connect(colorEdit, SIGNAL(colorChanged(QRgb,int)), this, SLOT(setColorParameter(QRgb,int))); ++row; } else if (type == "float") { layout->addWidget(new QLabel(m_parameterNames.back())); bool ok; FloatEdit *floatEdit = new FloatEdit(it->toFloat(&ok), m_parameterNames.size() - 1); m_parameterEdits << floatEdit; layout->addWidget(floatEdit); connect(floatEdit, SIGNAL(valueChanged(float,int)), this, SLOT(setFloatParameter(float,int))); ++row; } }
QWidget *ServerDialog::createPackageTab(){ extension_group = new QButtonGroup; extension_group->setExclusive(false); QStringList extensions = Sanguosha->getExtensions(); QSet<QString> ban_packages = Config.BanPackages.toSet(); QGroupBox *box1 = new QGroupBox(tr("General package")); QGroupBox *box2 = new QGroupBox(tr("Card package")); QGridLayout *layout1 = new QGridLayout; QGridLayout *layout2 = new QGridLayout; box1->setLayout(layout1); box2->setLayout(layout2); int i = 0, j = 0; int row = 0, column = 0; foreach(QString extension, extensions){ const Package *package = Sanguosha->findChild<const Package *>(extension); if(package == NULL) continue; bool forbid_package = Config.value("ForbidPackages").toString().contains(extension); QCheckBox *checkbox = new QCheckBox; checkbox->setObjectName(extension); checkbox->setText(Sanguosha->translate(extension)); checkbox->setChecked(!ban_packages.contains(extension) && !forbid_package); checkbox->setEnabled(!forbid_package); extension_group->addButton(checkbox); switch(package->getType()){ case Package::GeneralPack: { row = i / 5; column = i % 5; i++; layout1->addWidget(checkbox, row, column+1); break; } case Package::CardPack: { row = j / 5; column = j % 5; j++; layout2->addWidget(checkbox, row, column+1); break; } default: break; } } QWidget *widget = new QWidget; QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(box1); layout->addWidget(box2); widget->setLayout(layout); return widget; }
void AssociationsDialog::updateColumnTypes() { QString text = associations->currentItem()->text(); QStringList lst = text.split(": ", QString::SkipEmptyParts); QStringList cols = lst[1].split(",", QString::SkipEmptyParts); QString xColName, yColName; int n = (int)cols.count(); if (n >= 2){ xColName = cols[0].remove("(X)"); yColName = cols[1].remove("(Y)"); table->showColumn(1); table->hideColumn(3); table->hideColumn(4); } else if (n == 1){//box plots yColName = cols[0]; table->hideColumn(1); table->hideColumn(3); table->hideColumn(4); } QCheckBox *it = 0; for (int i=0; i < table->rowCount(); i++ ){ it = (QCheckBox *)table->cellWidget(i, 1); if (table->item(i, 0)->text() == xColName) it->setChecked(true); else it->setChecked(false); it = (QCheckBox *)table->cellWidget(i, 2); if (table->item(i,0)->text() == yColName) it->setChecked(true); else it->setChecked(false); } bool xerr = false, yerr = false, vectors = false; QString errColName, xEndColName, yEndColName; if (n > 2){ table->showColumn(3); table->showColumn(4); if (cols[2].contains("(xErr)") || cols[2].contains("(yErr)")){//if error bars table->horizontalHeaderItem(3)->setText(tr("xErr")); table->horizontalHeaderItem(4)->setText(tr("yErr")); } if (cols[2].contains("(xErr)")){ xerr = true; errColName = cols[2].remove("(xErr)"); } else if (cols[2].contains("(yErr)")){ yerr = true; errColName = cols[2].remove("(yErr)"); } else if (cols.count() > 3 && cols[2].contains("(X)") && cols[3].contains("(Y)")){ vectors = true; xEndColName = cols[2].remove("(X)"); yEndColName = cols[3].remove("(Y)"); table->horizontalHeaderItem(3)->setText(tr("xEnd")); table->horizontalHeaderItem(4)->setText(tr("yEnd")); } else if (cols.count() > 3 && cols[2].contains("(A)") && cols[3].contains("(M)")){ vectors = true; xEndColName = cols[2].remove("(A)"); yEndColName = cols[3].remove("(M)"); table->horizontalHeaderItem(3)->setText(tr("Angle")); table->horizontalHeaderItem(4)->setText(tr("Magn.","Magnitude, vector length")); } } for (int i=0; i < table->rowCount(); i++){ it = (QCheckBox *)table->cellWidget(i, 3); if (xerr || vectors){ if (table->item(i,0)->text() == errColName || table->item(i,0)->text() == xEndColName) it->setChecked(true); else it->setChecked(false); } else it->setChecked(false); it = (QCheckBox *)table->cellWidget(i, 4); if (yerr || vectors){ if (table->item(i,0)->text() == errColName || table->item(i,0)->text() == yEndColName) it->setChecked(true); else it->setChecked(false); } else it->setChecked(false); it = (QCheckBox *)table->cellWidget(i, 1); if (xerr || yerr){ it->setEnabled(false); table->cellWidget(i, 2)->setEnabled(false); } else { it->setEnabled(true); table->cellWidget(i, 2)->setEnabled(true); } } }