[SailfishDevel] Problems with the Emulator (possible bugs?)

Jonni Rainisto jonni.rainisto at jolla.com
Mon Nov 4 22:00:59 UTC 2013


Hi,

1) Not part of the emulator and double clicks should be avoided anyways, bad UI experience. So forget using it :) (or make custom qevent handler and compare timestamps).

2) Hard to know the problem without seeing your code. Maybe you forgot to use property alias? Works for me. Here is minimal example of main, first and second page:
---helloBinding.qml---
import QtQuick 2.0
import Sailfish.Silica 1.0
import "pages"
ApplicationWindow
{
    initialPage: FirstPage { id: first }
    cover: Qt.resolvedUrl("cover/CoverPage.qml")
}
---FirstPage.qml---
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
    id: page
    property alias labelText: exampleLabel.text
    // To enable PullDownMenu, place our content in a SilicaFlickable
    SilicaFlickable {
        anchors.fill: parent
        // PullDownMenu and PushUpMenu must be declared in SilicaFlickable, SilicaListView or SilicaGridView
        PullDownMenu {
            MenuItem {
                text: "Show Page 2"
                onClicked: pageStack.push(Qt.resolvedUrl("SecondPage.qml"))
            }
        }
        // Tell SilicaFlickable the height of its content.
        contentHeight: column.height
        // Place our content in a Column.  The PageHeader is always placed at the top
        // of the page, followed by our content.
        Column {
            id: column
            width: page.width
            spacing: Theme.paddingLarge
            PageHeader {
                title: "UI Template"
            }
            Label {
                id: exampleLabel
                x: Theme.paddingLarge
                text: "Hello Sailors"
                color: Theme.secondaryHighlightColor
                font.pixelSize: Theme.fontSizeLarge
            }
        }
    }
}
---SecondPage.qml---
import QtQuick 2.0
import Sailfish.Silica 1.0
Page {
    id: page
    SilicaListView {
        id: listView
        anchors.fill: parent
        header: PageHeader {
            title: "Nested Page"
        }
        MouseArea {
            anchors.fill: parent
            onClicked: {
                first.labelText = "Foo Bar"
                pageStack.pop()
            }
        }
    }
}
--
re, Jonni
________________________________________
From: devel-bounces at lists.sailfishos.org [devel-bounces at lists.sailfishos.org] on behalf of tw_bolek [tw_bolek at op.pl]
Sent: Monday, November 04, 2013 11:09 PM
To: devel at lists.sailfishos.org
Subject: [SailfishDevel] Problems with the Emulator (possible bugs?)

Hello guys,

While porting my applications to Sailfish OS, I encountered the following problems with the Emulator. I tried it numerous times and I always end up with the same result:

1) I cannot make onDoubleClick signal work.  I have a Rectangle with a MouseArea filling it, and it has an onDoubleClicked signal - there's no reaction to it (tried clicking with various delays, a lot of times very quickly, etc.).  If I change it to onClicked then single click works fine. I've also tested it with a simple Button - similarly, onDoubleClicked has no reaction (other than that the button gets highlighted for a short while as with onClicked, but nothing else happens), while with onClicked the button works OK with a single click.


2) If I update something on a page that's currently not visible (i.e. it isn't the topmost page in the stack) then its visible contents don't get refreshed.  Its properties themselves DO get updated (which I can verify with console.log output) but when I go back to that page (e.g. via pageStack.pop()) then it still shows "old" content. If I update these properties once again, while the page IS visible (topmost), then everything gets updated correctly.

For example, I have a Text element on a page (and its text is e.g. "First"). I then switch (via pageStack.push()) to another page and from there I update the first page's (not currently visible) text property (to e.g. "Second"). Console.log output shows that the text property gets updated, but if I switch back to that page then it still shows the old "First" text (despite the property itself now being "Second").   The very same code works properly on Harmattan, Symbian and BB10.  The only difference is that on Sailfish OS the element is within a SilicaFlickable.

Can someone please check it? I've spent the last two days trying to make the above work, to no avail...

Thank you,
Bolek
_______________________________________________
SailfishOS.org Devel mailing list


More information about the Devel mailing list