示例#1
0
文件: ghostitem.cpp 项目: KDE/kapman
void GhostItem::updateState()
{
    // Stop timers
    if (m_startBlinkingTimer->isActive()) {
        m_startBlinkingTimer->stop();
    }
    if (m_blinkTimer->isActive()) {
        m_blinkTimer->stop();
    }
    switch (((Ghost *)getModel())->getState()) {
    case Ghost::PREY:
        updateBlinkTimersDuration();
        setElementId(QLatin1Literal("scaredghost"));
        m_startBlinkingTimer->start();
        // The ghosts are now weaker than the kapman, so they are under him
        setZValue(1);
        break;
    case Ghost::HUNTER:
        setElementId(((Ghost *)getModel())->getImageId());
        // The ghosts are stronger than the kapman, they are above him
        setZValue(3);
        break;
    case Ghost::EATEN:
        setElementId(QLatin1Literal("ghosteye"));
        // The ghosts are now weaker than the kapman, so they are under him
        setZValue(1);
        break;
    }
}
示例#2
0
文件: ghostitem.cpp 项目: KDE/kapman
void GhostItem::blink()
{
    CharacterItem::blink();
    if (m_nbBlinks % 2 == 0) {
        setElementId(QLatin1Literal("scaredghost"));
    } else {
        setElementId(QLatin1Literal("whitescaredghost"));
    }
}
示例#3
0
文件: svgcard.cpp 项目: Dgzt/knapsen
SvgCard::SvgCard( QSvgRenderer* renderer, qreal height, int animationTime ) :
    QGraphicsSvgItem(),
    mSelectable( false )
{
    mAnimation = new Animation( this, animationTime );
    
    setSharedRenderer( renderer );
    
    setElementId( SvgCard::backCardText() );
    
    setAcceptHoverEvents( true );
    
    //
    kDebug() << boundingRect();
    qreal scale = height / boundingRect().height();
    kDebug() << height << "/" << boundingRect().height()<< "=" << scale;
    
    //mSize = QSizeF( width, boundingRect().height() * scale );
    mSize = QSizeF( boundingRect().width() * scale, height );
    
    kDebug() << mSize;
    
    update();
    kDebug() << boundingRect();
}
示例#4
0
Hole::Hole(const QPoint& position, QGraphicsItem* parent)
        : QGraphicsSvgItem(parent),
        m_peg(0)
{
    setElementId("hole");
    setZValue(1);
    setPos(position.x() * 22, position.y() * 22);
    setFlag(QGraphicsItem::ItemIsMovable, false);
}
SimilarArtistsAction::SimilarArtistsAction( QObject *parent )
    : GlobalCollectionArtistAction( i18n( "Play Similar Artists from Last.fm" ), parent )
{
    connect( this, SIGNAL( triggered( bool ) ), SLOT( slotTriggered() ) );

    setIcon( KIcon("view-services-lastfm-amarok") );
    setRenderer( The::svgHandler()->getRenderer( "amarok/images/pud_items.svg" ) );
    setElementId( "lastfm" );
}
示例#6
0
文件: todraw.cpp 项目: KDE/ktuberling
// Load an object from a file
bool ToDraw::load(QDataStream &stream)
{
  // NOTE: read error checking?
  QPointF pos;
  QString element;
  qreal zOrder;

  stream >> pos;
  stream >> element;
  stream >> zOrder;

  setPos(pos);
  setElementId(element);
  setZValue(zOrder);

  return true;
}
int QGraphicsSvgItem::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QGraphicsObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: d_func()->_q_repaintItem(); break;
        default: ;
        }
        _id -= 1;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QString*>(_v) = elementId(); break;
        case 1: *reinterpret_cast< QSize*>(_v) = maximumCacheSize(); break;
        }
        _id -= 2;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setElementId(*reinterpret_cast< QString*>(_v)); break;
        case 1: setMaximumCacheSize(*reinterpret_cast< QSize*>(_v)); break;
        }
        _id -= 2;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 2;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 2;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
示例#8
0
void Hole::setHighlighted(bool highlight)
{
    setElementId(!highlight ? "hole" : "highlight");
}