| 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 |
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 *font=new QFontComboBox(); font->setFontFilter(QFontComboBox::NonScalableFonts);
font->setWritingSystem(QFontDatabase::Thaana);
QObject::connect(font,SIGNAL(currentFontChanged(QFont)),edit,SLOT(setCurrentFont(QFont)));
#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();
}
More about QFontComboBox
More about QFontComboBox
No related wiki articles found