API Documentation

Documentation for developing SailfishOS applications

RemorsePopup QML Type

Shows a pop-up that briefly allows a destructive action to be canceled More...

Import Statement: import Sailfish.Silica 1.0
Inherits:

BackgroundItem

Properties

Signals

Methods

Detailed Description

The RemorsePopup type allows destructive actions to be delayed until after a remorse period has elapsed. If the RemorsePopup control is tapped before this timeout expires, the action is canceled.

When the RemorsePopup is activated by the execute() function, it is displayed across the top of its parent, showing a countdown timer and allowing the user to cancel the action.

Here is an example employing a RemorsePopup to clear a list when the menu option is activated:

 import QtQuick 2.2
 import Sailfish.Silica 1.0

 Page {
     SilicaListView {
         anchors.fill: parent
         model: ListModel {
             id: listModel
             Component.onCompleted: {
                 for (var i=0; i<10; i++) {
                     append({"name": "Item " + i})
                 }
             }
         }

         delegate: BackgroundItem {
             id: myDelegate
             width: ListView.view.width

             Label {
                 text: model.name
                 anchors.centerIn: parent
             }
         }

         RemorsePopup { id: remorse }

         PullDownMenu {
             MenuItem {
                 text: "Clear"
                 onClicked: remorse.execute("Clearing", function() { listModel.clear() } )
             }
         }
     }
 }

RemorsePopup is typically used when executing an action that affects multiple items at the same time, or when executing a page or application-wide action. To achieve a similar effect for an action that affects a single item in a list or view, use RemorseItem.

See also Remorse::popupAction() and RemorseItem.

Property Documentation

[read-only] active : bool

Returns true if the remorse counter is running.


leftMargin : real

The margins between the left and right edges of the remorse popup and its contents. The default value is Theme.horizontalPageMargin.


rightMargin : real

The margins between the left and right edges of the remorse popup and its contents. The default value is Theme.horizontalPageMargin.


text : string

This property contains the description of the action to be potentially cancelled.

This property is typically provided by calling the execute() function.


Signal Documentation

onCanceled()

This signal handler is called if the user clicks on the RemorsePopup to cancel the action.


onTriggered()

This signal handler is called if the action has not been canceled within the remorse period.


Method Documentation

cancel()

Cancels the RemorsePopup without performing the action.


execute(string text, object callback, int timeout)

Displays the RemorsePopup with the specified text.

Once the timeout has expired callback will be called. If a callback is not supplied then the onTriggered handler may be used to perform the action.

timeout is optional. The default value of 5000ms will be used if it is not supplied.


trigger()

Triggers the RemorsePopup action.


We use cookies to improve your user experience and to help us to develop our services. By continuing to browse the site, you approve of our use of cookies.