setFocus()函數的運用

來源:互聯網
上載者:User

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();

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.