Namespaces
Variants
Actions
Revision as of 03:45, 19 June 2012 by hamishwillee (Talk | contribs)

Archived:Como usar um QLCDNumber

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.

Este artigo mostra como utilizar números em LCD para mostrar algum número. Por exemplo, ele pode ser usado para mostrar a pontuação de um jogo.

Dados do artigo

Testado com
Aparelho(s): Emulator (5th edition)

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

Artigo
Palavras-chave: QLCDNumber,QSpinBox
Tradução:
Última alteração feita por hamishwillee em 19 Jun 2012

Contents

Funcionalidades

  • Esta linha de código cria um objeto LCDNumber.
QLCDNumber* number = new QLCDNumber(this);

Lcd.JPG

  • Para especificar o tipo do estilo de exibição. Qt suporta três diferentes tipos de estilos preenchidos, isto é, Filled,Outline e Flat.
number->setSegmentStyle(QLCDNumber::Filled);

Lcdsegmentstyle.JPG

  • Para especificar o número de dítigos de LCD que gostaria de mostrar. Esta função especifica o modo do LCD. Vários modos são suportados como: Hex,Dec,Bin and Oct.
number->setMode(QLCDNumber::Hex);

Lcdhex.JPG

Links relacionados


Código fonte

Cabeçalhos de arquivo

#ifndef LCDNUMBER_H
#define LCDNUMBER_H
 
#include <QWidget>
#include <QLCDNumber>
#include <QSpinBox>
#include <QVBoxLayout>
 
class lcdnumber : public QWidget
{
Q_OBJECT
 
public:
lcdnumber(QWidget *parent = 0);
~lcdnumber();
private:
QVBoxLayout* layout;
QLCDNumber* number;
QSpinBox* spin;
 
};
 
#endif // LCDNUMBER_H

Source file

#include "lcdnumber.h"
 
lcdnumber::lcdnumber(QWidget *parent)
: QWidget(parent)
{
 
setWindowTitle(("LCD Number"));
layout = new QVBoxLayout(this);
number = new QLCDNumber(this);
spin = new QSpinBox(this);
spin->setMaximum(9);
spin->setMinimum(0);
 
connect(spin, SIGNAL(valueChanged(int)), number, SLOT(display(int)));
layout->addWidget(spin,Qt::AlignCenter);
 
layout->addWidget(number,Qt::AlignCenter);
showMaximized();
}
 
lcdnumber::~lcdnumber()
{
 
}

Captura de tela

Lcd.JPG

204 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