WPEOptionDialogProxy QML Type

A Proxy object to handle signals and slots for QML Select dialogs. More...

Import Statement: import .

Methods

Detailed Description

This only exists in the Sailfish OS version, since 0.1.1

Consumes objects created in WPEView::notifyOptionMenuCallback, and connects signals.

Here's an example how this may be used:

 QVariant dialogVar;
 QMetaObject::invokeMethod(view, "showOptionMenu",
                        Qt::AutoConnection,
                        Q_RETURN_ARG(QVariant, dialogVar),
                        Q_ARG(QVariant, nitems),
                        Q_ARG(QVariant, items)
                        );
 QQuickItem* dialog = dialogVar.value<QQuickItem*>();
 WPEQtOptionDialogProxy(view, dialog, menu);
 import QtQuick 2.6
 import org.wpewebkit.qtwpe 1.0

 WPEView {
     function showOptionMenu(count, items) {
         return pageStack.push(Qt.resolvedUrl("OptionDialog.qml"), { "options": items })
     }
 }
 import QtQuick 2.6

 Dialog { id: root
     property var options: ({})
     property int selectedElement: -1
     signal activated(int selection)
     signal selected(int selection)

     ListView {
         model: optionModel
         delegate: Item {
             onClicked: { root.selectedElement = index; root.selected(index) }
         }
     }
 }

items is a list of objects with the following properties. See the documentation about WebKitOptionMenu for their meaning.

Method Documentation

void activation(int selected)

Notifies WPEView that an item has been activated and the dialog has been closed.

See also webkit_option_menu_activate_item.


void canceled()

Notifies WPEView that the dialog has been cancelled.


void selection(int selected)

Notifies WPEView that an item has been selected but does not close the dialog.



QML Plugin Sailfish OS WPE WebView Documentation Copyright (c) 2026 SailfishOS contributors. This document may be used under the terms of the Creative Commons Attribution Share Alike 4.0 International License.