The QtxFontEdit class represents a widget for font preference items editing. More...
#include <QtxFontEdit.h>
Public Types | |
enum | Features { Family = 0x01, Size = 0x02, UserSize = 0x04, Bold = 0x08, Italic = 0x10, Underline = 0x20, Shadow = 0x40, Preview = 0x80, Scripting = Bold | Italic | Underline, All = Family | Size | UserSize | Scripting | Preview } |
Font widget features. More... | |
enum | Mode { Native, Custom } |
Signals | |
void | changed (const QFont &) |
Public Member Functions | |
QtxFontEdit (const int, QWidget *=0) | |
Constructor. More... | |
QtxFontEdit (QWidget *=0) | |
Constructor. More... | |
virtual | ~QtxFontEdit () |
Destructor. More... | |
QFont | currentFont () const |
Get currently selected font. More... | |
void | setCurrentFont (const QFont &) |
Set currently selected font. More... | |
int | fontSize () const |
Get selected font size. More... | |
QString | fontFamily () const |
Get selected font family name. More... | |
int | fontScripting () const |
Get selected font scripting. More... | |
void | setFontSize (const int) |
Set font size. More... | |
void | setFontFamily (const QString &) |
Set font family name. More... | |
void | setFontScripting (const int) |
Set font scripting. More... | |
int | features () const |
Get font widget features. More... | |
void | setFeatures (const int) |
Set font widget features. More... | |
void | setMode (const int) |
Specifies whether widget works in Native or Custom mode. Native mode is intended for working with system fonts. Custom mode is intended for working with manually defined set of fonts. Set of custom fonts can be specified with setCustomFonts() method. More... | |
int | mode () const |
Verifies whether widget works in Native or Custom mode. More... | |
void | setFonts (const QStringList &) |
Sets list of custom fonts. This method is intended for working in Custom mode. More... | |
QStringList | fonts () const |
Gets list of custom fonts. More... | |
void | setSizes (const QList< int > &=QList< int >()) |
Sets list of available font sizes. This method is intended for working in Custom mode. The list of sizes can be empty. In this case system generate listof size automatically from 8 till 72. More... | |
QList< int > | sizes () const |
Gets list of custom fonts. More... | |
Private Slots | |
void | onPreview (bool) |
Called when "Preview" button is clicked. More... | |
void | onFontChanged (const QFont &) |
Called when current font is changed. More... | |
void | onPropertyChanged () |
Private Member Functions | |
void | initialize () |
void | updateState () |
Update widget state. More... | |
Private Attributes | |
QtxComboBox * | mySize |
QFontComboBox * | myFamily |
QToolButton * | myPreview |
int | myFeatures |
QToolButton * | myB |
QToolButton * | myI |
QToolButton * | myU |
QToolButton * | myS |
int | myMode |
QComboBox * | myCustomFams |
The font preference item is represented as the drop-down combo box filled with the list of available fonts. Additional controls for modifying font properties ('bold', 'italic', font size, etc) are also available for use.
Initial font value can be set with setCurrentFont() method. Chosen font can be retrieved with the currentFont() method.
Font properties can be set with the setFontSize(), setFontFamily(), setFontScripting() methods and retrieved with fontSize(), fontFamily(), fontScripting() methods.
Additional widgets for direct modyfing font properties are available with use of setFeatures() method.
enum QtxFontEdit::Mode |
feat | font widget features (ORed QtxFontEdit::Features flags) |
parent | parent widget |
References initialize().
QtxFontEdit::QtxFontEdit | ( | QWidget * | parent = 0 | ) |
|
virtual |
|
signal |
QFont QtxFontEdit::currentFont | ( | ) | const |
References Bold, fontFamily(), fontScripting(), fontSize(), Italic, Shadow, and Underline.
int QtxFontEdit::features | ( | ) | const |
References myFeatures.
QString QtxFontEdit::fontFamily | ( | ) | const |
References myCustomFams, myFamily, myMode, and Native.
QStringList QtxFontEdit::fonts | ( | ) | const |
int QtxFontEdit::fontScripting | ( | ) | const |
int QtxFontEdit::fontSize | ( | ) | const |
|
private |
References currentFont(), myB, myCustomFams, myFamily, myI, myPreview, myS, mySize, myU, onFontChanged(), onPreview(), onPropertyChanged(), and updateState().
|
privateslot |
f | (not used) |
References changed(), currentFont(), fontFamily(), fontSize(), myFamily, mySize, s, setFontSize(), and sizes().
|
privateslot |
on | (not used) |
References currentFont(), and setCurrentFont().
|
privateslot |
References changed(), and currentFont().
void QtxFontEdit::setCurrentFont | ( | const QFont & | fnt | ) |
fnt | current font |
References Bold, changed(), currentFont(), Italic, myB, myCustomFams, myI, mySize, myU, setFontFamily(), setFontScripting(), setFontSize(), Shadow, and Underline.
void QtxFontEdit::setFeatures | ( | const int | f | ) |
f | font widget features (ORed QtxFontEdit::Features flags) |
References myFeatures, and updateState().
void QtxFontEdit::setFontFamily | ( | const QString & | fam | ) |
fam | new font family name |
References changed(), currentFont(), myCustomFams, myFamily, myMode, Native, and onFontChanged().
void QtxFontEdit::setFonts | ( | const QStringList & | fams | ) |
void QtxFontEdit::setFontScripting | ( | const int | script | ) |
void QtxFontEdit::setFontSize | ( | const int | s | ) |
void QtxFontEdit::setMode | ( | const int | mode | ) |
mode | mode from QtxFontEdit::Mode enumeration |
References Custom, mode(), myCustomFams, myFamily, myMode, and Native.
QList< int > QtxFontEdit::sizes | ( | ) | const |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |