Qt 4.8
Public Types | Signals | Public Functions | Private Slots | Properties | List of all members
QDeclarativeFontLoader Class Reference

#include <qdeclarativefontloader_p.h>

Inheritance diagram for QDeclarativeFontLoader:
QObject

Public Types

enum  Status { Null = 0, Ready, Loading, Error }
 

Signals

void nameChanged ()
 
void sourceChanged ()
 
void statusChanged ()
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More...
 

Public Functions

QString name () const
 
 QDeclarativeFontLoader (QObject *parent=0)
 
void setName (const QString &name)
 
void setSource (const QUrl &url)
 
QUrl source () const
 
Status status () const
 
 ~QDeclarativeFontLoader ()
 
- Public Functions inherited from QObject
bool blockSignals (bool b)
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More...
 
const QObjectListchildren () const
 Returns a list of child objects. More...
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectInfo ()
 Dumps information about signal connections, etc. More...
 
void dumpObjectTree ()
 Dumps a tree of children to the debug output. More...
 
QList< QByteArraydynamicPropertyNames () const
 Returns the names of all properties that were dynamically added to the object using setProperty(). More...
 
virtual bool event (QEvent *)
 This virtual function receives events to an object and should return true if the event e was recognized and processed. More...
 
virtual bool eventFilter (QObject *, QEvent *)
 Filters events if this object has been installed as an event filter for the watched object. More...
 
template<typename T >
findChild (const QString &aName=QString()) const
 Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More...
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More...
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More...
 
void installEventFilter (QObject *)
 Installs an event filter filterObj on this object. More...
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false. More...
 
void killTimer (int id)
 Kills the timer with timer identifier, id. More...
 
virtual const QMetaObjectmetaObject () const
 Returns a pointer to the meta-object of this object. More...
 
void moveToThread (QThread *thread)
 Changes the thread affinity for this object and its children. More...
 
QString objectName () const
 
QObjectparent () const
 Returns a pointer to the parent object. More...
 
QVariant property (const char *name) const
 Returns the value of the object's name property. More...
 
Q_INVOKABLE QObject (QObject *parent=0)
 Constructs an object with parent object parent. More...
 
void removeEventFilter (QObject *)
 Removes an event filter object obj from this object. More...
 
void setObjectName (const QString &name)
 
void setParent (QObject *)
 Makes the object a child of parent. More...
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value. More...
 
void setUserData (uint id, QObjectUserData *data)
 
bool signalsBlocked () const
 Returns true if signals are blocked; otherwise returns false. More...
 
int startTimer (int interval)
 Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More...
 
QThreadthread () const
 Returns the thread in which the object lives. More...
 
QObjectUserDatauserData (uint id) const
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects. More...
 

Private Slots

void updateFontInfo (const QString &, QDeclarativeFontLoader::Status)
 

Properties

QString name
 
QUrl source
 
Status status
 

Additional Inherited Members

- Public Slots inherited from QObject
void deleteLater ()
 Schedules this object for deletion. More...
 
- Static Public Functions inherited from QObject
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More...
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 Disconnects signal in object sender from method in object receiver. More...
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 
static QString tr (const char *sourceText, const char *comment=0, int n=-1)
 
static QString trUtf8 (const char *sourceText, const char *comment=0, int n=-1)
 
- Static Public Variables inherited from QObject
static const QMetaObject staticMetaObject
 This variable stores the meta-object for the class. More...
 
- Protected Functions inherited from QObject
virtual void childEvent (QChildEvent *)
 This event handler can be reimplemented in a subclass to receive child events. More...
 
virtual void connectNotify (const char *signal)
 This virtual function is called when something has been connected to signal in this object. More...
 
virtual void customEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive custom events. More...
 
virtual void disconnectNotify (const char *signal)
 This virtual function is called when something has been disconnected from signal in this object. More...
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal. More...
 
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More...
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *)
 This event handler can be reimplemented in a subclass to receive timer events for the object. More...
 
- Protected Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

Definition at line 57 of file qdeclarativefontloader_p.h.

Enumerations

◆ Status

Constructors and Destructors

◆ QDeclarativeFontLoader()

QDeclarativeFontLoader::QDeclarativeFontLoader ( QObject parent = 0)

Definition at line 175 of file qdeclarativefontloader.cpp.

176  : QObject(*(new QDeclarativeFontLoaderPrivate), parent)
177 {
178 }
Q_INVOKABLE QObject(QObject *parent=0)
Constructs an object with parent object parent.
Definition: qobject.cpp:753

◆ ~QDeclarativeFontLoader()

QDeclarativeFontLoader::~QDeclarativeFontLoader ( )

