Version: 9.12.0
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 QtxFontEdit class represents a widget for font preference items editing.

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

◆ Features

Font widget features.

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

◆ Mode

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() [1/2]

QtxFontEdit::QtxFontEdit ( const int  feat,
QWidget parent = 0 
)

Constructor.

Parameters
featfont widget features (ORed QtxFontEdit::Features flags)
parentparent widget

References initialize().

◆ QtxFontEdit() [2/2]

QtxFontEdit::QtxFontEdit ( QWidget parent = 0)

Constructor.

Parameters
parentparent widget

All font widget features are enabled.

References initialize().

◆ ~QtxFontEdit()

QtxFontEdit::~QtxFontEdit ( )
virtual

Destructor.

Member Function Documentation

◆ changed

void QtxFontEdit::changed ( const QFont &  )
signal

◆ currentFont()

QFont QtxFontEdit::currentFont ( ) const

Get currently selected font.

Returns
current font
See also
setCurrentFont()

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

◆ features()

int QtxFontEdit::features ( ) const

Get font widget features.

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

References myFeatures.

◆ fontFamily()

QString QtxFontEdit::fontFamily ( ) const

Get selected font family name.

Returns
current font family name
See also
setFontFamily()

References myCustomFams, myFamily, myMode, and Native.

◆ fonts()

QStringList QtxFontEdit::fonts ( ) const

Gets list of custom fonts.

Returns
list of families
See also
setFonts(), setMode()

References myCustomFams.

◆ fontScripting()

int QtxFontEdit::fontScripting ( ) const

Get selected font scripting.

Returns
current font scripting
See also
setFontScripting()

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

◆ fontSize()

int QtxFontEdit::fontSize ( ) const

Get selected font size.

Returns
current font size
See also
setFontSize()

References mySize.

◆ initialize()

void QtxFontEdit::initialize ( )
private

◆ mode()

int QtxFontEdit::mode ( ) const

Verifies whether widget works in Native or Custom mode.

Returns
Native or Custom mode
See also
setMode()

References myMode.

◆ onFontChanged

void QtxFontEdit::onFontChanged ( const QFont &  )
privateslot

Called when current font is changed.

Parameters
f(not used)

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

◆ onPreview

void QtxFontEdit::onPreview ( bool  )
privateslot

Called when "Preview" button is clicked.

Parameters
on(not used)

References currentFont(), and setCurrentFont().

◆ onPropertyChanged

void QtxFontEdit::onPropertyChanged ( )
privateslot

References changed(), and currentFont().

◆ setCurrentFont()

void QtxFontEdit::setCurrentFont ( const QFont &  fnt)

Set currently selected font.

Parameters
fntcurrent font
See also
currentFont()

References Bold, changed(), currentFont(), Italic, myB, myCustomFams, myI, mySize, myU, setFontFamily(), setFontScripting(), setFontSize(), Shadow, and Underline.

◆ setFeatures()

void QtxFontEdit::setFeatures ( const int  f)

Set font widget features.

Parameters
ffont widget features (ORed QtxFontEdit::Features flags)
See also
features()

References myFeatures, and updateState().

◆ setFontFamily()

void QtxFontEdit::setFontFamily ( const QString &  fam)

Set font family name.

Parameters
famnew font family name
See also
fontFamily()

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

◆ setFonts()

void QtxFontEdit::setFonts ( const QStringList &  fams)

Sets list of custom fonts. This method is intended for working in Custom mode.

Parameters
famslist of families
See also
fonts(), setMode()

References myCustomFams, and setSizes().

◆ setFontScripting()

void QtxFontEdit::setFontScripting ( const int  script)

Set font scripting.

Parameters
famnew font scripting
See also
fontScripting()

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

◆ setFontSize()

void QtxFontEdit::setFontSize ( const int  s)

Set font size.

Parameters
famnew font size
See also
fontSize()

References mySize.

◆ setMode()

void QtxFontEdit::setMode ( const int  mode)

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.

Parameters
modemode from QtxFontEdit::Mode enumeration
See also
mode()

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

◆ setSizes()

void QtxFontEdit::setSizes ( const QList< int > &  sizes = 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.

Parameters
sizeslist of sizes
See also
sizes(), setMode()

References mySize, and sizes().

◆ sizes()

QList< int > QtxFontEdit::sizes ( ) const

Gets list of custom fonts.

Returns
list of families
See also
setCustomFonts(), setMode()

References mySize.

◆ updateState()

void QtxFontEdit::updateState ( )
private

Member Data Documentation

◆ myB

QToolButton* QtxFontEdit::myB
private

◆ myCustomFams

QComboBox* QtxFontEdit::myCustomFams
private

◆ myFamily

QFontComboBox* QtxFontEdit::myFamily
private

◆ myFeatures

int QtxFontEdit::myFeatures
private

◆ myI

QToolButton * QtxFontEdit::myI
private

◆ myMode

int QtxFontEdit::myMode
private

◆ myPreview

QToolButton* QtxFontEdit::myPreview
private

◆ myS

QToolButton * QtxFontEdit::myS
private

◆ mySize

QtxComboBox* QtxFontEdit::mySize
private

◆ myU

QToolButton * QtxFontEdit::myU
private

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