愛悠閑 > setFocus()函數的運用

setFocus()函數的運用

分類: Qt  |  標簽: behavior,function,query,path,xml,user  |  作者: zuokong 相關  |  發布日期 : 2014-09-17  |  熱度 : 617°
void QXmlQuery::setFocus ( const QXmlItem & item ) Sets the focus to item. The focus is the set of items that the context item expression and path expressions navigate from. For example, in the expression p/span, the element that p evaluates to is the focus for the following expression, span. The focus can be accessed using the context item expression, i.e., dot ("."). By default, the focus is not set and is undefined. It will therefore result in a dynamic error, XPDY0002, if the focus is attempted to be accessed. The focus must be set before the query is set with setQuery(). There is no behavior defined for setting an item which is null. bool QXmlQuery::setFocus ( const QUrl & documentURI ) This is an overloaded function. Sets the focus to be the document located at documentURI and returns true. If documentURI cannot be loaded, false is returned. It is undefined at what time the document may be loaded. When loading the document, the message handler and URI resolver set on this QXmlQuery are used. If documentURI is empty or is not a valid URI, the behavior of this function is undefined. bool QXmlQuery::setFocus ( QIODevice * document ) Sets the focus to be the document read from the QIODevice and returns true. If document cannot be loaded, false is returned. QXmlQuery does not take ownership of document. The user guarantees that a document is available from the document device and that the document is not empty. The device must be opened in at least read-only mode. document must stay in scope as long as the current query is active. This is an overloaded function. bool QXmlQuery::setFocus ( const QString & focus ) This function behaves identically to calling the setFocus() overload with a QIODevice whose content is focus encoded as UTF-8. That is, focus is treated as if it contained an XML document. Returns the same result as the overload.

This is an overloaded function.

例子:

 ui->textEdit->setFocus();


快乐彩中奖说明