void SessionStatePlugin::blockUntilSubscribed(const QString& key) { // subscribe() has called checkFullScreen (which has queued // emitValueChanged) and it has also emitted subscribeFinished(). screenBlanked.waitForSubscription(true); emitValueChanged(); }
void soundSource::synth2_ButtonSignal(bool value) { if (this->id == 3) { emitValueChanged(this->hex1, this->hex2, "00", "void"); this->editDialog->setWindow(this->fxName); emit setEditDialog(this->editDialog); }; }
QJDSpinBox::QJDSpinBox(QWidget *parent) : QSpinBox(parent) { QString a; _id=setRandString(a); connect(this,SIGNAL(valueChanged(QString)),this,SLOT(emitValueChanged(QString))); setRange(-100000,100000); // 可在设置创建时再做改动 }
void QtColorProperty::onColorChanged(const QColor& color) { m_currentColor = Color(color.red(), color.green(), color.blue()); m_pushButton->setStyleSheet(QString("background-color: #") + utils::colorToHex(color.red(), color.green(), color.blue()).c_str()); bool accepted; RJNode change; std::list<int> idChain; ji::write(change, m_currentColor); emitValueChanged(idChain, change, accepted); }
void NodeEnum::setValue(int64_t value) { if (m_value != value) { if (!m_entries.contains(value)) { throw std::runtime_error("NodeEnum::setValue() - Invalid enumeration value!"); } m_value = value; emitValueChanged(); emit valueChanged(m_value); emit valueChanged(m_entries[m_value]); emit changed(this); } }
void AnalogPad::mouseReleaseEvent(QMouseEvent *) { // Return if mouse was not pressed inside the pad area if(!m_MouseDown) return; m_MouseDown = false; m_LimitReached = false; if (m_MouseClick) { emit padClicked(); startClickAnimation(); } m_MouseClick = false; emitValueChanged(); }
void AnalogPad::mousePressEvent(QMouseEvent *event) { // Scale pad position to range [-1, 1] qreal xx = qreal(event->pos().x()) / m_Position.x() - 1; qreal yy = qreal(event->pos().y()) / m_Position.y() - 1; // Calculate the distance from the center qreal dist = sqrt(pow(xx, 2) + pow(yy, 2)); // Return if outside the pad area if(dist>0.9) return; m_MouseDown = true; m_TouchPosition = event->pos(); // Calculate unit vectors xx /= dist; yy /= dist; // Check was the pad pressed close to the center if (dist > PAD_SENSITIVITY_LIMIT) { // Check if the distance from the center exceeds maximum if(dist>MAX_DIST) { dist = MAX_DIST; m_LimitReached = true; } else { m_LimitReached = false; } // Calculate new pad position QPoint newpos((xx*dist + 1) * m_Position.x(), (yy*dist + 1)*m_Position.y()); setPadPosition(newpos); emitPadValue(); } else { m_MouseClick = true; } update(); emitValueChanged(); }
void AnalogPad::mouseMoveEvent(QMouseEvent *event) { // Return if mouse was not pressed inside the pad area if(!m_MouseDown) return; if(m_MouseClick) { QPoint d = event->pos() - m_TouchPosition; if(d.manhattanLength()>4) m_MouseClick = false; } if (!m_MouseClick) { // Scale pad position to range [-1, 1] qreal xx = qreal(event->pos().x()) / m_Position.x() - 1; qreal yy = qreal(event->pos().y()) / m_Position.y() - 1; // Calculate the distance from the center qreal dist = sqrt(pow(xx, 2) + pow(yy, 2)); // Calculate unit vectors xx/=dist; yy/=dist; // Check if the distance from the center exceeds maximum if(dist>MAX_DIST) { dist = MAX_DIST; m_LimitReached = true; } else { m_LimitReached = false; } // Calculate new pad position QPoint newpos((xx*dist + 1) * m_Position.x(), (yy*dist + 1)*m_Position.y()); setPadPosition(newpos); update(); emitValueChanged(); } }
void PresenceStatePlugin::subscribe(QSet<QString> keys) { // Check for invalid keys foreach (const QString& key, keys) { if (key != presenceStateKey) { Q_EMIT subscribeFailed(key, "Invalid key"); } } if (keys.contains(presenceStateKey)) { // Connect to the global account change sconnect(GlobalPresenceIndicator::instance(), SIGNAL(globalPresenceChanged(GlobalPresenceIndicator::GLOBAL_PRESENCE)), this, SLOT(emitValueChanged(GlobalPresenceIndicator::GLOBAL_PRESENCE))); QString presence = mapPresence(GlobalPresenceIndicator::instance()->globalPresence()); // Now the value is there; signal that the subscription is done. Q_EMIT subscribeFinished(presenceStateKey, QVariant(presence)); } }
void QgsBinaryWidgetWrapper::setContent() { QgsSettings s; QString file = QFileDialog::getOpenFileName( nullptr, tr( "Embed File" ), defaultPath(), tr( "All files" ) + " (*.*)" ); QFileInfo fi( file ); if ( file.isEmpty() || !fi.exists() ) { return; } s.setValue( QStringLiteral( "/UI/lastBinaryDir" ), fi.absolutePath() ); QFile fileSource( file ); if ( !fileSource.open( QIODevice::ReadOnly ) ) { return; } setValue( fileSource.readAll() ); emitValueChanged(); }
void QgsRangeWidgetWrapper::initWidget( QWidget *editor ) { mDoubleSpinBox = qobject_cast<QDoubleSpinBox *>( editor ); mIntSpinBox = qobject_cast<QSpinBox *>( editor ); mDial = qobject_cast<QDial *>( editor ); mSlider = qobject_cast<QSlider *>( editor ); mQgsDial = qobject_cast<QgsDial *>( editor ); mQgsSlider = qobject_cast<QgsSlider *>( editor ); bool allowNull = config( QStringLiteral( "AllowNull" ), true ).toBool(); QVariant min( config( QStringLiteral( "Min" ) ) ); QVariant max( config( QStringLiteral( "Max" ) ) ); QVariant step( config( QStringLiteral( "Step" ) ) ); QVariant precision( config( QStringLiteral( "Precision" ) ) ); if ( mDoubleSpinBox ) { double stepval = step.isValid() ? step.toDouble() : 1.0; double minval = min.isValid() ? min.toDouble() : std::numeric_limits<double>::lowest(); double maxval = max.isValid() ? max.toDouble() : std::numeric_limits<double>::max(); int precisionval = precision.isValid() ? precision.toInt() : layer()->fields().at( fieldIdx() ).precision(); mDoubleSpinBox->setDecimals( precisionval ); QgsDoubleSpinBox *qgsWidget = qobject_cast<QgsDoubleSpinBox *>( mDoubleSpinBox ); if ( qgsWidget ) qgsWidget->setShowClearButton( allowNull ); // Make room for null value: lower the minimum to allow for NULL special values if ( allowNull ) { double decr; if ( precisionval > 0 ) { decr = std::pow( 10, -precisionval ); } else { decr = stepval; } minval -= decr; // Note: call setMinimum here or setValue won't work mDoubleSpinBox->setMinimum( minval ); mDoubleSpinBox->setValue( minval ); QgsDoubleSpinBox *doubleSpinBox( qobject_cast<QgsDoubleSpinBox *>( mDoubleSpinBox ) ); if ( doubleSpinBox ) doubleSpinBox->setSpecialValueText( QgsApplication::nullRepresentation() ); else mDoubleSpinBox->setSpecialValueText( QgsApplication::nullRepresentation() ); } mDoubleSpinBox->setMinimum( minval ); mDoubleSpinBox->setMaximum( maxval ); mDoubleSpinBox->setSingleStep( stepval ); if ( config( QStringLiteral( "Suffix" ) ).isValid() ) mDoubleSpinBox->setSuffix( config( QStringLiteral( "Suffix" ) ).toString() ); connect( mDoubleSpinBox, static_cast < void ( QDoubleSpinBox::* )( double ) > ( &QDoubleSpinBox::valueChanged ), this, [ = ]( double ) { emitValueChanged(); } ); } else if ( mIntSpinBox ) { QgsSpinBox *qgsWidget = qobject_cast<QgsSpinBox *>( mIntSpinBox ); if ( qgsWidget ) qgsWidget->setShowClearButton( allowNull ); int minval = min.toInt(); if ( allowNull ) { int stepval = step.isValid() ? step.toInt() : 1; minval -= stepval; mIntSpinBox->setValue( minval ); QgsSpinBox *intSpinBox( qobject_cast<QgsSpinBox *>( mIntSpinBox ) ); if ( intSpinBox ) intSpinBox->setSpecialValueText( QgsApplication::nullRepresentation() ); else mIntSpinBox->setSpecialValueText( QgsApplication::nullRepresentation() ); } setupIntEditor( minval, max, step, mIntSpinBox, this ); if ( config( QStringLiteral( "Suffix" ) ).isValid() ) mIntSpinBox->setSuffix( config( QStringLiteral( "Suffix" ) ).toString() ); } else { ( void )field().convertCompatible( min ); ( void )field().convertCompatible( max ); ( void )field().convertCompatible( step ); if ( mQgsDial ) setupIntEditor( min, max, step, mQgsDial, this ); else if ( mQgsSlider ) setupIntEditor( min, max, step, mQgsSlider, this ); else if ( mDial ) setupIntEditor( min, max, step, mDial, this ); else if ( mSlider ) setupIntEditor( min, max, step, mSlider, this ); } }
/*! \internal */ void QDeclarativeExpressionPrivate::_q_notify() { emitValueChanged(); }