⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qwebsettings.cpp

📁 linux下开源浏览器WebKit的源码,市面上的很多商用浏览器都是移植自WebKit
💻 CPP
📖 第 1 页 / 共 2 页
字号:
/*!    Resets the font size for \a type to the size specified in the global    settings object.    This function has no effect on the global QWebSettings instance.*/void QWebSettings::resetFontSize(FontSize type){    if (d->settings) {        d->fontSizes.remove(type);        d->apply();    }}/*!    Specifies the location of a user stylesheet to load with every web page.    The \a location can be a URL or a path on the local filesystem.    \sa userStyleSheetUrl()*/void QWebSettings::setUserStyleSheetUrl(const QUrl &location){    d->userStyleSheetLocation = location;    d->apply();}/*!    Returns the location of the user stylesheet.    \sa setUserStyleSheetUrl()*/QUrl QWebSettings::userStyleSheetUrl() const{    return d->userStyleSheetLocation;}/*!    Sets the path of the icon database to \a path. The icon database is used    to store "favicons" associated with web sites.    \a path must point to an existing directory where the icons are stored.    Setting an empty path disables the icon database.*/void QWebSettings::setIconDatabasePath(const QString &path){    WebCore::iconDatabase()->delayDatabaseCleanup();    if (!path.isEmpty()) {        WebCore::iconDatabase()->setEnabled(true);        QFileInfo info(path);        if (info.isDir() && info.isWritable())            WebCore::iconDatabase()->open(path);    } else {        WebCore::iconDatabase()->setEnabled(false);        WebCore::iconDatabase()->close();    }}/*!    Returns the path of the icon database or an empty string if the icon    database is disabled.    \sa setIconDatabasePath(), clearIconDatabase()*/QString QWebSettings::iconDatabasePath(){    if (WebCore::iconDatabase()->isEnabled() && WebCore::iconDatabase()->isOpen()) {        return WebCore::iconDatabase()->databasePath();    } else {        return QString();    }}/*!    Clears the icon database.*/void QWebSettings::clearIconDatabase(){    if (WebCore::iconDatabase()->isEnabled() && WebCore::iconDatabase()->isOpen())        WebCore::iconDatabase()->removeAllIcons();}/*!    Returns the web site's icon for \a url.    If the web site does not specify an icon, or the icon is not in the    database, a null QIcon is returned.    \note The returned icon's size is arbitrary.    \sa setIconDatabasePath()*/QIcon QWebSettings::iconForUrl(const QUrl &url){    WebCore::Image* image = WebCore::iconDatabase()->iconForPageURL(WebCore::KURL(url).string(),                                WebCore::IntSize(16, 16));    if (!image) {        return QPixmap();    }    QPixmap *icon = image->nativeImageForCurrentFrame();    if (!icon) {        return QPixmap();    }    return *icon;}/*!    Sets \a graphic to be drawn when QtWebKit needs to draw an image of the    given \a type.    For example, when an image cannot be loaded the pixmap specified by    \l{QWebSettings::WebGraphic}{MissingImageGraphic} is drawn instead.    \sa webGraphic()*/void QWebSettings::setWebGraphic(WebGraphic type, const QPixmap &graphic){    WebGraphicHash *h = graphics();    if (graphic.isNull())        h->remove(type);    else        h->insert(type, graphic);}/*!    Returns a previously set pixmap used to draw replacement graphics of the    specified \a type.    For example, when an image cannot be loaded the pixmap specified by    \l{QWebSettings::WebGraphic}{MissingImageGraphic} is drawn instead.    \sa setWebGraphic()*/QPixmap QWebSettings::webGraphic(WebGraphic type){    return graphics()->value(type);}/*!    Sets the maximum number of pages to hold in the memory cache to \a pages.*/void QWebSettings::setMaximumPagesInCache(int pages){    WebCore::pageCache()->setCapacity(qMax(0, pages));}/*!    Returns the maximum number of web pages that are kept in the memory cache.*/int QWebSettings::maximumPagesInCache(){    return WebCore::pageCache()->capacity();}/*!   Specifies the capacities for the memory cache for dead objects such as   stylesheets or scripts.   The \a cacheMinDeadCapacity specifies the \e minimum number of bytes that   dead objects should consume when the cache is under pressure.      \a cacheMaxDead is the \e maximum number of bytes that dead objects should   consume when the cache is \bold not under pressure.   \a totalCapacity specifies the \e maximum number of bytes that the cache   should consume \bold overall.   The cache is enabled by default. Calling setObjectCacheCapacities(0, 0, 0)   will disable the cache. Calling it with one non-zero enables it again.*/void QWebSettings::setObjectCacheCapacities(int cacheMinDeadCapacity, int cacheMaxDead, int totalCapacity){    bool disableCache = cacheMinDeadCapacity == 0 && cacheMaxDead == 0 && totalCapacity == 0;    WebCore::cache()->setDisabled(disableCache);    WebCore::cache()->setCapacities(qMax(0, cacheMinDeadCapacity),                                    qMax(0, cacheMaxDead),                                    qMax(0, totalCapacity));}/*!    Sets the actual font family to \a family for the specified generic family,    \a which.*/void QWebSettings::setFontFamily(FontFamily which, const QString &family){    d->fontFamilies.insert(which, family);    d->apply();}/*!    Returns the actual font family for the specified generic font family,    \a which.*/QString QWebSettings::fontFamily(FontFamily which) const{    QString defaultValue;    if (d->settings) {        QWebSettingsPrivate *global = QWebSettings::globalSettings()->d;        defaultValue = global->fontFamilies.value(which);    }    return d->fontFamilies.value(which, defaultValue);}/*!    Resets the actual font family to the default font family, specified by    \a which.    This function has no effect on the global QWebSettings instance.*/void QWebSettings::resetFontFamily(FontFamily which){    if (d->settings) {        d->fontFamilies.remove(which);        d->apply();    }}/*!    \fn void QWebSettings::setAttribute(WebAttribute attribute, bool on)        Enables or disables the specified \a attribute feature depending on the    value of \a on.*/void QWebSettings::setAttribute(WebAttribute attr, bool on){    d->attributes.insert(attr, on);    d->apply();}/*!    \fn bool QWebSettings::testAttribute(WebAttribute attribute) const    Returns true if \a attribute is enabled; otherwise returns false.*/bool QWebSettings::testAttribute(WebAttribute attr) const{    bool defaultValue = false;    if (d->settings) {        QWebSettingsPrivate *global = QWebSettings::globalSettings()->d;        defaultValue = global->attributes.value(attr);    }    return d->attributes.value(attr, defaultValue);}/*!    \fn void QWebSettings::resetAttribute(WebAttribute attribute)    Resets the setting of \a attribute.    This function has no effect on the global QWebSettings instance.    \sa globalSettings()*/void QWebSettings::resetAttribute(WebAttribute attr){    if (d->settings) {        d->attributes.remove(attr);        d->apply();    }}/*!    \since 4.5    Sets the path for HTML5 offline storage to \a path.    \a path must point to an existing directory where the databases are stored.    Setting an empty path disables the feature.    \sa offlineStoragePath()*/void QWebSettings::setOfflineStoragePath(const QString& path){#if ENABLE(DATABASE)    WebCore::DatabaseTracker::tracker().setDatabaseDirectoryPath(path);#endif}/*!    \since 4.5    Returns the path of the HTML5 offline storage or an empty string if the    feature is disabled.    \sa setOfflineStoragePath()*/QString QWebSettings::offlineStoragePath(){#if ENABLE(DATABASE)    return WebCore::DatabaseTracker::tracker().databaseDirectoryPath();#else    return QString();#endif}/*!    \since 4.5    Sets the value of the default quota for new offline storage databases    to \a maximumSize.*/void QWebSettings::setOfflineStorageDefaultQuota(qint64 maximumSize){    QWebSettings::globalSettings()->d->offlineStorageDefaultQuota = maximumSize;}/*!    \since 4.5    Returns the value of the default quota for new offline storage databases.*/qint64 QWebSettings::offlineStorageDefaultQuota(){    return QWebSettings::globalSettings()->d->offlineStorageDefaultQuota;}/*    \internal    \relates QWebSettings        Sets the path for HTML5 offline web application cache storage to \a path.    \a path must point to an existing directory where the cache is stored.    Setting an empty path disables the feature.    \sa offlineWebApplicationCachePath()*/void QWEBKIT_EXPORT qt_websettings_setOfflineWebApplicationCachePath(const QString& path){#if ENABLE(OFFLINE_WEB_APPLICATIONS)    WebCore::cacheStorage().setCacheDirectory(path);#endif}/*    \internal    \relates QWebSettings        Returns the path of the HTML5 offline web application cache storage    or an empty string if the feature is disabled.    \sa setOfflineWebApplicationCachePath()*/QString QWEBKIT_EXPORT qt_websettings_offlineWebApplicationCachePath(){#if ENABLE(OFFLINE_WEB_APPLICATIONS)    return WebCore::cacheStorage().cacheDirectory();#else    return QString();#endif}/*    \since 4.5    \relates QWebSettings    Sets the path for HTML5 local storage databases to \a path.    \a path must point to an existing directory where the cache is stored.    Setting an empty path disables the feature.    \sa localStorageDatabasePath()*/void QWEBKIT_EXPORT qt_websettings_setLocalStorageDatabasePath(QWebSettings* settings, const QString& path){    QWebSettingsPrivate *d = settings->handle();    d->localStorageDatabasePath = path;    d->apply();}/*    \since 4.5    \relates QWebSettings    Returns the path for HTML5 local storage databases    or an empty string if the feature is disabled.    \sa setLocalStorageDatabasePath()*/QString QWEBKIT_EXPORT qt_websettings_localStorageDatabasePath(QWebSettings* settings){    return settings->handle()->localStorageDatabasePath;}/*!    \fn QWebSettingsPrivate* QWebSettings::handle() const    \internal*/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -