📄 khtml_part.h
字号:
* automatically or not. * * @note Request will be ignored if called before begin(). */ void setAutoloadImages( bool enable ); /** * Returns whether images contained in the document are loaded automatically * or not. * @note that the returned information is unrelieable as long as no begin() * was called. */ bool autoloadImages() const; /** * Security option. * * Specify whether only file:/ or data:/ urls are allowed to be loaded without * user confirmation by KHTML. * ( for example referenced by stylesheets, images, scripts, subdocuments, embedded elements ). * * This option is mainly intended for enabling the "mail reader mode", where you load untrusted * content with a file:/ url. * * Please note that enabling this option currently automatically disables Javascript, * Java and Plugins support. This might change in the future if the security model * is becoming more sophisticated, so don't rely on this behaviour. * * ( default false - everything is loaded unless forbidden by KApplication::authorizeURLAction). */ void setOnlyLocalReferences( bool enable ); /** * Returns whether only file:/ or data:/ references are allowed * to be loaded ( default false ). See setOnlyLocalReferences. **/ bool onlyLocalReferences() const; /** Returns whether caret mode is on/off. * @since 3.2 */ bool isCaretMode() const; /** * Returns @p true if the document is editable, @p false otherwise. * @since 3.2 */ bool isEditable() const; /** * Sets the caret to the given position. * * If the given location is invalid, it will snap to the nearest valid * location. Immediately afterwards a @p caretPositionChanged signal * containing the effective position is emitted * @param node node to set to * @param offset zero-based offset within the node * @param extendSelection If @p true, a selection will be spanned from the * last caret position to the given one. Otherwise, any existing selection * will be deselected. * @since 3.2 */ void setCaretPosition(DOM::Node node, long offset, bool extendSelection = false); /** * Enumeration for displaying the caret. * @param Visible caret is displayed * @param Invisible caret is not displayed * @param Blink caret toggles between visible and invisible * @since 3.2 */ enum CaretDisplayPolicy { CaretVisible, CaretInvisible, CaretBlink }; /** * Returns the current caret policy when the view is not focused. * @since 3.2 */ CaretDisplayPolicy caretDisplayPolicyNonFocused() const; /** * Sets the caret display policy when the view is not focused. * * Whenever the caret is in use, this property determines how the * caret should be displayed when the document view is not focused. * * The default policy is CaretInvisible. * @param policy new display policy * @since 3.2 */ void setCaretDisplayPolicyNonFocused(CaretDisplayPolicy policy);#ifndef KDE_NO_COMPAT void enableJScript( bool e ) { setJScriptEnabled(e); } void enableJava( bool e ) { setJavaEnabled(e); } void enablePlugins( bool e ) { setPluginsEnabled(e); } void autoloadImages( bool e ) { setAutoloadImages(e); } void enableMetaRefresh( bool e ) { setMetaRefreshEnabled(e); } bool setCharset( const QString &, bool ) { return true; } KURL baseURL() const; QString baseTarget() const;#endif /** * Returns the URL for the background Image (used by save background) */ KURL backgroundURL() const; /** * Schedules a redirection after @p delay seconds. */ void scheduleRedirection( int delay, const QString &url, bool lockHistory = true ); /** * Clears the widget and prepares it for new content. * * If you want url() to return * for example "file:/tmp/test.html", you can use the following code: * \code * view->begin( KURL("file:/tmp/test.html" ) ); * \endcode * * @param url is the url of the document to be displayed. Even if you * are generating the HTML on the fly, it may be useful to specify * a directory so that any pixmaps are found. * * @param xOffset is the initial horizontal scrollbar value. Usually * you don't want to use this. * * @param yOffset is the initial vertical scrollbar value. Usually * you don't want to use this. * * All child frames and the old document are removed if you call * this method. */ virtual void begin( const KURL &url = KURL(), int xOffset = 0, int yOffset = 0 ); /** * Writes another part of the HTML code to the widget. * * You may call * this function many times in sequence. But remember: The fewer calls * you make, the faster the widget will be. * * The HTML code is send through a decoder which decodes the stream to * Unicode. * * The @p len parameter is needed for streams encoded in utf-16, * since these can have \\0 chars in them. In case the encoding * you're using isn't utf-16, you can safely leave out the length * parameter. * * Attention: Don't mix calls to write( const char *) with calls * to write( const QString & ). * * The result might not be what you want. */ virtual void write( const char *str, int len = -1 ); /** * Writes another part of the HTML code to the widget. * * You may call * this function many times in sequence. But remember: The fewer calls * you make, the faster the widget will be. */ virtual void write( const QString &str ); /** * Call this after your last call to write(). */ virtual void end(); /* * Prints the current HTML page laid out for the printer. * * (not implemented at the moment) */ // void print(QPainter *, int pageHeight, int pageWidth); /** * Paints the HTML page to a QPainter. See KHTMLView::paint for details */ void paint( QPainter *, const QRect &, int = 0, bool * = 0 ); /** * Sets the encoding the page uses. * * This can be different from the charset. The widget will try to reload the current page in the new * encoding, if url() is not empty. */ bool setEncoding( const QString &name, bool override = false ); /** * Returns the encoding the page currently uses. * * Note that the encoding might be different from the charset. */ QString encoding() const; /** * Sets a user defined style sheet to be used on top of the HTML 4 * default style sheet. * * This gives a wide range of possibilities to * change the layout of the page. * * To have an effect this function has to be called after calling begin(). */ void setUserStyleSheet( const KURL &url ); /** * Sets a user defined style sheet to be used on top of the HTML 4 * default style sheet. * * This gives a wide range of possibilities to * change the layout of the page. * * To have an effect this function has to be called after calling begin(). */ void setUserStyleSheet( const QString &styleSheet );public: /** * Sets the standard font style. * * @param name The font name to use for standard text. */ void setStandardFont( const QString &name ); /** * Sets the fixed font style. * * @param name The font name to use for fixed text, e.g. * the <tt><pre></tt> tag. */ void setFixedFont( const QString &name ); /** * Finds the anchor named @p name. * * If the anchor is found, the widget * scrolls to the closest position. Returns @p if the anchor has * been found. */ bool gotoAnchor( const QString &name ); /** * Go to the next anchor * * This is useful to navigate from outside the navigator * @since 3.2 */ bool nextAnchor(); /** * Go to previous anchor * @since 3.2 */ bool prevAnchor(); /** * Sets the cursor to use when the cursor is on a link. */ void setURLCursor( const QCursor &c ); /** * Returns the cursor which is used when the cursor is on a link. */ QCursor urlCursor() const; /** * Extra Find options that can be used when calling the extended findText(). * @since 3.3 */ enum FindOptions { FindLinksOnly = 1 * KFindDialog::MinimumUserOption, FindNoPopups = 2 * KFindDialog::MinimumUserOption //FindIncremental = 4 * KFindDialog::MinimumUserOption }; /** * Starts a new search by popping up a dialog asking the user what he wants to * search for. * @since 3.3 */ void findText(); /** * Starts a new search, but bypasses the user dialog. * @param str The string to search for. * @param options Find options. * @param parent Parent used for centering popups like "string not found". * @param findDialog Optionally, you can supply your own dialog. * @since 3.3 */ void findText( const QString &str, long options, QWidget *parent = 0, KFindDialog *findDialog = 0 ); /** * Initiates a text search. */ void findTextBegin(); /** * Finds the next occurrence of the string or expression. * If isRegExp is true then str is converted to a QRegExp, and caseSensitive is ignored. * @deprecated, use findText( str, options, parent, findDialog ) */ bool findTextNext( const QString &str, bool forward, bool caseSensitive, bool isRegExp ); /** * Finds the next occurence of a string set by @ref findText() * @return true if a new match was found. * @since 3.3 */ bool findTextNext(); /** * Finds the next occurence of a string set by @ref findText() * @param reverse if true, revert seach direction (only if no find dialog is used) * @return true if a new match was found. * @since 3.5 */ // KDE4 merge with default = false bool findTextNext( bool reverse ); /** * Sets the Zoom factor. The value is given in percent, larger values mean a * generally larger font and larger page contents. It is not guaranteed that * all parts of the page are scaled with the same factor though. * * The given value should be in the range of 20..300, values outside that * range are not guaranteed to work. A value of 100 will disable all zooming * and show the page with the sizes determined via the given lengths in the * stylesheets. */ void setZoomFactor(int percent); /** * Returns the current zoom factor. */ int zoomFactor() const; /** * Returns the text the user has marked. */ virtual QString selectedText() const; /** * Return the text the user has marked. This is guaranteed to be valid xml, * and to contain the \<html> and \<body> tags. * * FIXME probably should make virtual for 4.0 ? * * @since 3.4 */ QString selectedTextAsHTML() const; /** * Returns the selected part of the HTML. */ DOM::Range selection() const; /** * Returns the selected part of the HTML by returning the starting and end * position. * * If there is no selection, both nodes and offsets are equal. * @param startNode returns node selection starts in * @param startOffset returns offset within starting node * @param endNode returns node selection ends in * @param endOffset returns offset within end node. * @since 3.2 */ void selection(DOM::Node &startNode, long &startOffset, DOM::Node &endNode, long &endOffset) const; /** * Sets the current selection. */ void setSelection( const DOM::Range & ); /** * Has the user selected anything? * * Call selectedText() to * retrieve the selected text. * * @return @p true if there is text selected. */ bool hasSelection() const; /** * Marks all text in the document as selected. */ void selectAll(); /** * Convenience method to show the document's view. * * Equivalent to widget()->show() or view()->show() . */ void show(); /** * Convenience method to hide the document's view. * * Equivalent to widget()->hide() or view()->hide(). */ void hide(); /** * Returns a reference to the partmanager instance which * manages html frame objects. */ KParts::PartManager *partManager();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -