• <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就是一個帶有線程的對象,通過設置持續時間和幀數來控制動畫
            posted on 2011-09-07 20:26 ccsdu2009 閱讀(4093) 評論(0)  編輯 收藏 引用 所屬分類: QT編程
             
            国产精品99久久久久久猫咪| 久久笫一福利免费导航 | 久久香综合精品久久伊人| 久久久久久国产精品免费无码| 久久天堂电影网| 综合久久久久久中文字幕亚洲国产国产综合一区首 | 三上悠亚久久精品| 色综合久久精品中文字幕首页| 精品久久久久久国产免费了| 久久伊人五月丁香狠狠色| 国产99久久精品一区二区| 四虎久久影院| 成人精品一区二区久久久| 久久AV无码精品人妻糸列| 精品多毛少妇人妻AV免费久久| 久久无码专区国产精品发布| 丁香久久婷婷国产午夜视频| 中文字幕久久久久人妻| 久久久WWW成人免费毛片| 久久精品a亚洲国产v高清不卡| 久久一本综合| 激情综合色综合久久综合| 国产99久久精品一区二区| 久久精品国产精品亚洲精品 | 国产成人精品综合久久久久 | 久久一区二区三区免费| 久久精品国产69国产精品亚洲| 香蕉久久av一区二区三区| 午夜精品久久久久久影视riav| 国产精品狼人久久久久影院 | 久久久噜噜噜久久中文字幕色伊伊| 精品久久人人妻人人做精品| 久久91精品国产91久久麻豆| 久久精品午夜一区二区福利| 一本一本久久A久久综合精品| 国内精品久久国产| 久久人妻无码中文字幕| 国产精品99久久久精品无码| 精品久久久一二三区| 无码精品久久久久久人妻中字 | 久久综合久久综合亚洲|