• <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久久精品国内| 亚洲va久久久噜噜噜久久| 久久无码高潮喷水| 久久夜色精品国产噜噜麻豆| 久久综合丁香激情久久| 久久久久亚洲AV成人网| 精品久久久无码人妻中文字幕| 婷婷久久久亚洲欧洲日产国码AV| 日韩精品久久久久久免费| 99久久国语露脸精品国产| 日韩十八禁一区二区久久| av无码久久久久不卡免费网站| 久久无码国产| 国产精品天天影视久久综合网| 久久久受www免费人成| 欧美午夜精品久久久久免费视 | 97久久精品人人做人人爽| 精品一二三区久久aaa片| 国产成人久久激情91| 久久久午夜精品福利内容| 精品国产综合区久久久久久| 久久九九全国免费| 亚洲精品美女久久777777| 久久久精品久久久久特色影视| 亚洲综合日韩久久成人AV| 久久久噜噜噜久久中文字幕色伊伊| 久久91亚洲人成电影网站| 99久久人妻无码精品系列蜜桃| 香蕉久久夜色精品国产2020| 久久综合狠狠综合久久激情 | 精品久久人妻av中文字幕| 久久综合综合久久综合| 精品久久久无码21p发布| 久久中文字幕人妻熟av女| 色欲综合久久躁天天躁| 九九热久久免费视频| 国产精品99久久久久久www| 99久久www免费人成精品| 国产精品久久久久久久 | 国产2021久久精品| 国产精品99精品久久免费|