bool QPositionNode::eventFilter(QObject* obj, QEvent* event) { if( event->type() == QEvent::DynamicPropertyChange ) { QDynamicPropertyChangeEvent* ev = static_cast<QDynamicPropertyChangeEvent*>(event); if( ev->propertyName() == "Position" ) { QVec3f pos = obj->property("Position").value<QVec3f>(); savePosition( pos.X, pos.Y, pos.Z ); obj->setProperty("__AbsoluteTransformation", QVariant::fromValue(QMatrix4f::TransMat( pos.X, pos.Y, pos.Z) ) ); } if( ev->propertyName() == "Scale" ) { // No scale allowed obj->setProperty("Scale", QVariant::fromValue(QVec3f(1, 1, 1)) ); } // Set absolute transformation to the relative one but don't apply it to the xml data if( ev->propertyName() == "__RelativeTransformation" ) { QMatrix4f mat = obj->property("__RelativeTransformation").value<QMatrix4f>(); obj->setProperty("__AbsoluteTransformation", QVariant::fromValue(mat) ); } } return QXmlTreeNode::eventFilter(obj, event); }
bool Properties::event( QEvent* e ) { if ( e->type( ) == QEvent::DynamicPropertyChange ) { QDynamicPropertyChangeEvent* propertyChangeEvent = static_cast< QDynamicPropertyChangeEvent* >( e ); refreshModels( propertyChangeEvent->propertyName( ) ); emit propertiesModified( propertyChangeEvent->propertyName( ) ); } return QObject::event( e ); }
bool Properties::event( QEvent* e ) { if ( getTarget() == nullptr && // Catch dynamic properties changes for this only if a target has not been set e->type( ) == QEvent::DynamicPropertyChange ) { QDynamicPropertyChangeEvent* propertyChangeEvent = static_cast< QDynamicPropertyChangeEvent* >( e ); updateProperty( propertyChangeEvent->propertyName( ) ); emit propertiesModified( propertyChangeEvent->propertyName( ) ); } return QObject::event( e ); }
bool Properties::eventFilter( QObject *obj, QEvent* e ) { if ( getTarget() != nullptr && getTarget() == obj && e->type( ) == QEvent::DynamicPropertyChange ) { QDynamicPropertyChangeEvent* propertyChangeEvent = static_cast< QDynamicPropertyChangeEvent* >( e ); updateProperty( propertyChangeEvent->propertyName( ) ); emit propertiesModified( propertyChangeEvent->propertyName( ) ); return false; } else return QObject::eventFilter( obj, e ); return false; }
bool protoObject::eventFilter(QObject *sender, QEvent *ev){ if (ev->type() == QEvent::DynamicPropertyChange){ QDynamicPropertyChangeEvent *propEvent = static_cast<QDynamicPropertyChangeEvent*>(ev); QVariant value = this->property(propEvent->propertyName()); if (value.isValid()) { QString propertyName = propEvent->propertyName(); this->propertyUpdated(propertyName); //qDebug() << "before property change"; emit propertyChange(propertyName, value); }; } return QObject::eventFilter(sender, ev); }
bool XKPPlacementLayout::eventFilter(QObject *object, QEvent *event) { // if event is resize if(event->type() == QEvent::Resize && !inSetGeometry) { QResizeEvent *resizeEvent = static_cast<QResizeEvent *>(event); #ifdef DEBUG_XKPPLACEMENT QSize esize = resizeEvent->size(); qDebug() << "eventFilter:: object " << object->objectName() << " was resized"; qDebug() << "eventFilter:: size(" << esize.width() << "," << esize.height() << ")"; #endif // update dynamic property 'placementSize' with widget size object->setProperty(placementSizeName, resizeEvent->size()); // update geometry in the general widget updateGeometry(); return true; } else // if event is dynamic property changed & not in setGeomtry method if(event->type() == QEvent::DynamicPropertyChange && !inSetGeometry) { QDynamicPropertyChangeEvent *dynamicPropertyChangeEvent = static_cast<QDynamicPropertyChangeEvent *>(event); // if dynamic property 'placement' is changed if(dynamicPropertyChangeEvent->propertyName() == placementName) { #ifdef DEBUG_XKPPLACEMENT qDebug() << "eventFilter:: propery 'placement' of object " << object->objectName() << " was changed"; #endif // find object in list for(int i = 0; i < list.size(); ++i) { ItemWrapper *wrapper = list.at(i); QWidget *widget = static_cast<QWidget *>(object); if(wrapper->widget == widget) { wrapper->position = Placement(wrapper->widget->property(placementName).toUInt()); break; } } // update geometry in the general widget updateGeometry(); return true; } else { // standard event processing return QObject::eventFilter(object, event); } } else { // standard event processing return QObject::eventFilter(object, event); } }
bool PropertyConstraintListItem::event (QEvent* ev) { if (ev->type() == QEvent::DynamicPropertyChange) { if (!blockEvent) { QDynamicPropertyChangeEvent* ce = static_cast<QDynamicPropertyChangeEvent*>(ev); // Get property via internal name of a PropertyUnit QVariant prop = property(ce->propertyName()); QString propName = QString::fromLatin1(ce->propertyName()); Base::Quantity quant = prop.value<Base::Quantity>(); Sketcher::PropertyConstraintList* item; int id = 0; if (this->parent()->getTypeId() == SketcherGui::PropertyConstraintListItem::getClassTypeId()) { item = static_cast<Sketcher::PropertyConstraintList*>(this->parent()->getFirstProperty()); } else { item = static_cast<Sketcher::PropertyConstraintList*>(getFirstProperty()); } const std::vector< Sketcher::Constraint * > &vals = item->getValues(); for (std::vector< Sketcher::Constraint* >::const_iterator it = vals.begin();it != vals.end(); ++it, ++id) { if ((*it)->Type == Sketcher::Distance || // Datum constraint (*it)->Type == Sketcher::DistanceX || (*it)->Type == Sketcher::DistanceY || (*it)->Type == Sketcher::Radius || (*it)->Type == Sketcher::Angle ) { // Get the internal name QString internalName = QString::fromLatin1("Constraint%1").arg(id+1); if (internalName == propName) { double datum = quant.getValue(); if ((*it)->Type == Sketcher::Angle) datum = Base::toRadians<double>(datum); const_cast<Sketcher::Constraint *>((*it))->setValue(datum); item->set1Value(id,(*it)); break; } } } } } return PropertyItem::event(ev); }
bool QGIPiece::event( QEvent * e ) { while( (!impl->blocked) && (e->type() == QEvent::DynamicPropertyChange) ) { QDynamicPropertyChangeEvent *chev = dynamic_cast<QDynamicPropertyChangeEvent *>(e); if( ! chev ) break; char const * key = chev->propertyName().constData(); this->propertySet( key, this->property(key) ); e->accept(); break; } return QObject::event(e); }
static PyObject *meth_QDynamicPropertyChangeEvent_propertyName(PyObject *sipSelf, PyObject *sipArgs) { PyObject *sipParseErr = NULL; { QDynamicPropertyChangeEvent *sipCpp; if (sipParseArgs(&sipParseErr, sipArgs, "B", &sipSelf, sipType_QDynamicPropertyChangeEvent, &sipCpp)) { QByteArray *sipRes; Py_BEGIN_ALLOW_THREADS sipRes = new QByteArray(sipCpp->propertyName()); Py_END_ALLOW_THREADS return sipConvertFromNewType(sipRes,sipType_QByteArray,NULL); } }