📄 khtml_part.h
字号:
* * Attention: Don't mix calls to @ref write( const char *) with calls * to @ref 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 @ref write(). */ virtual void end(); /* * Prints the current HTML page layed out for the printer. * * (not implemented at the moment) */ // void print(QPainter *, int pageHeight, int pageWidth); /** * Paints the HTML page to a QPainter. See @ref 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. */ 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. */ 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 ); /** * 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; /** * Initiates a text search. */ void findTextBegin(DOM::NodeImpl *startNode = 0, int startPos = -1); /** * Finds the next occurrence of the string or expression. * If isRegExp is true then str is converted to a QRegExp, and caseSensitive is ignored. */ bool findTextNext( const QString &str, bool forward, bool caseSensitive, bool isRegExp ); /** * 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; /** * Returns the selected part of the HTML. */ const DOM::Selection &selection() const; /** * Returns the drag caret of the HTML. */ const DOM::Selection &dragCaret() const; /** * Sets the current selection. */ void setSelection(const DOM::Selection &, bool closeTyping=true); /** * Sets the current drag cart. */ void setDragCaret(const DOM::Selection &); /** * Clears the current selection. */ void clearSelection(); /** * Invalidates the current selection. */ void invalidateSelection(); /** * Controls the visibility of the selection. */ void setSelectionVisible(bool flag=true); /** * Paints the caret. */ void paintCaret(QPainter *p, const QRect &rect) const; /** * Paints the drag caret. */ void paintDragCaret(QPainter *p, const QRect &rect) const; /** * Set info for vertical arrow navigation. */ void setXPosForVerticalArrowNavigation(int x); /** * Get info for vertical arrow navigation. */ int xPosForVerticalArrowNavigation() const; /** * Returns the text for a part of the document. */ QString text(const DOM::Range &) const; /** * Has the user selected anything? * * Call @ref 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(); /** * Returns whether editing should end in the given range */ bool shouldBeginEditing(const DOM::Range &) const; /** * Returns whether editing should end in the given range */ bool shouldEndEditing(const DOM::Range &) const; /** * Returns the contentEditable "override" value for the part */ bool isContentEditable() const; /** * Returns the most recent edit command applied. */ khtml::EditCommand lastEditCommand(); /** * Called when editing has been applied. */ void appliedEditing(khtml::EditCommand &); /** * Called when editing has been unapplied. */ void unappliedEditing(khtml::EditCommand &); /** * Called when editing has been reapplied. */ void reappliedEditing(khtml::EditCommand &); /** * Returns the typing style for the document. */ DOM::CSSStyleDeclarationImpl *typingStyle() const; /** * Sets the typing style for the document. */ void setTypingStyle(DOM::CSSStyleDeclarationImpl *); /** * Clears the typing style for the document. */ void clearTypingStyle(); /** * 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();#if !APPLE_CHANGES /** * Saves the KHTMLPart's complete state (including child frame * objects) to the provided @ref QDataStream. * * This is called from the @ref saveState() method of the * @ref browserExtension(). */ virtual void saveState( QDataStream &stream ); /** * Restores the KHTMLPart's previously saved state (including * child frame objects) from the provided QDataStream. * * @see saveState() * * This is called from the @ref restoreState() method of the * @ref browserExtension() . **/ virtual void restoreState( QDataStream &stream );#endif /** * Returns the @p Node currently under the mouse */ DOM::Node nodeUnderMouse() const; /** * @internal */ const KHTMLSettings *settings() const; /** * Returns a pointer to the parent KHTMLPart if the part is a frame * in an HTML frameset. * * Returns 0L otherwise. */ KHTMLPart *parentPart() const; /** * Returns a list of names of all frame (including iframe) objects of * the current document. Note that this method is not working recursively * for sub-frames. */ QStringList frameNames() const; QPtrList<KParts::ReadOnlyPart> frames() const; /** * Finds a frame by name. Returns 0L if frame can't be found. */ KHTMLPart *findFrame( const QString &f ); /** * Return the current frame (the one that has focus) * Not necessarily a direct child of ours, framesets can be nested. * Returns "this" if this part isn't a frameset. */ KParts::ReadOnlyPart *currentFrame() const; /** * Returns whether a frame with the specified name is exists or not. * In contrary to the @ref findFrame method this one also returns true * if the frame is defined but no displaying component has been * found/loaded, yet. */ bool frameExists( const QString &frameName ); /** * Called by KJS. * Sets the StatusBarText assigned * via window.status */ void setJSStatusBarText( const QString &text ); /** * Called by KJS. * Sets the DefaultStatusBarText assigned * via window.defaultStatus */ void setJSDefaultStatusBarText( const QString &text ); /** * Called by KJS. * Returns the StatusBarText assigned * via window.status */ QString jsStatusBarText() const; /** * Called by KJS. * Returns the DefaultStatusBarText assigned * via window.defaultStatus */ QString jsDefaultStatusBarText() const; /** * Referrer used for links in this page. */ QString referrer() const; /** * Last-modified date (in raw string format), if received in the [HTTP] headers. */ QString lastModified() const; /** * Loads a style sheet into the stylesheet cache. */ void preloadStyleSheet(const QString &url, const QString &stylesheet); /** * Loads a script into the script cache. */ void preloadScript(const QString &url, const QString &script); bool isPointInsideSelection(int x, int y); virtual bool tabsToLinks() const; virtual bool tabsToAllControls() const; /** * @internal */ bool restored() const; void incrementFrameCount(); void decrementFrameCount(); int topLevelFrameCount(); // Editing operations. // Not clear if these will be wanted in KHTMLPart by KDE, // but for now these bridge so we don't have to pepper the // KHTML code with WebCore-specific stuff. enum TriState { falseTriState, trueTriState, mixedTriState }; void copyToPasteboard(); void cutToPasteboard(); void pasteFromPasteboard(); bool canPaste() const; void redo(); void undo(); bool canRedo() const; bool canUndo() const; void applyStyle(DOM::CSSStyleDeclarationImpl *); TriState selectionHasStyle(DOM::CSSStyleDeclarationImpl *) const; bool selectionStartHasStyle(DOM::CSSStyleDeclarationImpl *) const; DOM::DOMString selectionStartStylePropertyValue(int stylePropertyID) const; void print();signals: /** * Emitted if the cursor is moved over an URL. */ void onURL( const QString &url );
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -