LeechCraft  0.6.70-3565-g2d86529
Modular cross-platform feature rich live environment.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
LeechCraft::Util::WkFontsWidget Class Reference

A settings widget for configuring WebKit fonts. More...

#include "wkfontswidget.h"

+ Inheritance diagram for LeechCraft::Util::WkFontsWidget:
+ Collaboration diagram for LeechCraft::Util::WkFontsWidget:

Public Slots

void accept ()
 
void reject ()
 

Signals

void fontChanged (QWebSettings::FontFamily family, const QFont &font)
 Notifies the font for the given family has been changed. More...
 

Public Member Functions

 WkFontsWidget (Util::BaseSettingsManager *bsm, QWidget *parent=nullptr)
 Creates the fonts settings widget. More...
 
void RegisterSettable (IWkFontsSettable *settable)
 Registers an object to be automatically updated whenever font settings change. More...
 

Detailed Description

A settings widget for configuring WebKit fonts.

Provides a common widget for configuring QtWebKit fonts for standard WebKit font types.

This widget works through LeechCraft's XML Settings Dialog system, storing the configuration in an BaseSettingsManager instance.

This widget also supports automatically updating font settings for objects implementing the IWkFontsSettable interface if the user changes them.

Typical usage includes creating an item of type customwidget in the XML file describing the settings and then setting an instance of the WkFontsWidget as the widget for that item. On the C++ side this looks like:

FontsWidget_ = new Util::WkFontsWidget { &XmlSettingsManager::Instance () };
XmlSettingsDialog_->SetCustomWidget ("FontsSelector", FontsWidget_);

assuming the Util::BaseSettingsManager is provided by a singleton XmlSettingsManager class, and XmlSettingsDialog_ is an instance of Util::XmlSettingsDialog.

The code above also stores the WkFontsWidget as a class variable, which may be a good idea if one wishes to use the settings autoupdate feature. For example, assuming a class ChatTab properly implements the IWkFontsSettable interface:

const auto tab = new ChatTab {};
FontsWidget_->RegisterSettable (tab);
See Also
IWkFontsSettable

Definition at line 89 of file wkfontswidget.h.

Constructor & Destructor Documentation

LeechCraft::Util::WkFontsWidget::WkFontsWidget ( Util::BaseSettingsManager *  bsm,
QWidget *  parent = nullptr 
)

Creates the fonts settings widget.

Parameters
[in]bsmThe settings manager to use for storing settings.
[in]parentThe parent widget for this widget.

Definition at line 42 of file wkfontswidget.cpp.

Member Function Documentation

void LeechCraft::Util::WkFontsWidget::accept ( )
slot

Definition at line 141 of file wkfontswidget.cpp.

References fontChanged(), and LeechCraft::Util::Stlize().

+ Here is the call graph for this function:

void LeechCraft::Util::WkFontsWidget::fontChanged ( QWebSettings::FontFamily  family,
const QFont &  font 
)
signal

Notifies the font for the given family has been changed.

Parameters
[out]familyThe font family for which the font has been changed.
[out]fontThe new fonr for the given family.

Referenced by accept().

+ Here is the caller graph for this function:

void LeechCraft::Util::WkFontsWidget::RegisterSettable ( IWkFontsSettable settable)

Registers an object to be automatically updated whenever font settings change.

Parameters
[in]settableAn object implementing IWkFontsSettable.
See Also
IWkFontsSettable

Definition at line 75 of file wkfontswidget.cpp.

References LeechCraft::Util::Stlize().

+ Here is the call graph for this function:

void LeechCraft::Util::WkFontsWidget::reject ( )
slot

Definition at line 155 of file wkfontswidget.cpp.


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