Archived:Como criar uma animação simples usando QTimeLine
hamishwillee
(Talk | contribs) m (moved Como criar uma animação simples usando QTimeLine, em Qt para Symbian to Como criar uma animação simples usando QTimeLine, em Qt: "para Symbian" not required for "generic" topic) |
hamishwillee
(Talk | contribs) m (Hamishwillee - Tidy wiki text) |
||
| Line 1: | Line 1: | ||
| − | [[Category:Lang-Portuguese]] | + | [[Category:Lang-Portuguese]][[Category:Qt]][[Category:Code Examples]][[Category:MeeGo]][[Category:Symbian]] |
| − | [[Category:Qt]] | + | |
| − | [[Category:Code Examples]] | + | |
| − | + | ||
| − | + | ||
{{ArticleMetaData | {{ArticleMetaData | ||
|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]]) --> | ||
| Line 15: | Line 11: | ||
|capabilities=<!-- Capabilities required (e.g. Location, NetworkServices.) --> | |capabilities=<!-- Capabilities required (e.g. Location, NetworkServices.) --> | ||
|keywords=QTimeLine,QProgressBar | |keywords=QTimeLine,QProgressBar | ||
| − | |||
|language=Lang-Portuguese | |language=Lang-Portuguese | ||
|translated-by=[[User:Valderind4]] | |translated-by=[[User:Valderind4]] | ||
| Line 26: | Line 21: | ||
|creationdate=20090920 | |creationdate=20090920 | ||
|author=[[User:James1980]] | |author=[[User:James1980]] | ||
| − | |||
| − | |||
| − | |||
| − | |||
}} | }} | ||
| − | |||
==Introdução== | ==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. | 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== | ==Pré-requisitos== | ||
| Line 139: | Line 128: | ||
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 | + | <!-- Translation --> [[en:How to create a simple animation using QTimeLine in Qt]] |
Revision as of 12:47, 15 February 2012
Dados do artigo
Testado com
Aparelho(s): Emulator
Compatibilidade
Plataforma(s): S60 3rd Edition FP1, S60 3rd Edition FP2, S60 5th Edition
Artigo
Palavras-chave: QTimeLine,QProgressBar
Tradução:
Por valderind4
Última alteração feita por hamishwillee
em 15 Feb 2012
Contents |
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);
- 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); }
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
Para mais detalhes visite:este link(Inglês)



