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 (Text replace - "<code cpp>" to "<code cpp-qt>") |
||
| (9 intermediate revisions by one user not shown) | |||
| Line 1: | Line 1: | ||
| − | [[Category:Lang-Portuguese]] | + | {{Archived|language=Lang-Portuguese|timestamp=20120216044453|user=[[User:Hamishwillee|<br />----]]|[[:Category:Qt Quick|Qt Quick]] should be used for all UI development on mobile devices. The approach described in this article (based on {{Qapiname|QWidget}}) is deprecated.}} |
| − | [[Category:Qt]] | + | [[Category:Lang-Portuguese]][[Category:Qt C++ UI]][[Category:Code Snippet]][[Category:MeeGo Harmattan]][[Category:Symbian]] |
| − | [[Category:Code | + | {{Abstract|Este trecho de código mostra como criar uma animação simples em [[Qt (Portuguese)|Qt]]. É empregada a classe QTimeLine, capaz de prover uma linha de tempo para controlar animações.}} |
| − | + | {{ArticleMetaData <!-- v1.2 --> | |
| − | + | ||
| − | {{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]]) --> | ||
|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 | |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 | + | |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 --> | + | |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 by the article/code example (e.g. Location, NetworkServices. --> |
| − | |keywords=QTimeLine,QProgressBar | + | |keywords= QTimeLine,QProgressBar |
| − | + | |language= Lang-Portuguese | |
| − | |language=Lang-Portuguese | + | |translated-by= [[User:Valderind4]] |
| − | |translated-by=[[User:Valderind4]] | + | |translated-from-title= Archived:How to create a simple animation using QTimeLine |
| − | |translated-from-title=How to create a simple animation using QTimeLine | + | |translated-from-id= 62192 <!-- automated guess --> |
| − | |translated-from-id=62192 <!-- automated guess --> | + | |review-by= <!-- After re-review: [[User:username]] --> |
| − | |review-by=<!-- After re-review: [[User:username]] --> | + | |
|review-timestamp= <!-- After re-review: YYYYMMDD --> | |review-timestamp= <!-- After re-review: YYYYMMDD --> | ||
|update-by= <!-- After significant update: [[User:username]]--> | |update-by= <!-- After significant update: [[User:username]]--> | ||
|update-timestamp= <!-- After significant update: YYYYMMDD --> | |update-timestamp= <!-- After significant update: YYYYMMDD --> | ||
| − | |creationdate=20090920 | + | |creationdate= 20090920 |
| − | |author=[[User:James1980]] | + | |author= [[User:James1980]] |
| − | + | ||
| − | + | ||
| − | + | ||
| − | + | ||
}} | }} | ||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
| − | |||
== Funcionalidades == | == Funcionalidades == | ||
| Line 49: | Line 31: | ||
timeLine->setDirection(QTimeLine::Backward); | timeLine->setDirection(QTimeLine::Backward); | ||
| − | [[ | + | [[File:Frowardtimeline.JPG]][[File:BackWardtimeline.JPG]] |
*Esta propriedade tem a forma da curva da linha do tempo. | *Esta propriedade tem a forma da curva da linha do tempo. | ||
| Line 63: | Line 45: | ||
void timeline::viral( timeLine->setPaused(1); } | void timeline::viral( timeLine->setPaused(1); } | ||
| − | [[ | + | [[File:Pauseani.JPG]] |
== Trecho de código == | == Trecho de código == | ||
| Line 69: | Line 51: | ||
=== Código fonte === | === Código fonte === | ||
| − | <code cpp> | + | <code cpp-qt> |
#include "timeline.h" | #include "timeline.h" | ||
| Line 102: | Line 84: | ||
===Arquivos de cabeçalhos === | ===Arquivos de cabeçalhos === | ||
| − | <code cpp> | + | <code cpp-qt> |
#ifndef TIMELINE_H | #ifndef TIMELINE_H | ||
#define TIMELINE_H | #define TIMELINE_H | ||
| Line 132: | Line 114: | ||
== Captura de tela== | == Captura de tela== | ||
| − | [[ | + | [[File:Pauseani.JPG]] |
| − | [[ | + | [[File:timeline1.jpg]] |
| − | [[ | + | [[File:timeline2.jpg]] |
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 | + | |
| + | <!-- Translation --> [[en:Archived:How to create a simple animation using QTimeLine]] | ||
Latest revision as of 04:13, 11 October 2012
Aquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.
Qt Quick should be used for all UI development on mobile devices. The approach described in this article (based on QWidget) is deprecated.
Qt Quick should be used for all UI development on mobile devices. The approach described in this article (based on QWidget) is deprecated.
Este trecho de código mostra como criar uma animação simples em Qt. É empregada a classe QTimeLine, capaz de prover uma linha de tempo para controlar animações.
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 11 Oct 2012
Contents |
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)



