×
Namespaces

Variants
Actions
(Difference between revisions)

Archived:Como usar um QStackedLayout

From Nokia Developer Wiki
Jump to: navigation, search
hamishwillee (Talk | contribs)
m (Hamishwillee - Bot update of Template:ArticleMetaData)
hamishwillee (Talk | contribs)
m (Text replace - "<code cpp>" to "<code cpp-qt>")
 
(8 intermediate revisions by one user not shown)
Line 1: Line 1:
[[Category:Lang-Portuguese]]
+
{{Archived|language=Lang-Portuguese|timestamp=20120216050340|user=[[User:Hamishwillee|&lt;br /&gt;----]]|[[: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 Examples]]
+
{{Abstract|Este trecho de código, demonstra como utilizar o ''stacked layout'' em [[Qt (Portuguese)|Qt]]. A classe QStackedLayout provêr uma pilha de widgets, onde apenas um widget é visível por vez.}}
__NOTOC__
+
 
__NOEDITSECTION__
+
{{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=QStackedLayout
+
|keywords= QStackedLayout
|id=...
+
|language= Lang-Portuguese
|language=Lang-Portuguese
+
|translated-by= [[User:Valderind4]]
|translated-by=[[User:Valderind4]]
+
|translated-from-title= Archived:How to use QStackedLayout
|translated-from-title=How to use QStackedLayout in Qt
+
|translated-from-id= 61190 <!-- automated guess -->
|translated-from-id=61190 <!-- 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=20090913
+
|creationdate= 20090913
|author=[[User:James1980]]
+
|author= [[User:James1980]]
 
+
<!-- The following items are not in the standard metadata template -->
+
|category=Qt for Symbian
+
|subcategory=Layout
+
 
}}
 
}}
 
 
==Introdução==
 
 
Este trecho de código, demonstra como utilizar o ''stacked layout'' em [[Qt for Symbian| Qt para Symbian]]. A classe QStackedLayout provêr uma pilha de widgets, onde apenas um widget é visível por vez.
 
 
==Pré-requisitos==
 
 
* Baixe e instale a versão atual do Qt para Symbian segundo as instruções [[Qt para Symbian|deste artigo]].
 
  
 
== Funcionalidades ==
 
== Funcionalidades ==
Line 46: Line 31:
 
  stackedLayout->setStackingMode(QStackedLayout::StackAll);
 
  stackedLayout->setStackingMode(QStackedLayout::StackAll);
  
[[Image:Laayout.PNG ]]
+
[[File:Laayout.PNG ]]
  
 
== Código fonte ==
 
== Código fonte ==
  
<code cpp>
+
<code cpp-qt>
  
  
Line 99: Line 84:
 
== Cabeçalho do arquivo ==
 
== Cabeçalho do arquivo ==
  
<code cpp>
+
<code cpp-qt>
  
  
Line 142: Line 127:
 
== Captura de tela ==
 
== Captura de tela ==
  
[[Image:stacked1.jpg]]
+
[[File:stacked1.jpg]]
  
[[Image:stacked2.jpg]]
+
[[File:stacked2.jpg]]  
<!-- Translation --> [[en:How to use QStackedLayout in Qt]]
+
<!-- Translation --> [[en:Archived:How to use QStackedLayout]]

Latest revision as of 04:13, 11 October 2012

Archived.pngAquivado: 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.

Este trecho de código, demonstra como utilizar o stacked layout em Qt. A classe QStackedLayout provêr uma pilha de widgets, onde apenas um widget é visível por vez.

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: QStackedLayout
Tradução:
Por valderind4
Última alteração feita por hamishwillee em 11 Oct 2012

Contents

[edit] Funcionalidades

  • Esta propriedade, determina o modo de visibilidade dos widgets filho que são manipulados.
stackedLayout->setStackingMode(QStackedLayout::StackAll);

Laayout.PNG

[edit] Código fonte

#include "stacked.h"
 
stacked::stacked(QWidget *parent)
: QWidget(parent)
{
firstPageWidget = new QWidget(this);
secondPageWidget = new QWidget(this);
thirdPageWidget = new QWidget(this);
label1 = new QLabel("page1",this);
label2 = new QLabel("page2",this);
label3 = new QLabel("page3",this);
Layout1 = new QVBoxLayout(this);
Layout2 = new QVBoxLayout(this);
Layout3 = new QVBoxLayout(this);
Layout1->addWidget(label1);
Layout2->addWidget(label2);
Layout3->addWidget(label3);
firstPageWidget ->setLayout(Layout1);
secondPageWidget ->setLayout(Layout2);
thirdPageWidget ->setLayout(Layout3);
stackedLayout = new QStackedLayout;
stackedLayout->addWidget(firstPageWidget);
stackedLayout->addWidget(secondPageWidget);
stackedLayout->addWidget(thirdPageWidget);
 
mainLayout = new QVBoxLayout;
pageComboBox = new QComboBox;
pageComboBox->addItem(tr("Page 1"));
pageComboBox->addItem(tr("Page 2"));
pageComboBox->addItem(tr("Page 3"));
connect(pageComboBox, SIGNAL(activated(int)),stackedLayout, SLOT(setCurrentIndex(int)));
mainLayout->addWidget(pageComboBox);
mainLayout->addLayout(stackedLayout);
setLayout(mainLayout);
 
}
 
stacked::~stacked()
{
// No need to delete any object that has a parent which is properly deleted.
 
}

[edit] Cabeçalho do arquivo

#ifndef STACKED_H
#define STACKED_H
#include <QLabel>
#include <QtGui/QWidget>
#include "ui_stacked.h"
#include <QVBoxLayout>
#include <QStackedLayout>
#include <QComboBox>
class stacked : public QWidget
{
Q_OBJECT
 
public:
stacked(QWidget *parent = 0);
~stacked();
 
private:
QLabel* label1;
QLabel* label2;
QLabel* label3;
QWidget* firstPageWidget;
QWidget* secondPageWidget;
QWidget* thirdPageWidget;
QComboBox* pageComboBox;
QStackedLayout* stackedLayout;
QVBoxLayout* mainLayout;
QVBoxLayout* Layout1;
QVBoxLayout* Layout2;
QVBoxLayout* Layout3;
 
};
 
#endif // STACKED_H

[edit] Descrição

  • Neste exemplo, três janelas são criados e são organizadas na pilha. Muto embora, apenas uma janela por vez, é visível. Uma combobox é usada para controlar a tela. Através da mudança no combobox, a janela visível pode ser mudada.

[edit] Captura de tela

Stacked1.jpg

Stacked2.jpg

This page was last modified on 11 October 2012, at 04:13.
201 page views in the last 30 days.