|
Wireshark 5.1.0
The Wireshark network protocol analyzer
|
Font selector with family, style and size lists, effects and a sample. More...
#include <font_selection_widget.h>
Classes | |
| struct | Selection |
| The edited value: family and point size. More... | |
Public Types | |
| enum class | FamilyFilter { AllFamilies , FixedPitchOnly } |
| Which families the family list offers. More... | |
| enum class | FontClass { Regular , Monospace } |
| What an empty family resolves to. More... | |
| enum | Feature { StyleFeature = 0x1 , EffectsFeature = 0x2 , FamilyFilterFeature = 0x4 } |
| Optional parts of the selector. More... | |
Signals | |
| void | changed () |
| Emitted when the user changes family, style, size or an effect. | |
Public Member Functions | |
| FontSelectionWidget (QWidget *parent=nullptr) | |
| Construct a FontSelectionWidget. | |
| ~FontSelectionWidget () | |
| Destroy the widget and its UI form. | |
| void | setFamilyFilter (FamilyFilter filter) |
| Choose which families are offered. The default is AllFamilies. | |
| FamilyFilter | familyFilter () const |
| Return the active family filter. | |
| void | setFontClass (FontClass fontClass) |
| Choose what an empty family resolves to. The default is Regular. | |
| FontClass | fontClass () const |
| Return the font class. | |
| void | setFeatures (Features features) |
| Show or hide the optional parts. The default is all features. | |
| Features | features () const |
| Return the shown optional parts. | |
| void | setDefaultAllowed (bool allowed) |
| Allow the "no explicit font" state. | |
| bool | defaultAllowed () const |
| Return whether the default state is allowed. | |
| void | setSelection (const Selection &sel) |
| Set the value from a Selection without emitting changed(). | |
| Selection | selection () const |
| Return the current Selection. | |
| void | setSelectedFont (const QFont &font) |
| Set the value from a QFont without emitting changed(). | |
| QFont | selectedFont () const |
| Return the edited font. | |
| QFont | resolvedFont () const |
| Return the font the sample is drawn with. | |
| void | setSampleText (const QString &text) |
| Replace the sample text. | |
Protected Member Functions | |
| void | showEvent (QShowEvent *event) override |
| Fill the lists on first show and refresh the sample. | |
Font selector with family, style and size lists, effects and a sample.
The family list is built lazily, once per process, on the first show of any selector; until then it holds only the current family and the style and size lists stay empty. Setters never emit changed(); only user edits do. Every field (family, style, size, strikeout, underline) the user did not edit is kept exactly as set, so opening and closing a dialog does not rewrite a stored font.
|
strong |
|
strong |
|
explicit |
Construct a FontSelectionWidget.
| parent | The parent widget; may be nullptr. |
| QFont FontSelectionWidget::resolvedFont | ( | ) | const |
Return the font the sample is drawn with.
For FontClass::Monospace this is the font FontManager applies for the monospace font preference, so it may differ from selectedFont() when the family is not installed.
| QFont FontSelectionWidget::selectedFont | ( | ) | const |
Return the edited font.
This is the font given to setSelectedFont() (or built by setSelection()), with family, style, size, strikeout and underline replaced only once the user edited them.
| void FontSelectionWidget::setDefaultAllowed | ( | bool | allowed | ) |
Allow the "no explicit font" state.
When allowed, the family list gets a "(Platform default)" entry and the size spin box shows "Default" at its minimum. Off by default.
| allowed | true to allow the default state. |
| void FontSelectionWidget::setFamilyFilter | ( | FamilyFilter | filter | ) |
Choose which families are offered. The default is AllFamilies.
Also sets the "Show only monospaced fonts" checkbox. Only the list changes; the selected family stays listed and changed() is not emitted.
| filter | The family filter. |
| void FontSelectionWidget::setFeatures | ( | Features | features | ) |
Show or hide the optional parts. The default is all features.
| features | The parts to show. |
| void FontSelectionWidget::setFontClass | ( | FontClass | fontClass | ) |
Choose what an empty family resolves to. The default is Regular.
| fontClass | The font class. |
| void FontSelectionWidget::setSampleText | ( | const QString & | text | ) |
Replace the sample text.
| text | The sample text. |
| void FontSelectionWidget::setSelectedFont | ( | const QFont & | font | ) |
Set the value from a QFont without emitting changed().
All attributes of font are kept by selectedFont() until the user edits the field they belong to.
| font | The font to show. |
| void FontSelectionWidget::setSelection | ( | const Selection & | sel | ) |