×
Namespaces

Variants
Actions
(Difference between revisions)

Archived:Como criar uma animação simples usando QTimeLine

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Automated change of category from Lang-PT to Unlikely Category. (Moving))
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update of Template:ArticleMetaData)
Line 2: Line 2:
 
[[Category:Qt]]
 
[[Category:Qt]]
 
[[Category:Code Examples]]
 
[[Category:Code Examples]]
Original em: [[How to create a simple animation using QTimeLine, in Qt for Symbian]]
 
 
__NOTOC__
 
__NOTOC__
 
__NOEDITSECTION__
 
__NOEDITSECTION__
 
{{ArticleMetaData
 
{{ArticleMetaData
|id=...
 
|platform=S60 3rd Edition FP1, S60 3rd Edition FP2, S60 5th Edition
 
|devices= Emulator
 
|category=Qt for Symbian
 
|subcategory=Animation
 
|creationdate=17 January 2009
 
|keywords=QTimeLine,QProgressBar
 
 
 
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
 
|sourcecode= <!-- Link to example source code (e.g. [[Media:The Code Example ZIP.zip]]) -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 
|installfile= <!-- Link to installation file (e.g. [[Media:The Installation File.sis]]) -->
 +
|devices= Emulator
 
|sdk=<!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
 
|sdk=<!-- SDK(s) built and tested against (e.g. [http://linktosdkdownload/ Nokia Qt SDK 1.1]) -->
 +
|platform=S60 3rd Edition FP1, S60 3rd Edition FP2, S60 5th Edition
 
|devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) -->
 
|devicecompatability=<!-- Compatible devices (e.g.: All* (must have GPS) ) -->
 +
|dependencies= <!-- Any other/external dependencies e.g.: Google Maps Api v1.0 -->
 
|signing=<!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
 
|signing=<!-- Empty or one of Self-Signed, DevCert, Manufacturer -->
 
|capabilities=<!-- Capabilities required (e.g. Location, NetworkServices.) -->
 
|capabilities=<!-- Capabilities required (e.g. Location, NetworkServices.) -->
|author=[[User:Valderind4]]
+
|keywords=QTimeLine,QProgressBar
 +
|id=...
 +
|language=Lang-Portuguese
 +
|translated-by=[[User:Valderind4]]
 +
|translated-from-title=How to create a simple animation using QTimeLine in Qt
 +
|translated-from-id=62192 <!-- automated guess -->
 +
|review-by=<!-- After re-review: [[User:username]] -->
 +
|review-timestamp= <!-- After re-review: YYYYMMDD -->
 +
|update-by= <!-- After significant update: [[User:username]]-->
 +
|update-timestamp= <!-- After significant update: YYYYMMDD -->
 +
|creationdate=20090920
 +
|author=[[User:James1980]]
 +
 
 +
<!-- The following items are not in the standard metadata template -->
 +
|category=Qt for Symbian
 +
|subcategory=Animation
 
}}
 
}}
  
Line 130: Line 139:
  
 
Para mais detalhes visite:[http://pepper.troll.no/s60prereleases/doc/qtimeline.html#curveShape-prop| este link](Inglês)
 
Para mais detalhes visite:[http://pepper.troll.no/s60prereleases/doc/qtimeline.html#curveShape-prop| este link](Inglês)
 +
<!-- Translation --> [[en:How to create a simple animation using QTimeLine in Qt]]

Revision as of 01:53, 19 December 2011


Article Metadata

Testado com
Aparelho(s): Emulator

Compatibilidade
Plataforma(s): S60 3rd Edition FP1, S60 3rd Edition FP2, S60 5th Edition
Symbian

Artigo
Palavras-chave: QTimeLine,QProgressBar
Tradução:
Por valderind4
Última alteração feita por hamishwillee em 19 Dec 2011


Introdução

Este trecho de código mostra como criar uma animação simples em [Qt for S60| Qt para Symbian]]. É empregada a classe QTimeLine, capaz de prover uma linha de tempo para controlar animações.


Pré-requisitos

  • Baixe e instale a versão atual do Qt para Symbian segundo as instruções deste artigo.


Funcionalidades

  • Esta propriedade mantem a direção da linha do tempo enquanto o está em estado de execução. O padrão é avançar.
timeLine->setDirection(QTimeLine::Backward);

Frowardtimeline.JPGBackWardtimeline.JPG

  • Esta propriedade tem a forma da curva da linha do tempo.
timeLine->setCurveShape(QTimeLine::EaseInCurve);
  • Para adicionar um Pause para pausar a TimeLine você deve adicionar o seguinte código no seu código fonte.
 connect(pushButton1, SIGNAL(clicked()), this, SLOT(viral()));

Adicione esta funcionalidade para o seu código atual.

 void timeline::viral(  timeLine->setPaused(1); }

Pauseani.JPG

Trecho de código

Código fonte

#include "timeline.h"
 
timeline::timeline(QWidget *parent)
: QWidget(parent)
{
layout= new QVBoxLayout(this);
progressBar = new QProgressBar(this);
progressBar->setRange(0, 100);
 
// Construct a 5-second timeline with a frame range of 0 - 100
timeLine = new QTimeLine(5000, this);
timeLine->setFrameRange(0, 100);
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.
 
}

Arquivos de cabeçalhos

#ifndef TIMELINE_H
#define TIMELINE_H
 
#include <QtGui/QWidget>
#include "ui_timeline.h"
#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

Captura de tela

Pauseani.JPG

Timeline1.jpg

Timeline2.jpg

Para mais detalhes visite:este link(Inglês)

202 page views in the last 30 days.
×