WebEngineHistory QML Type
ウェブエンジンページの履歴を表すデータモデルを提供する。詳細...
Import Statement: | import QtWebEngine |
Since: | QtWebEngine 1.1 |
In C++: | QWebEngineHistory |
プロパティ
- backItems : WebEngineHistoryModel
- forwardItems : WebEngineHistoryModel
- items : WebEngineHistoryModel
方法
- void clear()
(since QtWebEngine 1.11)
詳細説明
WebEngineHistory 型には、WebEngineView.history プロパティを使用してアクセスできます。
WebEngineHistory 型は、次のWebEngineHistoryModel データ モデル オブジェクトを提供します:
backItems
訪問したページの URL が格納されています。forwardItems
現在のページを訪問した後に訪問したページの URL が格納されています。items
これは、現在のページのURLと同様に、戻る項目と進む項目のURLを含んでいます。
これらのモデルを使用する最も簡単な方法は、次のコード・スニペットで示すように、ListView :
ListView { id: historyItemsList anchors.fill: parent model: webEngineView.history.items delegate: Text { color: "black" text: model.title + " - " + model.url + " (" + model.offset + ")" } }
ListView 、対応するモデルの内容が表示されます。デリゲートはリスト項目の書式を担当します。デリゲートにおけるリストの各項目の外観は、個別に定義することができます(ウェブエンジン固有のものではありません)。
モデルのtitle、url、iconの役割は、訪問したページのタイトル、URL、ファビコンを指定します。offsetロールは、現在のページ(0)に対するページの位置を指定します。正の数は、ページが現在のページの後に訪問されたことを示し、負の数は、ページが現在のページの前に訪問されたことを示します。
以下のコードスニペットに示すように、データモデルを使用してメニューを作成することもできます:
menuBar: ToolBar { id: navigationBar RowLayout { anchors.fill: parent ToolButton { enabled: win.currentWebView?.canGoBack || win.currentWebView?.canGoForward onClicked: historyMenu.open() text: qsTr("▼") Menu { id: historyMenu Instantiator { model: win.currentWebView?.history?.items MenuItem { required property var model text: model.title onTriggered: win.currentWebView.goBackOrForward(model.offset) checkable: !enabled checked: !enabled enabled: model.offset } onObjectAdded: function(index, object) { historyMenu.insertItem(index, object) } onObjectRemoved: function(index, object) { historyMenu.removeItem(object) } } }
完全な例については、WebEngine Quick Nano Browser を参照してください。
WebEngineHistoryModelも参照して ください。
プロパティ ドキュメント
backItems : WebEngineHistoryModel |
WebEngineHistoryModel オブジェクト。バックアイテムの情報を抽出するために使用できます。
WebEngineHistoryModel 、forwardItems 、itemsも参照して ください。
forwardItems : WebEngineHistoryModel |
WebEngineHistoryModel 前方アイテムに関する情報を抽出するために使えるオブジェクト。
WebEngineHistoryModel 、backItems 、itemsも参照 。
items : WebEngineHistoryModel |
WebEngineHistoryModel オブジェクトで、履歴の back アイテム、forward アイテム、現在のアイテムに関する情報を抽出できます。
WebEngineHistoryModel 、backItems 、forwardItemsも参照して ください。
メソッド・ドキュメント
|
履歴を消去します。
このメソッドは QtWebEngine 1.11 で導入されました。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.