Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
QtxFontEdit Class Reference

The QtxFontEdit class represents a widget for font preference items editing. More...

#include <QtxFontEdit.h>

Inheritance diagram for QtxFontEdit:
Inheritance graph

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

QtxComboBoxmySize
 
QFontComboBox * myFamily
 
QToolButtonmyPreview
 
int myFeatures
 
QToolButtonmyB
 
QToolButtonmyI
 
QToolButtonmyU
 
QToolButtonmyS
 
int myMode
 
QComboBoxmyCustomFams
 

Detailed Description

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.

Member Enumeration Documentation

Enumerator
Family 

show font family selection widget

Size 

show font size widget

UserSize 

allow font size direct change

Bold 

show 'bold' widget

Italic 

show 'italic' widget

Underline 

show 'underline' widget

Shadow 

show 'shadow' widget

Preview 

show font preview widget

Scripting 

show font scripting widgets ('bold','italic','underline')

All 

show all font widgets

Enumerator
Native 

Native mode intended for working with system fonts.

Custom 

Custom mode intended for working with manually defined set of fonts.

Constructor & Destructor Documentation

QtxFontEdit::QtxFontEdit ( const int  feat,
QWidget parent = 0 
)
Parameters
featfont widget features (ORed QtxFontEdit::Features flags)
parentparent widget

References initialize().

QtxFontEdit::QtxFontEdit ( QWidget parent = 0)
Parameters
parentparent widget

All font widget features are enabled.

References initialize().

QtxFontEdit::~QtxFontEdit ( )
virtual

Member Function Documentation

void QtxFontEdit::changed ( const QFont &  )
signal
QFont QtxFontEdit::currentFont ( ) const
Returns
current font
See Also
setCurrentFont()

References Bold, fontFamily(), fontScripting(), fontSize(), Italic, Shadow, and Underline.

int QtxFontEdit::features ( ) const
Returns
font widget features (ORed QtxFontEdit::Features flags)
See Also
setFeatures()

References myFeatures.

QString QtxFontEdit::fontFamily ( ) const
Returns
current font family name
See Also
setFontFamily()

References myCustomFams, myFamily, myMode, and Native.

QStringList QtxFontEdit::fonts ( ) const
Returns
list of families
See Also
setFonts(), setMode()

References myCustomFams.

int QtxFontEdit::fontScripting ( ) const
Returns
current font scripting
See Also
setFontScripting()

References Bold, Italic, myB, myI, myS, myU, Shadow, and Underline.

int QtxFontEdit::fontSize ( ) const
Returns
current font size
See Also
setFontSize()

References mySize.

void QtxFontEdit::initialize ( )
private
int QtxFontEdit::mode ( ) const
Returns
Native or Custom mode
See Also
setMode()

References myMode.

void QtxFontEdit::onFontChanged ( const QFont &  )
privateslot
Parameters
f(not used)

References changed(), currentFont(), fontFamily(), fontSize(), myFamily, mySize, s, setFontSize(), and sizes().

void QtxFontEdit::onPreview ( bool  )
privateslot
Parameters
on(not used)

References currentFont(), and setCurrentFont().

void QtxFontEdit::onPropertyChanged ( )
privateslot

References changed(), and currentFont().

void QtxFontEdit::setCurrentFont ( const QFont &  fnt)
void QtxFontEdit::setFeatures ( const int  f)
Parameters
ffont widget features (ORed QtxFontEdit::Features flags)
See Also
features()

References myFeatures, and updateState().

void QtxFontEdit::setFontFamily ( const QString &  fam)
Parameters
famnew font family name
See Also
fontFamily()

References changed(), currentFont(), myCustomFams, myFamily, myMode, Native, and onFontChanged().

void QtxFontEdit::setFonts ( const QStringList &  fams)
Parameters
famslist of families
See Also
fonts(), setMode()

References myCustomFams, and setSizes().

void QtxFontEdit::setFontScripting ( const int  script)
Parameters
famnew font scripting
See Also
fontScripting()

References Bold, Italic, myB, myI, myS, myU, Shadow, and Underline.

void QtxFontEdit::setFontSize ( const int  s)
Parameters
famnew font size
See Also
fontSize()

References mySize.

void QtxFontEdit::setMode ( const int  mode)
Parameters
modemode from QtxFontEdit::Mode enumeration
See Also
mode()

References Custom, mode(), myCustomFams, myFamily, myMode, and Native.

void QtxFontEdit::setSizes ( const QList< int > &  sizes = QList<int>())
Parameters
sizeslist of sizes
See Also
sizes(), setMode()

References mySize.

QList< int > QtxFontEdit::sizes ( ) const
Returns
list of families
See Also
setCustomFonts(), setMode()

References mySize.

void QtxFontEdit::updateState ( )
private

Member Data Documentation

QToolButton* QtxFontEdit::myB
private
QComboBox* QtxFontEdit::myCustomFams
private
QFontComboBox* QtxFontEdit::myFamily
private
int QtxFontEdit::myFeatures
private
QToolButton * QtxFontEdit::myI
private
int QtxFontEdit::myMode
private
QToolButton* QtxFontEdit::myPreview
private
QToolButton * QtxFontEdit::myS
private
QtxComboBox* QtxFontEdit::mySize
private
QToolButton * QtxFontEdit::myU
private

The documentation for this class was generated from the following files: