void CQGroupBox:: changeEvent(QEvent *e) { if (e->type() == QEvent::EnabledChange) updateEnabled(); calculateFrame(); QWidget::changeEvent(e); }
void CQGroupBox:: setCheckable(bool checkable) { if (checkable != checkable_) { checkable_ = checkable; updateEnabled(); update(); } }
NS_MD_BEGIN bool FloatingActionButton::init(const TapCallback &tapCallback, const TapCallback &longTapCallback) { if (!MaterialNode::init()) { return false; } auto l = construct<gesture::Listener>(); l->setPressCallback([this] (stappler::gesture::Event ev, const stappler::gesture::Press &g) -> bool { if (ev == stappler::gesture::Event::Began) { return onPressBegin(g.location()); } else if (ev == stappler::gesture::Event::Activated) { onLongPress(); return true; } else if (ev == stappler::gesture::Event::Ended) { return onPressEnd(); } else { onPressCancel(); return true; } }); l->setSwallowTouches(false); addComponent(l); _listener = l; _tapCallback = tapCallback; _longTapCallback = longTapCallback; _drawNode = construct<draw::PathNode>(48.0f * 2, 48.0f * 2, stappler::draw::Format::RGBA8888); _drawNode->setAnchorPoint(Vec2(0.5f, 0.5f)); _drawNode->setPosition(Vec2(0.0f, 0.0f)); _drawNode->setColor(Color::White); _drawNode->setScale(1.0f / stappler::screen::density()); _drawNode->setAntialiased(true); addChild(_drawNode, 31); _icon = construct<IconSprite>(); _icon->setAnchorPoint(Vec2(0.5f, 0.5f)); _icon->setNormalized(false); addChild(_icon, 1); _label = construct<Label>(FontType::Caption); _label->setAnchorPoint(Vec2(0.5f, 0.5f)); _label->setOpacity(222); addChild(_label, 2); setContentSize(Size(48.0f, 48.0)); setShadowZIndex(5.0f); updateEnabled(); return true; }
void Log::construct(cval<bool>& enabled, cval<std::string>& dir, cval<std::string>& fileName) { this->stop = true; this->logWritterThreadStarted = false; uv_mutex_init(&this->messageListMutex); uv_cond_init(&this->messageListCond); enabled.addListener(this, &updateEnabled); dir.addListener(this, &updateFile); fileName.addListener(this, &updateFile); updateEnabled(this, &enabled); }
void BarrierEditor::removeBarrier() { Barrier* b = selectedBarrier(); _dataModel->removeBarrier(b); if (_dataModel->size() > 0) { QModelIndex idx = _ui->barrierTable->currentIndex(); int row = (idx.row() < 0) ? 0 : (idx.row() >= _dataModel->size()) ? _dataModel->size() - 1 : idx.row(); select(_dataModel->barrierAt(row)); } else { select(NULL); } updateEnabled(); }
void CQGroupBox:: childEvent(QChildEvent *e) { if (e->type() != QEvent::ChildAdded || ! e->child()->isWidgetType()) return; calculateFrame(); if (isCheckable()) updateEnabled(); QWidget::childEvent(e); }
void NewAccountDialog::updateSelection(const QString& keychain, int state) { if (state == Qt::Checked) { keychainSet.insert(keychain); } else { keychainSet.remove(keychain); } updateMinSigs(); updateEnabled(); }
void WidgetParameters::onValueChanged() { QWidget* widgetChanged = dynamic_cast<QWidget*>(sender()); // update value MOParameter* param = _mapValueWidgets.key(widgetChanged,NULL); if(param) param->setFieldValue(MOParameter::VALUE,getValue(widgetChanged)); // update enabled widgets if(widgetChanged) updateEnabled(); }
void KOEditorFreeBusy::readEvent( Event *event ) { bool block = updateEnabled(); setUpdateEnabled( false ); clearAttendees(); setDateTimes( event->dtStart(), event->dtEnd() ); mIsOrganizer = KOPrefs::instance()->thatIsMe( event->organizer().email() ); updateStatusSummary(); clearSelection(); KOAttendeeEditor::readEvent( event ); setUpdateEnabled( block ); emit updateAttendeeSummary( mGanttView->childCount() ); }
void TTL_Pulse_Widget::setPulseInfo(const ttl_pulse_info& i) { ttl_pulse_info iOld = getPulseInfo(); if (iOld != i) { enableValChangeSig(false); dsb_t.setValue(i.t); updateEnabled(i.getEnabledFlag()); enableValChangeSig(true); // emit valueChanged(); } }
void CQGroupBox:: setChecked(bool checked) { if (checked != checked_) { checked_ = checked; if (isCheckable()) { updateEnabled(); emit toggled(isChecked()); update(); } } }
void DDS_Pulse_Widget::setPulseInfo(const dds_pulse_info& i) { dds_pulse_info iOld = getPulseInfo(); if (iOld != i) { enableValChangeSig(false); dsb_t.setValue(i.t); dsb_fOn.setValue(i.fOn * 1e6 / freq_unit); dsb_fOff.setValue(i.fOff); updateEnabled(i.getEnabledFlag()); enableValChangeSig(true); // emit valueChanged(); } }
void BarrierEditor::updateNumSlits() { Barrier* b = selectedBarrier(); if(b) { QObject* sender = QObject::sender(); if(sender) { if(sender == _ui->zeroSlits) { b->setNumSlits(Barrier::ZERO_SLITS); } else if(sender == _ui->oneSlit) { b->setNumSlits(Barrier::ONE_SLIT); } else if(sender == _ui->twoSlits) { b->setNumSlits(Barrier::TWO_SLITS); } } updateEnabled(); } }
QGridLayout* WidgetParameters::buildLayoutFromParameters() { //Adding Layout QGridLayout *mainLayout = new QGridLayout(this); // get groups QMultiMap<QString,MOParameter*> groupmap = _localParameters->groupmap(); QStringList groups = groupmap.uniqueKeys(); QStringList paramNames; for(int i=0;i<_localParameters->size();i++) paramNames.push_back(_localParameters->at(i)->name()); QPushButton *newPush; MOParameter* parameter; MOParameterListed *paramList; QList<MOParameter*> groupParameters; QGridLayout *curLayout; QGroupBox *curBox; // create group box for(int iG=0;iG<groups.size();iG++) { int iRow=0; if(groups.size()>1) { curBox = new QGroupBox(groups.at(iG),this); curLayout = new QGridLayout(curBox); } else curLayout = mainLayout; groupParameters = groupmap.values(groups.at(iG)); // to reproduce parameters order, start from the end // it seems MultiMap behaves like a pile for(int iP=groupParameters.size()-1;iP>=0;iP--) { parameter = groupParameters.at(iP); // add setting QString dispName; if(parameter->name().contains("/")) dispName = parameter->name().section("/",1,-1); else dispName = parameter->name(); curLayout->addWidget(new QLabel(parameter->description()),iRow,0); //boxLayout->addWidget(new QLabel(dispName),iRow,0); int type = parameter->getFieldValue(MOParameter::TYPE).toInt(); QWidget *valueWidget; QVariant value = parameter->getFieldValue(MOParameter::VALUE); switch(type) { case MOParameter::STRING : valueWidget = new QLineEdit(this); ((QLineEdit*)valueWidget)->setText(value.toString()); connect(((QLineEdit*)valueWidget),SIGNAL(textChanged(QString)),this,SLOT(onValueChanged())); break; case MOParameter::FILEPATH : valueWidget = new QLineEdit(this); ((QLineEdit*)valueWidget)->setText(value.toString()); connect(((QLineEdit*)valueWidget),SIGNAL(textChanged(QString)),this,SLOT(onValueChanged())); // add button newPush = new QPushButton("...",this); newPush->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Preferred); _pathsMap.insert(newPush,((QLineEdit*)valueWidget)); curLayout->addWidget(newPush,iRow,2); connect(newPush,SIGNAL(clicked()),this,SLOT(onSelectFileClicked())); break; case MOParameter::FOLDERPATH : valueWidget = new QLineEdit(this); ((QLineEdit*)valueWidget)->setText(value.toString()); connect(((QLineEdit*)valueWidget),SIGNAL(textChanged(QString)),this,SLOT(onValueChanged())); //add button newPush = new QPushButton("...",this); newPush->setSizePolicy(QSizePolicy::Maximum,QSizePolicy::Preferred); _pathsMap.insert(newPush,((QLineEdit*)valueWidget)); curLayout->addWidget(newPush,iRow,2); connect(newPush,SIGNAL(clicked()),this,SLOT(onSelectFolderClicked())); break; case MOParameter::DOUBLE : valueWidget = new QScienceSpinBox(this); ((QScienceSpinBox*)valueWidget)->setMinimum(parameter->getFieldValue(MOParameter::MIN).toDouble()); ((QScienceSpinBox*)valueWidget)->setMaximum(parameter->getFieldValue(MOParameter::MAX).toDouble()); ((QScienceSpinBox*)valueWidget)->setDecimals(10); ((QScienceSpinBox*)valueWidget)->setValue(value.toDouble()); connect(((QScienceSpinBox*)valueWidget),SIGNAL(valueChanged(double)),this,SLOT(onValueChanged())); break; case MOParameter::INT : valueWidget = new QSpinBox(this); ((QSpinBox*)valueWidget)->setMinimum(parameter->getFieldValue(MOParameter::MIN).toInt()); ((QSpinBox*)valueWidget)->setMaximum(parameter->getFieldValue(MOParameter::MAX).toInt()); ((QSpinBox*)valueWidget)->setValue(value.toInt()); connect(((QSpinBox*)valueWidget),SIGNAL(valueChanged(int)),this,SLOT(onValueChanged())); break; case MOParameter::BOOL : valueWidget = new QCheckBox(this); Qt::CheckState state; if(value.toBool()) state = Qt::Checked; else state = Qt::Unchecked; connect(((QCheckBox*)valueWidget),SIGNAL(stateChanged(int)),this,SLOT(onValueChanged())); ((QCheckBox*)valueWidget)->setCheckState(state); break; case MOParameter::LIST : //if is a list, param should be a MOParameterListed valueWidget = new QComboBox(this); paramList = dynamic_cast<MOParameterListed*>(parameter); if(paramList) { //adding list items in qcombobox for(int iValue = 0 ; iValue<paramList->mapList().keys().size();iValue++) { ((QComboBox*)valueWidget)->addItem( paramList->mapList().values().at(iValue), paramList->mapList().keys().at(iValue)); } // set current index ((QComboBox*)valueWidget)->setCurrentIndex(((QComboBox*)valueWidget)->findData(value)); connect(((QComboBox*)valueWidget),SIGNAL(currentIndexChanged(int)),this,SLOT(onValueChanged())); } break; default : valueWidget = new QLineEdit(this); ((QLineEdit*)valueWidget)->setText(value.toString()); connect(((QLineEdit*)valueWidget),SIGNAL(textChanged(QString)),this,SLOT(onValueChanged())); break; } curLayout->addWidget(valueWidget,iRow,1); valueWidget->setEnabled(_editable); // store (to save data when click ok) _mapValueWidgets.insert(parameter,valueWidget); _paramNames.push_back(parameter->name()); _paramTypes.push_back(type); iRow++; } if(groups.size()>1) { curBox->setLayout(curLayout); mainLayout->addWidget(curBox); } } if(_editable) updateEnabled(); //update return mainLayout; }
void FloatingActionButton::setLongTapCallback(const TapCallback &longTapCallback) { _longTapCallback = longTapCallback; updateEnabled(); }
void FloatingActionButton::setTapCallback(const TapCallback &tapCallback) { _tapCallback = tapCallback; updateEnabled(); }
void FloatingActionButton::setEnabled(bool value) { _enabled = value; updateEnabled(); }
NewAccountDialog::NewAccountDialog(const QList<QString>& allKeychains, const QList<QString>& selectedKeychains, QWidget* parent) : QDialog(parent) { if (allKeychains.isEmpty()) { throw std::runtime_error(tr("You must first create at least one keychain.").toStdString()); } keychainSet = selectedKeychains.toSet(); QList<QString> keychains = allKeychains; qSort(keychains.begin(), keychains.end()); // Buttons QDialogButtonBox* buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); okButton = buttonBox->button(QDialogButtonBox::Ok); okButton->setEnabled(false); connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept())); connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject())); // Account Name QLabel* nameLabel = new QLabel(); nameLabel->setText(tr("Account Name:")); nameEdit = new QLineEdit(); connect(nameEdit, &QLineEdit::textChanged, [this](const QString& /*text*/) { updateEnabled(); }); QHBoxLayout* nameLayout = new QHBoxLayout(); nameLayout->setSizeConstraint(QLayout::SetNoConstraint); nameLayout->addWidget(nameLabel); nameLayout->addWidget(nameEdit); // Keychain List Widget QLabel* selectionLabel = new QLabel(tr("Select keychains:")); keychainListWidget = new QListWidget(); for (auto& keychain: keychains) { QCheckBox* checkBox = new QCheckBox(keychain); checkBox->setCheckState(selectedKeychains.count(keychain) ? Qt::Checked : Qt::Unchecked); connect(checkBox, &QCheckBox::stateChanged, [=](int state) { updateSelection(keychain, state); }); QListWidgetItem* item = new QListWidgetItem(); keychainListWidget->addItem(item); keychainListWidget->setItemWidget(item, checkBox); } // Minimum Signatures QLabel *minSigLabel = new QLabel(); minSigLabel->setText(tr("Minimum Signatures:")); minSigComboBox = new QComboBox(); minSigLineEdit = new QLineEdit(); minSigLineEdit->setAlignment(Qt::AlignRight); minSigComboBox->setLineEdit(minSigLineEdit); QHBoxLayout* minSigLayout = new QHBoxLayout(); minSigLayout->setSizeConstraint(QLayout::SetNoConstraint); minSigLayout->addWidget(minSigLabel); minSigLayout->addWidget(minSigComboBox); updateMinSigs(); // Creation Time QDateTime localDateTime = QDateTime::currentDateTime(); QLabel* creationTimeLabel = new QLabel(tr("Creation Time ") + "(" + localDateTime.timeZoneAbbreviation() + "):"); creationTimeEdit = new QDateTimeEdit(QDateTime::currentDateTime()); creationTimeEdit->setDisplayFormat("yyyy.MM.dd hh:mm:ss"); creationTimeEdit->setCalendarPopup(true); calendarWidget = new QCalendarWidget(this); creationTimeEdit->setCalendarWidget(calendarWidget); QHBoxLayout* creationTimeLayout = new QHBoxLayout(); creationTimeLayout->setSizeConstraint(QLayout::SetNoConstraint); creationTimeLayout->addWidget(creationTimeLabel); creationTimeLayout->addWidget(creationTimeEdit); // Main Layout QVBoxLayout *mainLayout = new QVBoxLayout(); mainLayout->setSizeConstraint(QLayout::SetNoConstraint); mainLayout->addLayout(nameLayout); mainLayout->addWidget(selectionLabel); mainLayout->addWidget(keychainListWidget); mainLayout->addLayout(minSigLayout); mainLayout->addLayout(creationTimeLayout); mainLayout->addWidget(buttonBox); setLayout(mainLayout); }
void Faceplus::init() { connect(Application::getInstance()->getFaceshift(), SIGNAL(connectionStateChanged()), SLOT(updateEnabled())); updateEnabled(); }
void BarrierEditor::removeAllBarriers() { _dataModel->removeAllBarriers(); select(NULL); updateEnabled(); _ui->barrierTable->resizeRowsToContents(); }
void Pulse_Widget::slot_disable() { updateEnabled(!bEnabled); emit valueChanged(); }
// ----------------------------------------------------------------------------- void LLViewerJoystick::init(bool autoenable) { #if LIB_NDOF static bool libinit = false; mDriverState = JDS_INITIALIZING; if (libinit == false) { // Note: The HotPlug callbacks are not actually getting called on Windows if (ndof_libinit(HotPlugAddCallback, HotPlugRemovalCallback, NULL)) { mDriverState = JDS_UNINITIALIZED; } else { // NB: ndof_libinit succeeds when there's no device libinit = true; // allocate memory once for an eventual device mNdofDev = ndof_create(); } } if (libinit) { if (mNdofDev) { // Different joysticks will return different ranges of raw values. // Since we want to handle every device in the same uniform way, // we initialize the mNdofDev struct and we set the range // of values we would like to receive. // // HACK: On Windows, libndofdev passes our range to DI with a // SetProperty call. This works but with one notable exception, the // SpaceNavigator, who doesn't seem to care about the SetProperty // call. In theory, we should handle this case inside libndofdev. // However, the range we're setting here is arbitrary anyway, // so let's just use the SpaceNavigator range for our purposes. mNdofDev->axes_min = (long)-MAX_JOYSTICK_INPUT_VALUE; mNdofDev->axes_max = (long)+MAX_JOYSTICK_INPUT_VALUE; // libndofdev could be used to return deltas. Here we choose to // just have the absolute values instead. mNdofDev->absolute = 1; // init & use the first suitable NDOF device found on the USB chain if (ndof_init_first(mNdofDev, NULL)) { mDriverState = JDS_UNINITIALIZED; llwarns << "ndof_init_first FAILED" << llendl; } else { mDriverState = JDS_INITIALIZED; } } else { mDriverState = JDS_UNINITIALIZED; } } // Autoenable the joystick for recognized devices if nothing was connected previously if (!autoenable) { autoenable = gSavedSettings.getString("JoystickInitialized").empty() ? true : false; } updateEnabled(autoenable); if (mDriverState == JDS_INITIALIZED) { // A Joystick device is plugged in if (isLikeSpaceNavigator()) { // It's a space navigator, we have defaults for it. if (gSavedSettings.getString("JoystickInitialized") != "SpaceNavigator") { // Only set the defaults if we haven't already (in case they were overridden) setSNDefaults(); gSavedSettings.setString("JoystickInitialized", "SpaceNavigator"); } } else { // It's not a Space Navigator gSavedSettings.setString("JoystickInitialized", "UnknownDevice"); } } else { // No device connected, don't change any settings } llinfos << "ndof: mDriverState=" << mDriverState << "; mNdofDev=" << mNdofDev << "; libinit=" << libinit << llendl; #endif }
void BarrierEditor::updateOnSelection() { syncUI(); updateEnabled(); }