maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   SailfishOS (https://talk.maemo.org/forumdisplay.php?f=52)
-   -   Help me to code for Sailfish OS (https://talk.maemo.org/showthread.php?t=100817)

BGK 2019-10-20 21:03

Re: Help me to code for Sailfish OS
 
1 Attachment(s)
Three more questions:

1. I would like to navigate from the first page of an app (page 1) to another by swiping left (page 2).
GPSInfo does this by using a timer which creates the pageStack.pushAttached element of the second page.
Is there another / more elegant way to achieve this behaviour of changing from one to another page?

2. Is it possible to navigate from one pages button (page 1) to another page (page 3) and scroll this one to a specific item (for example a label) in the middle of this page (like anchors in HTML)?

3. Is it possible to use QLM's transform.matrix4x4 within sailfish apps to transform this element (for example to mirror a text field vertically)?

coderus 2019-10-21 12:44

Re: Help me to code for Sailfish OS
 
1. PageStack is stack, it's linear. You should have a page under your depth to go lower.
2. You can pass any arguments to a page you pushing to. Process it inside page to scroll
3. You can use transform property: https://doc.qt.io/qt-5/qml-qtquick-i...transform-prop

BGK 2019-10-21 18:56

Re: Help me to code for Sailfish OS
 
Thanks for your helpful tips, coderus!

Quote:

Originally Posted by coderus (Post 1561141)
1. PageStack is stack, it's linear. You should have a page under your depth to go lower.

Navigating the stack backwards is clear (and easy). It's the possibility to navigate "forward" from page 1 to page 2 (without the need of a button, just swiping) which I'm looking for. ;)

Quote:

Originally Posted by coderus (Post 1561141)
2. You can pass any arguments to a page you pushing to. Process it inside page to scroll

Passing the "scroll-to-item" to page 3 was exactly what I thought of. But how to scroll the page?

Quote:

Originally Posted by coderus (Post 1561141)

Wonderful! Exactly what I was searching for!

coderus 2019-10-21 19:17

Re: Help me to code for Sailfish OS
 
1. okay, then attachedPage is your choice. Or use a Dialog instead of a Page and set acceptDestination
2. By using https://doc.qt.io/qt-5/qml-qtquick-l...AtIndex-method

BGK 2019-10-21 20:31

Re: Help me to code for Sailfish OS
 
Quote:

Originally Posted by coderus (Post 1561150)
1. okay, then attachedPage is your choice. Or use a Dialog instead of a Page and set acceptDestination

I'll go for attachedPage. GPSInfo uses a timer to call attachedPage. What could be the reason for that (wouldn't be Component.onCompleted an easier way)?

Quote:

Originally Posted by coderus (Post 1561150)

Thanks a lot!

coderus 2019-10-21 20:34

Re: Help me to code for Sailfish OS
 
There could be problems with transitions., Try it out and see. New API introduced pageStack.completeAnimation() method, which is probably you want to call before pageStack.pushAttached

kuba77 2019-11-02 22:56

Re: Help me to code for Sailfish OS
 
How to work with images? I want to create app like this or this... so I need to choose image(s) from gallery and save it somewhere in the app - to local database?

coderus 2019-11-03 07:18

Re: Help me to code for Sailfish OS
 
I think this code should still work: https://bitbucket.org/mitakuuluu/mit...atarPicker.qml

Markkyboy 2019-11-12 18:41

Re: Help me to code for Sailfish OS
 
Hi,

How to add a short vibration to a Rectangle Button?,

thanks, . .

Ancelad 2019-11-12 19:04

Re: Help me to code for Sailfish OS
 
Quote:

Originally Posted by Markkyboy (Post 1561892)
Hi,

How to add a short vibration to a Rectangle Button?,

thanks, . .

Code:

import QtFeedback 5.0

HapticsEffect {
        id: activeEffect
        duration: 500 // in ms
        intensity: 0.2 // from 0 to 1 with 0.1 step-size
        running: button.pressed
}
Button {
        id: button
        width: text.width
        text: "Test"                                       
        anchors.horizontalCenter: parent.horizontalCenter
        onClicked: activeEffect.start()         
}



All times are GMT. The time now is 15:03.

vBulletin® Version 3.8.8