Logo Search packages:      
Sourcecode: qt4-x11 version File versions  Download package

QFont QApplication::font ( const QWidget widget  )  [static]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Returns the default font for the widget.

See also:
fontMetrics(), QWidget::setFont()

Definition at line 1651 of file qapplication.cpp.

References QHash< Key, T >::constBegin(), QHash< Key, T >::constEnd(), QHash< Key, T >::constFind(), font(), QObject::inherits(), QHash< Key, T >::key(), QHash< Key, T >::size(), and QHash< Key, T >::value().

{
    FontHash *hash = app_fonts();
    if (widget && hash  && hash->size()) {
        QHash<QByteArray, QFont>::ConstIterator it =
                hash->constFind(widget->metaObject()->className());
        if (it != hash->constEnd())
            return it.value();
        for (it = hash->constBegin(); it != hash->constEnd(); ++it) {
            if (widget->inherits(it.key()))
                return it.value();
        }
    }
    return font();
}


Generated by  Doxygen 1.6.0   Back to index