LeechCraft
0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
|
A settings widget for configuring WebKit fonts. More...
#include "wkfontswidget.h"
Public Slots | |
void | accept () |
void | reject () |
Signals | |
void | fontChanged (IWkFontsSettable::FontFamily family, const QFont &font) |
Notifies the font for the given family has been changed. More... | |
void | sizeChanged (IWkFontsSettable::FontSize type, int size) |
Notifies the size for the given font type has been changed. More... | |
void | sizeMultiplierChanged (qreal factor) |
Notifies the text zoom factor 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... | |
void | SetSize (IWkFontsSettable::FontSize type, int size) |
Sets the size for the given font size type. More... | |
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:
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:
Definition at line 68 of file wkfontswidget.h.
LC::Util::WkFontsWidget::WkFontsWidget | ( | Util::BaseSettingsManager * | bsm, |
QWidget * | parent = nullptr |
||
) |
Creates the fonts settings widget.
[in] | bsm | The settings manager to use for storing settings. |
[in] | parent | The parent widget for this widget. |
Definition at line 34 of file wkfontswidget.cpp.
|
slot |
Definition at line 160 of file wkfontswidget.cpp.
|
signal |
Notifies the font for the given family has been changed.
[out] | family | The font family for which the font has been changed. |
[out] | font | The new font for the given family. |
void LC::Util::WkFontsWidget::RegisterSettable | ( | IWkFontsSettable * | settable | ) |
Registers an object to be automatically updated whenever font settings change.
[in] | settable | An object implementing IWkFontsSettable. |
Definition at line 78 of file wkfontswidget.cpp.
|
slot |
Definition at line 176 of file wkfontswidget.cpp.
void LC::Util::WkFontsWidget::SetSize | ( | IWkFontsSettable::FontSize | type, |
int | size | ||
) |
Sets the size for the given font size type.
The new size is stored in settings and applied to all settables registered with this widget via RegisterSettable().
type | The type of font size to change. |
size | The new size. |
Definition at line 92 of file wkfontswidget.cpp.
|
signal |
Notifies the size for the given font type has been changed.
[out] | type | The font type for which the size has been changed. |
[out] | size | The new font size for the given font type. |
|
signal |
Notifies the text zoom factor has been changed.
[out] | factor | The new font size multiplier. |