zoukankan      html  css  js  c++  java
  • QT 设置QGraphicsItem动起来

    QGraphicsLineItem *line;

        scene->addItem(line = new QGraphicsLineItem(QLineF(QPointF(0, 0), QPointF(300, 300))));   //在创景窗口中画一条直线
        line->setPen(QPen(Qt::DashDotDotLine));

        QGraphicsItemAnimation *animation = new QGraphicsItemAnimation;
        animation->setItem(line);
        //scene->addItem(animation);

        //怎样动需要QTimeLiness函数
        QTimeLine *timeline = new QTimeLine();      //持续三秒钟
        timeline->setLoopCount(NULL);                      //设置循环次数

        animation->setTimeLine(timeline);
        //animation->rotationAt(45);                      //以怎样的角度进行旋转
        animation->setTranslationAt(1, 200, 200);

        timeline->start();

        _timer = new QTimer();
        _timer->setInterval(1000);       //设置间隔时间
        connect(_timer, SIGNAL(timeout()), this, SLOT(slotTimeOut()));
        _timer->start();
  • 相关阅读:
    BZOJ 1088 模拟(扫雷经验…)
    BZOJ 1529
    BZOJ 3224
    BZOJ 1192
    BZOJ 1012
    博客搬家说明
    BZOJ 2423 DP
    BZOJ 1789&1830 推式子 乱搞
    BZOJ 1588
    拆点:虫洞
  • 原文地址:https://www.cnblogs.com/Werial/p/12552951.html
Copyright © 2011-2022 走看看