com.trolltech.qt.webkit
Class QWebSettings

java.lang.Object
  extended by com.trolltech.qt.internal.QSignalEmitterInternal
      extended by com.trolltech.qt.QSignalEmitter
          extended by com.trolltech.qt.QtJambiObject
              extended by com.trolltech.qt.webkit.QWebSettings
All Implemented Interfaces:
QtJambiInterface

public final class QWebSettings
extends QtJambiObject

The QWebSettings class provides an object to store the settings used by QWebPage and QWebFrame. Each QWebPage object has its own QWebSettings object, which configures the settings for that page. If a setting is not configured, then it is looked up in the global settings object, which can be accessed using QWebSettings::globalSettings().

QWebSettings allows configuring font properties such as font size and font family, the location of a custom stylesheet, and generic attributes like java script, plugins, etc. The WebAttribute enum further describes this.

QWebSettings also configures global properties such as the web page memory cache and the web page icon database, local database storage and offline applications storage.

Web Application Support

WebKit provides support for features specified in HTML 5 that improve the performance and capabilities of Web applications. These include client-side (offline) storage and the use of a Web application cache.

Client-side (offline) storage is an improvement over the use of cookies to store persistent data in Web applications. Applications can configure and enable the use of an offline storage database by calling the setOfflineStoragePath() with an appropriate file path, and can limit the quota for each application by calling setOfflineStorageDefaultQuota().

The performance of Web applications can be enhanced with the use of an offline cache. This can be enabled by calling setOfflineWebApplicationCache() with an appropriate file path.

See also:
QWebPage::settings(), QWebView::settings(), and Browser.


Nested Class Summary
static class QWebSettings.FontFamily
          This enum describes the generic font families defined by CSS 2.
static class QWebSettings.FontSize
          This enum describes the font sizes configurable through QWebSettings.
static class QWebSettings.WebAttribute
          This enum describes various attributes that are configurable through QWebSettings.
static class QWebSettings.WebGraphic
          This enums describes the standard graphical elements used in webpages.
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.PrivateSignal0, QSignalEmitter.PrivateSignal1, QSignalEmitter.PrivateSignal2, QSignalEmitter.PrivateSignal3, QSignalEmitter.PrivateSignal4, QSignalEmitter.PrivateSignal5, QSignalEmitter.PrivateSignal6, QSignalEmitter.PrivateSignal7, QSignalEmitter.PrivateSignal8, QSignalEmitter.PrivateSignal9, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9
 
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal
 
Field Summary
 
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
currentSender
 
Method Summary
static void clearIconDatabase()
          Clears the icon database.
 java.lang.String fontFamily(QWebSettings.FontFamily which)
          Returns the actual font family for the specified generic font family, which.
 int fontSize(QWebSettings.FontSize type)
          Returns the default font size for type.
static QWebSettings globalSettings()
          Returns the global settings object.
static java.lang.String iconDatabasePath()
          Returns the path of the icon database or an empty string if the icon database is disabled.
static QIcon iconForUrl(QUrl url)
          Returns the web site's icon for url.
static int maximumPagesInCache()
          Returns the maximum number of web pages that are kept in the memory cache.
static long offlineStorageDefaultQuota()
          Returns the value of the default quota for new offline storage databases.
static java.lang.String offlineStoragePath()
          Returns the path of the HTML5 offline storage or an empty string if the feature is disabled.
 void resetAttribute(QWebSettings.WebAttribute attr)
          Resets the setting of attribute.
 void resetFontFamily(QWebSettings.FontFamily which)
          Resets the actual font family to the default font family, specified by which.
 void resetFontSize(QWebSettings.FontSize type)
          Resets the font size for type to the size specified in the global settings object.
 void setAttribute(QWebSettings.WebAttribute attr, boolean on)
          Enables or disables the specified attribute feature depending on the value of on.
 void setFontFamily(QWebSettings.FontFamily which, java.lang.String family)
          Sets the actual font family to family for the specified generic family, which.
 void setFontSize(QWebSettings.FontSize type, int size)
          Sets the font size for type to size.
static void setIconDatabasePath(java.lang.String location)
          Sets the path of the icon database to path.
static void setMaximumPagesInCache(int pages)
          Sets the maximum number of pages to hold in the memory cache to pages.
static void setObjectCacheCapacities(int cacheMinDeadCapacity, int cacheMaxDead, int totalCapacity)
          Specifies the capacities for the memory cache for dead objects such as stylesheets or scripts.
static void setOfflineStorageDefaultQuota(long maximumSize)
          Sets the value of the default quota for new offline storage databases to maximumSize.
static void setOfflineStoragePath(java.lang.String path)
          Sets the path for HTML5 offline storage to path.
 void setUserStyleSheetUrl(QUrl location)
          Specifies the location of a user stylesheet to load with every web page.
static void setWebGraphic(QWebSettings.WebGraphic type, QPixmap graphic)
          Sets graphic to be drawn when QtWebKit needs to draw an image of the given type.
 boolean testAttribute(QWebSettings.WebAttribute attr)
          Returns true if attribute is enabled; otherwise returns false.
 QUrl userStyleSheetUrl()
          Returns the location of the user stylesheet.
