digiKam Developer Documentation
Professional Photo Management with the Power of Open Source
Loading...
Searching...
No Matches
Digikam::DFontProperties Class Reference
+ Inheritance diagram for Digikam::DFontProperties:

Public Types

enum  DisplayFlag { NoDisplayFlags = 0 , FixedFontsOnly = 1 , DisplayFrame = 2 , ShowDifferences = 4 }
 
typedef QFlags< DisplayFlagDisplayFlags
 
enum  FontColumn { FamilyList = 0x01 , StyleList = 0x02 , SizeList = 0x04 }
 
enum  FontDiff {
  NoFontDiffFlags = 0 , FontDiffFamily = 1 , FontDiffStyle = 2 , FontDiffSize = 4 ,
  AllFontDiffs = FontDiffFamily | FontDiffStyle | FontDiffSize
}
 
typedef QFlags< FontDiffFontDiffFlags
 
enum  FontListCriteria { FixedWidthFonts = 0x01 , ScalableFonts = 0x02 , SmoothScalableFonts = 0x04 }
 The selection criteria for the font families shown in the dialog. More...
 

Signals

void fontSelected (const QFont &font)
 Emitted whenever the selected font changes.
 

Public Member Functions

 DFontProperties (QWidget *const parent=nullptr, const DisplayFlags &flags=DisplayFrame, const QStringList &fontList=QStringList(), int visibleListSize=8, Qt::CheckState *const sizeIsRelativeState=nullptr)
 Constructs a font picker widget.
 
 ~DFontProperties () override
 Destructs the font chooser.
 
QColor backgroundColor () const
 
QColor color () const
 
void enableColumn (int column, bool state)
 Enables or disable a font column in the chooser.
 
QFont font () const
 
FontDiffFlags fontDiffFlags () const
 
void makeColumnVisible (int column, bool state)
 Makes a font column in the chooser visible or invisible.
 
QString sampleText () const
 
void setBackgroundColor (const QColor &col)
 Sets the background color to use in the preview.
 
void setColor (const QColor &col)
 Sets the color to use in the preview.
 
void setFont (const QFont &font, bool onlyFixed=false)
 Sets the currently selected font in the chooser.
 
void setSampleBoxVisible (bool visible)
 Shows or hides the sample text box.
 
void setSampleText (const QString &text)
 Sets the sample text.
 
void setSizeIsRelative (Qt::CheckState relative)
 Sets the state of the checkbox indicating whether the font size is to be interpreted as relative size.
 
QSize sizeHint (void) const override
 Reimplemented for internal reasons.
 
Qt::CheckState sizeIsRelative () const
 

Static Public Member Functions

static void getFontList (QStringList &list, uint fontListCriteria)
 Creates a list of font strings.
 

Properties

QColor backgroundColor
 
QColor color
 
QFont font
 
QString sampleText
 
Qt::CheckState sizeIsRelative
 

Member Enumeration Documentation

◆ DisplayFlag

  • FixedFontsOnly only show fixed fonts, excluding proportional fonts
  • DisplayFrame show a visual frame around the chooser
  • ShowDifferences display the font differences interfaces

◆ FontColumn

  • FamilyList - Identifies the family (leftmost) list.
  • StyleList - Identifies the style (center) list.
  • SizeList - Identifies the size (rightmost) list.

◆ FontDiff

  • FontDiffFamily - Identifies a requested change in the font family.
  • FontDiffStyle - Identifies a requested change in the font style.
  • FontDiffSize - Identifies a requested change in the font size.

◆ FontListCriteria

  • FixedWidthFont when included only fixed-width fonts are returned. The fonts where the width of every character is equal.
  • ScalableFont when included only scalable fonts are returned; certain configurations allow bitmap fonts to remain unscaled and thus these fonts have limited number of sizes.
  • SmoothScalableFont when included only return smooth scalable fonts. this will return only non-bitmap fonts which are scalable to any size requested. Setting this option to true will mean the "scalable" flag is irrelevant.

