• <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編程
             
            久久综合综合久久综合| 久久精品免费网站网| 狠狠色狠狠色综合久久| 久久人妻无码中文字幕| 五月丁香综合激情六月久久| 精品国产福利久久久| 国产成人精品久久亚洲高清不卡| 久久精品综合一区二区三区| 国内精品综合久久久40p| 国产精品无码久久久久久| 精品久久人人做人人爽综合| 亚洲国产另类久久久精品| 狠狠狠色丁香婷婷综合久久五月| 精品久久久久久国产免费了| 伊人久久无码中文字幕| 亚洲一区中文字幕久久| 久久精品国产99国产精品导航| 97久久精品午夜一区二区| 久久夜色精品国产| 久久国产精品99久久久久久老狼 | 欧美一区二区久久精品| 一本色道久久综合狠狠躁| 麻豆精品久久久一区二区| 青青草原综合久久大伊人| 99久久www免费人成精品| 色综合久久综合中文综合网| 亚洲а∨天堂久久精品| 国产精品欧美久久久久天天影视 | 亚洲国产成人久久综合碰| 国产精品九九九久久九九| 无码人妻久久一区二区三区免费丨| 品成人欧美大片久久国产欧美...| 狼狼综合久久久久综合网| 亚洲乱码精品久久久久..| 久久综合九色综合网站| 久久综合亚洲色HEZYO国产| 亚洲国产二区三区久久| 国内精品久久国产大陆| 69国产成人综合久久精品| 久久久亚洲欧洲日产国码aⅴ| 亚洲AV无码久久|