diff options
Diffstat (limited to 'src/webenginequick/ui/AutofillPopup.qml')
-rw-r--r-- | src/webenginequick/ui/AutofillPopup.qml | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/webenginequick/ui/AutofillPopup.qml b/src/webenginequick/ui/AutofillPopup.qml new file mode 100644 index 000000000..0a14b6233 --- /dev/null +++ b/src/webenginequick/ui/AutofillPopup.qml @@ -0,0 +1,41 @@ +// Copyright (C) 2022 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +import QtQuick +import QtQuick.Controls + +Popup { + id: root + // Let Chromium close the popup. + closePolicy: Popup.NoAutoClose + + property variant controller: null + property int itemHeight: 0 + + signal selected(int index) + signal accepted() + + function setCurrentIndex(index) + { + listView.currentIndex = index; + } + + ListView { + id: listView + anchors.fill: parent + clip: true + + model: controller.model + currentIndex: -1 + + delegate: ItemDelegate { + width: listView.width + height: root.itemHeight + text: model.display + highlighted: ListView.isCurrentItem + + onHoveredChanged: if (hovered) selected(index); + onClicked: accepted(); + } + } +} |