• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            Cpper
            C/C++高級工程師 Android高級軟件工程師 IT集成工程師 音頻工程師 熟悉c,c++,java,c#,py,js,asp等多種語言 程序猿
            一個簡單的代碼如下:
            #include <QtGui/QApplication>
            #include <QtGui>
            #include <math.h>
            int main(int argc, char *argv[])
            {
             QApplication a(argc, argv);
             QGraphicsItem *ball = new QGraphicsEllipseItem(0,0,20,40);
             QTimeLine *timer = new QTimeLine(15000);
             timer->setFrameRange(0,100);
             QGraphicsItemAnimation *animation = new QGraphicsItemAnimation;
             animation->setItem(ball);
             animation->setTimeLine(timer);
             for(int i = 0; i < 600; ++i)
             animation->setPosAt(i / 600.0, QPointF(i, i));
             QGraphicsScene *scene = new QGraphicsScene();
             scene->setBackgroundBrush(QBrush(Qt::blue));
             scene->setSceneRect(0,0,250,250);
             scene->addItem(ball);
             QGraphicsView *view = new QGraphicsView(scene);
             view->setBackgroundBrush(QBrush(Qt::red));
             view->show();
             timer->start();
             return a.exec();
            }

            另外一個例子如下:
            #ifndef TIMELINE_H
            #define TIMELINE_H
            #include 
            <QtGui/QWidget>
            #include 
            <QVBoxLayout>
            #include 
            <QTimeLine>
            #include 
            <QProgressBar>
            #include 
            <QPushButton>

            class timeline : public QWidget
            {
                Q_OBJECT
            public:
                timeline(QWidget 
            *parent = 0);
                
            ~timeline();
            private:
                QPushButton 
            *pushButton;
                QTimeLine 
            *timeLine;
                QProgressBar 
            *progressBar;
                QVBoxLayout 
            *layout;
            };

            #endif // TIMELINE_H

            #include 
            "timeline.h"

            timeline::timeline(QWidget 
            *parent):QWidget(parent)
            {
                layout
            = new QVBoxLayout(this);
                progressBar 
            = new QProgressBar(this);
                progressBar
            ->setRange(0100);

                
            // Construct a 5-second timeline with a frame range of 0 - 100
                timeLine = new QTimeLine(5000this);
                timeLine
            ->setFrameRange(0100);
                connect(timeLine, SIGNAL(frameChanged(
            int)), progressBar, SLOT(setValue(int)));

                
            // Clicking the push button will start the progress bar animation
                pushButton = new QPushButton(tr("Start animation"), this);
                connect(pushButton, SIGNAL(clicked()), timeLine, SLOT(start()));
                layout
            ->addWidget(progressBar);
                layout
            ->addWidget(pushButton);
                setLayout(layout);
            }

            timeline::
            ~timeline()
            {
               
            // No need to delete any QObject that got proper parent pointer.
            }

            簡單的說 QTimeLine就是一個帶有線程的對象,通過設(shè)置持續(xù)時間和幀數(shù)來控制動畫
            posted on 2011-09-07 20:26 ccsdu2009 閱讀(4094) 評論(0)  編輯 收藏 引用 所屬分類: QT編程
             
            精品久久久久久99人妻| 久久亚洲国产精品一区二区| 久久综合久久综合亚洲| 亚洲第一永久AV网站久久精品男人的天堂AV| 国产成人精品久久| 久久精品国产99久久久古代| 久久精品www| 狠狠色丁香久久婷婷综合图片| 亚洲精品无码久久久久sm| 国产成人99久久亚洲综合精品| 亚洲人成网亚洲欧洲无码久久 | 久久久久国产一区二区| 日韩人妻无码精品久久免费一| 国产无套内射久久久国产| 亚洲精品高清国产一线久久| 亚洲国产成人久久综合区| 国产999精品久久久久久| 久久久亚洲欧洲日产国码二区| 久久av高潮av无码av喷吹| 国产精品久久国产精麻豆99网站| 久久国产欧美日韩精品| 亚洲精品综合久久| 久久91这里精品国产2020| 久久精品国产一区| 69久久夜色精品国产69| 亚洲伊人久久大香线蕉综合图片 | 亚洲国产天堂久久综合网站| 伊人久久综合精品无码AV专区| 久久婷婷午色综合夜啪| 久久精品一本到99热免费| 欧美精品一本久久男人的天堂| 久久强奷乱码老熟女网站| 亚洲中文字幕伊人久久无码 | 无码国内精品久久人妻| 久久国产乱子伦精品免费午夜| 久久只有这里有精品4| 国产成人精品久久| 久久精品国产99国产电影网| 久久人人爽人人爽人人片AV麻烦| 久久青青草原精品影院| 丰满少妇人妻久久久久久4|