Definition at line 180 of file qdeclarativefontloader.cpp.

181 {
182 }

Functions

◆ name()

QString QDeclarativeFontLoader::name ( ) const

Referenced by setName(), and updateFontInfo().

◆ nameChanged

void QDeclarativeFontLoader::nameChanged ( )
signal

Referenced by setName(), and updateFontInfo().

◆ setName()

void QDeclarativeFontLoader::setName ( const QString name)

Definition at line 294 of file qdeclarativefontloader.cpp.

295 {
297  if (d->name == name)
298  return;
299  d->name = name;
300  emit nameChanged();
301  d->status = Ready;
303 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
#define emit
Definition: qobjectdefs.h:76
QString name() const

◆ setSource()

void QDeclarativeFontLoader::setSource ( const QUrl url)

Definition at line 197 of file qdeclarativefontloader.cpp.

198 {
200  if (url == d->url)
201  return;
202  d->url = qmlContext(this)->resolvedUrl(url);
204 
205 #ifndef QT_NO_LOCALFILE_OPTIMIZED_QML
207  if (!localFile.isEmpty()) {
208  if (!d->fonts.contains(d->url)) {
209  int id = QFontDatabase::addApplicationFont(localFile);
210  if (id != -1) {
213  d->fonts[d->url] = fo;
214  } else {
216  }
217  } else {
219  }
220  } else
221 #endif
222  {
223  if (!d->fonts.contains(d->url)) {
225  d->fonts[d->url] = fo;
226  fo->download(d->url, qmlEngine(this)->networkAccessManager());
227  d->status = Loading;
231  } else {
232  QDeclarativeFontObject *fo = d->fonts[d->url];
233  if (fo->id == -1) {
234  d->status = Loading;
238  }
239  else
241  }
242  }
243 }
static QString urlToLocalFileOrQrc(const QUrl &url)
double d
Definition: qnumeric_p.h:62
static int addApplicationFont(const QString &fileName)
Loads the font from the file specified by fileName and makes it available to the application.
#define at(className, varName)
#define SLOT(a)
Definition: qobjectdefs.h:226
QUrl resolvedUrl(const QUrl &)
Resolves the URL src relative to the URL of the containing component.
The QString class provides a Unicode character string.
Definition: qstring.h:83
Q_DECLARATIVE_EXPORT QDeclarativeContext * qmlContext(const QObject *)
#define Q_D(Class)
Definition: qglobal.h:2482
void updateFontInfo(const QString &, QDeclarativeFontLoader::Status)
void download(const QUrl &url, QNetworkAccessManager *manager)
#define SIGNAL(a)
Definition: qobjectdefs.h:227
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
Definition: qobject.cpp:2580
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
#define emit
Definition: qobjectdefs.h:76
Q_DECLARATIVE_EXPORT QDeclarativeEngine * qmlEngine(const QObject *)
static QStringList applicationFontFamilies(int id)
Returns a list of font families for the given application font identified by id.

◆ source()

QUrl QDeclarativeFontLoader::source ( ) const

Referenced by ~QDeclarativeFontLoader().

◆ sourceChanged

void QDeclarativeFontLoader::sourceChanged ( )
signal

Referenced by setSource().

◆ status()

Status QDeclarativeFontLoader::status ( ) const

Referenced by setName(), and updateFontInfo().

◆ statusChanged

void QDeclarativeFontLoader::statusChanged ( )
signal

Referenced by setName(), setSource(), and updateFontInfo().

◆ updateFontInfo

void QDeclarativeFontLoader::updateFontInfo ( const QString name,
QDeclarativeFontLoader::Status  status 
)
privateslot

Definition at line 245 of file qdeclarativefontloader.cpp.

Referenced by setSource().

246 {
248 
249  if (name != d->name) {
250  d->name = name;
251  emit nameChanged();
252  }
253  if (status != d->status) {
254  if (status == Error)
255  qmlInfo(this) << "Cannot load font: \"" << d->url.toString() << "\"";
256  d->status = status;
258  }
259 }
double d
Definition: qnumeric_p.h:62
#define Q_D(Class)
Definition: qglobal.h:2482
Status status() const
#define emit
Definition: qobjectdefs.h:76
QString name() const
QDeclarativeInfo qmlInfo(const QObject *me)

Properties

◆ name

QString QDeclarativeFontLoader::name
private

Definition at line 64 of file qdeclarativefontloader_p.h.

◆ source

QUrl QDeclarativeFontLoader::source
private

Definition at line 63 of file qdeclarativefontloader_p.h.

◆ status

QDeclarativeFontLoader::Status QDeclarativeFontLoader::status
private

Definition at line 65 of file qdeclarativefontloader_p.h.


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