Constructor & Destructor Documentation

◆ DFontProperties()

Digikam::DFontProperties::DFontProperties ( QWidget *const  parent = nullptr,
const DisplayFlags &  flags = DisplayFrame,
const QStringList &  fontList = QStringList(),
int  visibleListSize = 8,
Qt::CheckState *const  sizeIsRelativeState = nullptr 
)
explicit

It normally comes up with all font families present on the system; the getFont method below does allow some more fine-tuning of the selection of fonts that will be displayed in the dialog.

Parameters
parentThe parent widget.
flagsDefines how the font chooser is displayed.
See also
DisplayFlags
Parameters
fontListA list of fonts to display, in XLFD format.
visibleListSizeThe minimum number of visible entries in the fontlists.
sizeIsRelativeStateIf not zero the widget will show a checkbox where the user may choose whether the font size is to be interpreted as relative size. Initial state of this checkbox will be set according to *sizeIsRelativeState, user choice may be retrieved by calling sizeIsRelative().

Member Function Documentation

◆ backgroundColor()

QColor Digikam::DFontProperties::backgroundColor ( ) const
Returns
The background color currently used in the preview (default: the base color of the active colorgroup)

◆ color()

QColor Digikam::DFontProperties::color ( ) const
Returns
The color currently used in the preview (default: the text color of the active color group)

◆ enableColumn()

void Digikam::DFontProperties::enableColumn ( int  column,
bool  state 
)

Use this function if your application does not need or supports all font properties.

Parameters
columnSpecify the columns. An or'ed combination of FamilyList, StyleList and SizeList is possible.
stateIf false the columns are disabled.

◆ font()

QFont Digikam::DFontProperties::font ( ) const
Returns
The currently selected font in the chooser.

◆ fontDiffFlags()

DFontProperties::FontDiffFlags Digikam::DFontProperties::fontDiffFlags ( ) const
Returns
The bitmask corresponding to the attributes the user wishes to change.

◆ getFontList()

void Digikam::DFontProperties::getFontList ( QStringList &  list,
uint  fontListCriteria 
)
static
Parameters
listThe list is returned here.
fontListCriteriashould contain all the restrictions for font selection as OR-ed values
See also
DFontProperties::FontListCriteria for the individual values

◆ makeColumnVisible()

void Digikam::DFontProperties::makeColumnVisible ( int  column,
bool  state 
)

Use this function if your application does not need to show all font properties.

Parameters
columnSpecify the columns. An or'ed combination of FamilyList, StyleList and SizeList is possible.
stateIf false the columns are made invisible.

◆ sampleText()

QString Digikam::DFontProperties::sampleText ( ) const
Returns
The current text in the sample text input area.

◆ setFont()

void Digikam::DFontProperties::setFont ( const QFont &  font,
bool  onlyFixed = false 
)
Parameters
fontThe font to select.
onlyFixedReadjust the font list to display only fixed width fonts if true, or vice-versa.

◆ setSampleBoxVisible()

void Digikam::DFontProperties::setSampleBoxVisible ( bool  visible)
Parameters
visibleSet it to true to show the box, to false to hide it.

◆ setSampleText()

void Digikam::DFontProperties::setSampleText ( const QString &  text)

Normally you should not change this text, but it can be better to do this if the default text is too large for the edit area when using the default font of your application.

Parameters
textThe new sample text. The current will be removed.

◆ setSizeIsRelative()

void Digikam::DFontProperties::setSizeIsRelative ( Qt::CheckState  relative)
Note
If parameter sizeIsRelative was not set in the constructor of the widget this setting will be ignored.

◆ sizeIsRelative()

Qt::CheckState Digikam::DFontProperties::sizeIsRelative ( ) const
Returns
Whether the font size is to be interpreted as relative size (default: QButton:Off)