KCountryFlagEmojiIconEngine

Search for usage in LXR

KCountryFlagEmojiIconEngine Class Reference

#include <kcountryflagemojiiconengine.h>

Inheritance diagram for KCountryFlagEmojiIconEngine:

Public Member Functions

 KCountryFlagEmojiIconEngine (const QString &regionOrCountry)
 
QIconEngineclone () const override
 
bool isNull () override
 
QString key () const override
 
void paint (QPainter *painter, const QRect &rect, QIcon::Mode mode, QIcon::State state) override
 
QPixmap pixmap (const QSize &size, QIcon::Mode mode, QIcon::State state) override
 
QPixmap scaledPixmap (const QSize &size, QIcon::Mode mode, QIcon::State state, qreal scale) override
 
- Public Member Functions inherited from QIconEngine
virtual QSize actualSize (const QSize &size, QIcon::Mode mode, QIcon::State state)
 
virtual void addFile (const QString &fileName, const QSize &size, QIcon::Mode mode, QIcon::State state)
 
virtual void addPixmap (const QPixmap &pixmap, QIcon::Mode mode, QIcon::State state)
 
virtual QList< QSizeavailableSizes (QIcon::Mode mode, QIcon::State state)
 
virtual QString iconName ()
 
virtual bool read (QDataStream &in)
 
virtual void virtual_hook (int id, void *data)
 
virtual bool write (QDataStream &out) const const
 

Static Public Member Functions

static void setGlobalDefaultFont (const QFont &font)
 

Additional Inherited Members

- Public Types inherited from QIconEngine
enum  IconEngineHook
 
- Public Attributes inherited from QIconEngine
 IsNullHook
 
 ScaledPixmapHook
 

Detailed Description

Provides emoji flags as icons This is a special icon engine that internally paints flags using emoji fonts.

It provides access to country and region flags from the system emoji font.

auto l = new QLabel;
l->setMinimumSize(512, 512);
l->setPixmap(QIcon(new KCountryFlagEmojiIconEngine("AT")).pixmap(512, 512));
KCountryFlagEmojiIconEngine(const QString &regionOrCountry)
Construct a new KCountryFlagEmojiIconEngine object Please note that regional flag support can be spot...
void setMinimumSize(const QSize &)
Since
6.0

Definition at line 24 of file kcountryflagemojiiconengine.h.

Constructor & Destructor Documentation

◆ KCountryFlagEmojiIconEngine()

KCountryFlagEmojiIconEngine::KCountryFlagEmojiIconEngine ( const QString & regionOrCountry)
explicit

Construct a new KCountryFlagEmojiIconEngine object Please note that regional flag support can be spotty in emoji fonts.

Parameters
regionOrCountryeither a ISO 3166-1 alpha-2 country code or a ISO 3166-2 region code (e.g. AT for Austria or GB-SCT for Scotland)

Definition at line 91 of file kcountryflagemojiiconengine.cpp.

Member Function Documentation

◆ clone()

QIconEngine * KCountryFlagEmojiIconEngine::clone ( ) const
overridevirtual

Implements QIconEngine.

Definition at line 98 of file kcountryflagemojiiconengine.cpp.

◆ isNull()

bool KCountryFlagEmojiIconEngine::isNull ( )
overridevirtual

Check whether the internal emoji unicode sequence is null This does not necessarily mean that the pixmap output will be a valid flag - that entirely depends on the system's precise font configuration.

Returns
true when the construction of the emoji string failed
false when the construction of the emoji string succeeded

Reimplemented from QIconEngine.

Definition at line 159 of file kcountryflagemojiiconengine.cpp.

◆ key()

QString KCountryFlagEmojiIconEngine::key ( ) const
overridevirtual

Reimplemented from QIconEngine.

Definition at line 103 of file kcountryflagemojiiconengine.cpp.

◆ paint()

void KCountryFlagEmojiIconEngine::paint ( QPainter * painter,
const QRect & rect,
QIcon::Mode mode,
QIcon::State state )
overridevirtual

Implements QIconEngine.

Definition at line 108 of file kcountryflagemojiiconengine.cpp.

◆ pixmap()

QPixmap KCountryFlagEmojiIconEngine::pixmap ( const QSize & size,
QIcon::Mode mode,
QIcon::State state )
overridevirtual

Reimplemented from QIconEngine.

Definition at line 142 of file kcountryflagemojiiconengine.cpp.

◆ scaledPixmap()

QPixmap KCountryFlagEmojiIconEngine::scaledPixmap ( const QSize & size,
QIcon::Mode mode,
QIcon::State state,
qreal scale )
overridevirtual

Reimplemented from QIconEngine.

Definition at line 147 of file kcountryflagemojiiconengine.cpp.

◆ setGlobalDefaultFont()

void KCountryFlagEmojiIconEngine::setGlobalDefaultFont ( const QFont & font)
static

Set the Global Default Font object This is primarily useful for platform themes that wish to force a specific font being used.

By default the "emoji" font family will be used. Forcing a specific font and making sure it is available as runtime requirement is the most reliable way to ensure that flag support is working regardless of system configuration.

Parameters
fontthe default font to use

Definition at line 164 of file kcountryflagemojiiconengine.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:02:23 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.