static QPixmap webGraphic(QWebSettings.WebGraphic type)
          Returns a previously set pixmap used to draw replacement graphics of the specified type.
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
__qt_signalInitialization
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Method Detail

fontFamily

public final java.lang.String fontFamily(QWebSettings.FontFamily which)
Returns the actual font family for the specified generic font family, which.

See also:
setFontFamily().


fontSize

public final int fontSize(QWebSettings.FontSize type)
Returns the default font size for type.

See also:
setFontSize().


resetAttribute

public final void resetAttribute(QWebSettings.WebAttribute attr)
Resets the setting of attribute. This function has no effect on the global QWebSettings instance.

See also:
globalSettings().


resetFontFamily

public final void resetFontFamily(QWebSettings.FontFamily which)
Resets the actual font family to the default font family, specified by which.

This function has no effect on the global QWebSettings instance.


resetFontSize

public final void resetFontSize(QWebSettings.FontSize type)
Resets the font size for type to the size specified in the global settings object.

This function has no effect on the global QWebSettings instance.


setAttribute

public final void setAttribute(QWebSettings.WebAttribute attr,
                               boolean on)
Enables or disables the specified attribute feature depending on the value of on.


setFontFamily

public final void setFontFamily(QWebSettings.FontFamily which,
                                java.lang.String family)
Sets the actual font family to family for the specified generic family, which.

See also:
fontFamily().


setFontSize

public final void setFontSize(QWebSettings.FontSize type,
                              int size)
Sets the font size for type to size.

See also:
fontSize().


setUserStyleSheetUrl

public final void setUserStyleSheetUrl(QUrl location)
Specifies the location of a user stylesheet to load with every web page.

The location can be a URL or a path on the local filesystem.

See also:
userStyleSheetUrl().


testAttribute

public final boolean testAttribute(QWebSettings.WebAttribute attr)
Returns true if attribute is enabled; otherwise returns false.


userStyleSheetUrl

public final QUrl userStyleSheetUrl()
Returns the location of the user stylesheet.

See also:
setUserStyleSheetUrl().


clearIconDatabase

public static void clearIconDatabase()
Clears the icon database.


globalSettings

public static QWebSettings globalSettings()
Returns the global settings object.

Any setting changed on the default object is automatically applied to all QWebPage instances where the particular setting is not overriden already.


iconDatabasePath

public static java.lang.String iconDatabasePath()
Returns the path of the icon database or an empty string if the icon database is disabled.

See also:
setIconDatabasePath(), and clearIconDatabase().


iconForUrl

public static QIcon iconForUrl(QUrl url)
Returns the web site's icon for 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.

See also:
setIconDatabasePath().


maximumPagesInCache

public static int maximumPagesInCache()
Returns the maximum number of web pages that are kept in the memory cache.

See also:
setMaximumPagesInCache().


offlineStorageDefaultQuota

public static long offlineStorageDefaultQuota()
Returns the value of the default quota for new offline storage databases.

See also:
setOfflineStorageDefaultQuota().


offlineStoragePath

public static java.lang.String offlineStoragePath()
Returns the path of the HTML5 offline storage or an empty string if the feature is disabled.

See also:
setOfflineStoragePath().


setIconDatabasePath

public static void setIconDatabasePath(java.lang.String location)
Sets the path of the icon database to path. The icon database is used to store "favicons" associated with web sites.

path must point to an existing directory where the icons are stored.

Setting an empty path disables the icon database.

See also:
iconDatabasePath().


setMaximumPagesInCache

public static void setMaximumPagesInCache(int pages)
Sets the maximum number of pages to hold in the memory cache to pages.

See also:
maximumPagesInCache().


setObjectCacheCapacities

public static void setObjectCacheCapacities(int cacheMinDeadCapacity,
                                            int cacheMaxDead,
                                            int totalCapacity)
Specifies the capacities for the memory cache for dead objects such as stylesheets or scripts.

The cacheMinDeadCapacity specifies the minimum number of bytes that dead objects should consume when the cache is under pressure.

cacheMaxDead is the maximum number of bytes that dead objects should consume when the cache is not under pressure.

totalCapacity specifies the maximum number of bytes that the cache should consume 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.


setOfflineStorageDefaultQuota

public static void setOfflineStorageDefaultQuota(long maximumSize)
Sets the value of the default quota for new offline storage databases to maximumSize.

See also:
offlineStorageDefaultQuota().


setOfflineStoragePath

public static void setOfflineStoragePath(java.lang.String path)
Sets the path for HTML5 offline storage to path.

path must point to an existing directory where the databases are stored.

Setting an empty path disables the feature.

See also:
offlineStoragePath().


setWebGraphic

public static void setWebGraphic(QWebSettings.WebGraphic type,
                                 QPixmap graphic)
Sets graphic to be drawn when QtWebKit needs to draw an image of the given type.

For example, when an image cannot be loaded the pixmap specified by MissingImageGraphic is drawn instead.

See also:
webGraphic().


webGraphic

public static QPixmap webGraphic(QWebSettings.WebGraphic type)
Returns a previously set pixmap used to draw replacement graphics of the specified type.

For example, when an image cannot be loaded the pixmap specified by MissingImageGraphic is drawn instead.

See also:
setWebGraphic().