You Are Here:

Community: Wiki

This page was last modified on 17 September 2009, at 03:36.

How to use QLCDNumber in Qt for Symbian

From Forum Nokia Wiki


ID ... Creation date 3 January 2008
Platform S60 3rd Edition, S60 5th Edition Tested on devices Emulator (5th edition)
Category Qt for Symbian Subcategory Display information


Keywords (APIs, classes, methods, functions): QLCDNumber,QSpinBox
Reviewer Approved   

Introduction

This article shows the use of LCD number to display some number. For example it can be use to display a score while designing a game.

Various Functions

  • This line create a object of the LCDNumber.
QLCDNumber* number = new QLCDNumber(this);

Image:Lcd.JPG

  • To specify the segment display style of the LCD number. Qt support the three different filled style i.e. Filled,Outline and Flat.
number->setSegmentStyle(QLCDNumber::Filled);

Image:Lcdsegmentstyle.JPG

  • To specify the number of LCD digits that would be display.This function specify the mode of the LCD. Various supported modes are Hex,Dec,Bin and Oct.
number->setMode(QLCDNumber::Hex);

Image:Lcdhex.JPG

Related Link

  • Check this digital clock example that shows the use of the QLCDNumber.


Source Code

Header file

#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()
{
 
}

Screenshot

Image:Lcd.JPG

Related Wiki Articles

No related wiki articles found

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fHowE5ftoE5fuseE5fE51WidgetE5finE5fE51tE5fforE5fSymbianX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZE71tQ qfnZtopicQUqfnTopicZseriesE5f60Q qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qfnZuserE5ftagQSxE71tX qfnZuserE5ftagQSxs60X qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