Version: 6.3.1
Public Types | Signals | Public Member Functions | Private Slots | Private Member Functions | Private Attributes

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.
 QtxFontEdit (QWidget *=0)
 Constructor.
virtual ~QtxFontEdit ()
 Destructor.
QFont currentFont () const
 Get currently selected font.
void setCurrentFont (const QFont &)
 Set currently selected font.
int fontSize () const
 Get selected font size.
QString fontFamily () const
 Get selected font family name.
int fontScripting () const
 Get selected font scripting.
void setFontSize (const int)
 Set font size.
void setFontFamily (const QString &)
 Set font family name.
void setFontScripting (const int)
 Set font scripting.
int features () const
 Get font widget features.
void setFeatures (const int)
 Set font widget features.
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.
int mode () const
 Verifies whether widget works in Native or Custom mode.
void setFonts (const QStringList &)
 Sets list of custom fonts. This method is intended for working in Custom mode.
QStringList fonts () const
 Gets list of custom fonts.
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.
QList< int > sizes () const
 Gets list of custom fonts.

Private Slots

void onPreview (bool)
 Called when "Preview" button is clicked.
void onFontChanged (const QFont &)
 Called when current font is changed.
void onPropertyChanged ()

Private Member Functions

void initialize ()
void updateState ()
 Update widget state.

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

QFont QtxFontEdit::currentFont ( ) const
Returns:
current font
See also:
setCurrentFont()

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

void QtxFontEdit::setCurrentFont ( const QFont &  fnt)
int QtxFontEdit::fontSize ( ) const
Returns:
current font size
See also:
setFontSize()

References mySize.

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

References myCustomFams, myFamily, myMode, and Native.

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

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::setFontFamily ( const QString &  fam)
Parameters:
famnew font family name
See also:
fontFamily()

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

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

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

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

References myFeatures.

void QtxFontEdit::setFeatures ( const int  f)
Parameters:
ffont widget features (ORed QtxFontEdit.Features flags)
See also:
features()

References myFeatures, and updateState().

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

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

int QtxFontEdit::mode ( ) const
Returns:
Native or Custom mode
See also:
setMode()

References myMode.

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

References myCustomFams, and setSizes().

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

References myCustomFams.

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.changed ( const QFont &  ) [signal]
void QtxFontEdit::onPreview ( bool  ) [private, slot]
Parameters:
on(not used)

References currentFont(), and setCurrentFont().

void QtxFontEdit::onFontChanged ( const QFont &  ) [private, slot]
Parameters:
f(not used)

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

void QtxFontEdit::onPropertyChanged ( ) [private, slot]

References changed(), and currentFont().

void QtxFontEdit::initialize ( ) [private]
void QtxFontEdit::updateState ( ) [private]

Field Documentation

QFontComboBox* QtxFontEdit.myFamily [private]
int QtxFontEdit.myFeatures [private]
int QtxFontEdit.myMode [private]
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS