//______________________________________________________ LabelData::LabelData( QObject* parent, QLabel* target, int duration ): TransitionData( parent, target, duration ), target_( target ) { target_.data()->installEventFilter( this ); bool hasProxy( target_.data()->graphicsProxyWidget() ); transition().data()->setFlags( hasProxy ? TransitionWidget::Transparent : TransitionWidget::GrabFromWindow ); connect( target_.data(), SIGNAL( destroyed() ), SLOT( targetDestroyed() ) ); }
//______________________________________________________ StackedWidgetData::StackedWidgetData( QObject* parent, QStackedWidget* target, int duration ): TransitionData( parent, target, duration ), target_( target ), index_( target->currentIndex() ) { // configure transition connect( target_.data(), SIGNAL( destroyed() ), SLOT( targetDestroyed() ) ); connect( target_.data(), SIGNAL( currentChanged( int ) ), SLOT( animate() ) ); // disable focus transition().data()->setAttribute(Qt::WA_NoMousePropagation, true); transition().data()->setFlag(TransitionWidget::PaintOnWidget, true); setMaxRenderTime( 50 ); }
NearFieldTarget::~NearFieldTarget() { releaseIntent(); emit targetDestroyed(m_uid); }
// Add a prefix to this matcher, together with a positive type code. // Optionally, an object target and slot can be supplied. When the // prefix is matched by "lookup", it will automatically dispatch // matching values to the indicated slot. The slot should have the // prototype "name(const QString&)". void QPrefixMatcher::add( const QString& prefix, QPrefixMatcher::Type type, bool mayBeCommand, QObject *target, const char *slot ) { // The prefix needs at least one character. if ( prefix.isEmpty() ) return; // Traverse the tree to find the insert position. QPrefixMatcherNode *node; QPrefixMatcherNode **reference; node = root->children; reference = &(root->children); for ( int posn = 0; posn < prefix.length(); ++posn ) { ushort ch = prefix[posn].unicode(); while ( node != 0 && node->ch != ch ) { reference = &(node->next); node = node->next; } if ( !node ) { node = new QPrefixMatcherNode(); if ( !node ) return; // Just in case. node->ch = ch; *reference = node; } if ( ( posn + 1 ) < prefix.length() ) { reference = &(node->children); node = node->children; } } node->type = type; node->marker = 1; node->mayBeCommand = mayBeCommand; // Add the target slot information, if necessary. if ( target && slot ) { // Resolve the slot to an index that can be used with qt_metacall. if ( *slot >= '0' && *slot <= '9' ) ++slot; QByteArray name = QMetaObject::normalizedSignature( slot ); int index = target->metaObject()->indexOfMethod( name.constData() ); if ( index == -1 ) { qDebug()<<"AtChat:" << "QPrefixMatcher: " << target->metaObject()->className() << "::" << name << " is not an accessible slot"; return; } // If we haven't seen this target before, then trap // its destroyed() signal so that we can stop sending // it signals when it disappears. if ( !targets.contains( target ) ) { targets.insert( target ); connect( target, SIGNAL(destroyed()), this, SLOT(targetDestroyed()) ); } // If the target is already on this node, don't add it again. QPrefixMatcherTarget *t = node->targets; while ( t != 0 ) { if ( t->target == target && t->index == index ) return; t = t->next; } // Add the target information to the current node. t = new QPrefixMatcherTarget(); t->target = target; t->index = index; t->next = node->targets; node->targets = t; } }