Namespaces
Variants
Actions
Revision as of 04:14, 11 October 2012 by hamishwillee (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Archived:Como utilizar uma QStatusBar, em Qt para Maemo

Jump to: navigation, search
Archived.png
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.
Dados do artigo

Testado com
SDK: Qt 4.5
Aparelho(s): n800, n810, n900

Compatibilidade
Plataforma(s): Maemo,

Artigo
Palavras-chave: Qt, Maemo, main window, status bar
Tradução:
Última alteração feita por hamishwillee em 11 Oct 2012

Contents

Introdução

A classe QMainWindow permite a criação de uma janela principal, que provêr uma adequada barra horizontal para apresentação de informações de status. Este barra está posicionada na parte de baixo da janela e pode ser arquivada através da função statusBar(). Este função cria e retorna um objeto do tipo QStatusBar, se ele ainda não existir.

A classe QStatusBar permite a adição de mensagens temporárias ou permanente, permite também adicionar a ela QLabel, QProgressBar ou QToolButton.

Pré-requisitos

Possuir o Qt em Maemo instalado: Primeiros passos, em Qt para Maemo

Para usar a classe QStatusBar nós precisamos incluir QStatusBar no arquivo de cabeçalho:

 #include <QStatusBar>

Exemplo

Considerando que nós temos uma QMainWindow, vamos adicionar uma mensagem temporária (por dez segundos):

QStatusBar *status;  
status = statusBar();
status->showMessage("this is the status bar", 10000);

Opcionalmente, vamos adicionar um widget permanent (um QLabel, neste caso):

QStatusBar *status;   
QLabel *label = new QLabel(this);
label->setText("this the status bar");
status = statusBar();
status->addPermanentWidget(label, 200);
status->show();

Conclusões

Se todos arquivos compilarem normal, você visualizará a seguinte imagem:

Status bar.jpg

164 page views in the last 30 days.
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved