You Are Here:

Community: Wiki

This page was last modified on 31 October 2009, at 14:12.

How to use QFontComboBox in Qt for Symbian

From Forum Nokia Wiki


Reviewer Approved   



ID ... Creation date 28 March 2009
Platform S60 3rd Edition FP1, S60 3rd Edition FP2, S60 5th Edition Tested on devices S60 Emulator
Category Qt for S60 Subcategory Application


Keywords (APIs, classes, methods, functions): QFont,QTextEdit,QFontComboBox

Overview

The QFontComboBox widget is a combobox that lets the user select a font family.

The combobox is populated with an alphabetized list of font family names, such as Arial, Helvetica, and Times New Roman. Family names are displayed using the actual font when possible.

For fonts such as Symbol, where the name is not representable in the font itself, a sample of the font is displayed next to the family name.QFontComboBox

This exmaple makes the use of following classes

QFontComboBox

QFont

Preconditions

Various function

  • This property holds the filter for the combobox.
QFontComboBox *font=new QFontComboBox();
font->setFontFilter(QFontComboBox::NonScalableFonts);
  • This property holds the writing system that serves as a filter for the combobox.
font->setWritingSystem(QFontDatabase::Thaana);

Signal and Slots

QObject::connect(font,SIGNAL(currentFontChanged(QFont)),edit,SLOT(setCurrentFont(QFont)));

Source code

#include <QtGui/QApplication>
#include "fontcombo.h"
#include<QWidget>
#include<QVBoxLayout>
#include<QTextEdit>
#include<QFontComboBox>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWidget *win=new QWidget();
QVBoxLayout *lay=new QVBoxLayout();
QTextEdit *edit=new QTextEdit();
QFontComboBox *font=new QFontComboBox();
QObject::connect(font,SIGNAL(currentFontChanged(QFont)),edit,SLOT(setCurrentFont(QFont));
lay->addWidget(font);
lay->addWidget(edit);
win->setLayout(lay);
win->setStyleSheet("* { background-color:rgb(199,147,88); padding: 7px ; color:rgb(255,255,255)}");
win->showMaximized();
return a.exec();
}

Screenshot

More about QFontComboBox

Image:Fontcombo001.jpg

More about QFontComboBox

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: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fHttpE3aE2fE2f217E2e218E2e225E2e2E3a2082E2findeE78E2ehtmlE253FX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfntypeZCommunityContentQ qdcZtypeQUqfntypeZE52esourceQ qdcZtypeQUqfntypeZWebpageQ qdcZtypeQUqfntypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtypeQUqfntypeZCommunityContentQ qfnZtypeQUqfntypeZE52esourceQ qfnZtypeQUqfntypeZWebpageQ qfnZtypeQUqfntypeZWikiContentQ qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfntypeZCommunityContentQ qrdfZtypeQUqfntypeZE52esourceQ qrdfZtypeQUqfntypeZWebpageQ qrdfZtypeQUqfntypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