maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   General (https://talk.maemo.org/forumdisplay.php?f=7)
-   -   Getting started whit QT and Sailfish (https://talk.maemo.org/showthread.php?t=91968)

finfly 2013-12-08 18:46

Getting started whit QT and Sailfish
 
Hi!

I have some basic programming experience on Python, VBA and Matlab.

I had idea to try my hand on Sailfish programming whit a simple date calculator (user inputs date and code adds x-dates to it, the result is displayed). I figured installing the SDK and VM; but now I'm having difficulties submerging to QT world. Is it C++ or own language? Is there any books or websites, besides the offical QT and Sailfish sites, that could point me to start?

I really appreciate all help! :)

herdem09 2013-12-08 18:51

Re: Getting started whit QT and Sailfish
 
Similar case here. I have coded small programs for PC with c++ so far and have never used and needed a UI. Now I am having diffuculty understanding connections between ui and the code.

jesper 2013-12-08 19:02

Re: Getting started whit QT and Sailfish
 
I think you will find Qt very easy to work with.

I have, myself, not yet started to develop anything for Sailfish but I have been using Qt/ QtCreator to develop various PC applications for a number of years.

Regarding Sailfish/Qt/Silica I think you should have look here for a start:
https://sailfishos.org/sailfish-sili...roduction.html
https://sailfishos.org/sailfish-silica/
https://sailfishos.org/sailfish-sili...ilica-all.html

//j

mikkojhe 2013-12-08 19:06

Re: Getting started whit QT and Sailfish
 
Just download the sdk from sailfish.org. It has example programs and a good reference with it.

Larswad 2013-12-08 22:17

Re: Getting started whit QT and Sailfish
 
I'm wondering whether the silica components ONLY can be used from QML?
It seems to work to do a completely native application, even with QtWidgets (even though QtWidgets of course looks bad).
But being able to do completely native apps would also be nice.
Otherwise, a lot of bridging code needs to be added for all existing code I have between Native and QML.

trx 2013-12-08 23:33

Re: Getting started whit QT and Sailfish
 
QtWidgets are obsolete and you should avoid them. You should use QML or implement your UI in code with Qt Quick in mind. Also, by using QML you will automaticaly use HW accelarated graphics engine.

trx.

finfly 2013-12-09 15:06

Re: Getting started whit QT and Sailfish
 
Bit more digging and I found PySide! Now I only need to fresh up my memories of Phyton.

http://qt-project.org/wiki/Category:...ndings::PySide

finfly 2013-12-10 17:35

Re: Getting started whit QT and Sailfish
 
Oh, I'm afraid I need little more help tackling the learning curve.I have zero UI experience -engineering way was to do it in command line.

I have found no way to link my python code to Sailfish qml. For example my python code has line:
Code:

def kysy_vuosi():
print "Hello year 1582."

How I can get it show on firstpage.gml?

Any help (and patience) is well appreciated.

rcolistete 2013-12-10 18:07

Re: Getting started whit QT and Sailfish
 
Look at here about Python on Sailfish :
https://lists.sailfishos.org/piperma...er/001593.html

solbrit 2014-04-01 13:18

Re: Getting started whit QT and Sailfish
 
Say I have a page stack which from bottom to top goes "a.qml" -> "b.qml" -> "c.qml".

- pageStack.push(Qt.resolvedUrl("b.qml")) will get me from a to b
- pageStack.pop() will take me back from b to a

However nothing happens when I try giving pop a page argument, ie going from a to b, then from b to c, and then from c going DIRECTLY back to a with:

- pageStack.pop(Qt.resolvedUrl("a.qml"))

Why is this? How can I go directly back to the first page?

marxian 2014-04-01 16:26

Re: Getting started whit QT and Sailfish
 
Quote:

Originally Posted by solbrit (Post 1419443)
Say I have a page stack which from bottom to top goes "a.qml" -> "b.qml" -> "c.qml".

- pageStack.push(Qt.resolvedUrl("b.qml")) will get me from a to b
- pageStack.pop() will take me back from b to a

However nothing happens when I try giving pop a page argument, ie going from a to b, then from b to c, and then from c going DIRECTLY back to a with:

- pageStack.pop(Qt.resolvedUrl("a.qml"))

Why is this? How can I go directly back to the first page?

The problem here is that you are passing a new instance of the component defined in "a.qml" as the first argument to pop(). Instead, it should be an existing instance. You can also pass null if you want to return to the first page, e.g.

Code:

pageStack.pop(null)
To pop to an existing page, you pass the id, e.g

Code:

pageStack.pop(myPage)
In many cases, myPage will not be in scope, so you can use the find() function to find a page.

solbrit 2014-04-01 17:07

Re: Getting started whit QT and Sailfish
 
Thanks for your answer! However pop(null) will in my case do the same as pop(), ie go back one step only. I'll look into find()...

solbrit 2014-04-01 22:43

Re: Getting started whit QT and Sailfish
 
Using find() at best I get the same result as with pop() and pop(null), it'll pop the top most page off, but not more.

Edit: As a workaround I thought I'd try clear() and then push the first page, but no luck so far. The stack is cleared allright, but I'm not sure how to push the first page after that..

solbrit 2014-04-04 07:30

Re: Getting started whit QT and Sailfish
 
Okay, keeping it simple I made this experiment:
1: I create the basic app in SDK
2: I create a new qml page "ThirdPage.qml"
3: I pretty much copy the "FirstPage.qml" contents to "SecondPage.qml" and "ThirdPage.qml", changing the PullDownMenus' MenuItem to:

SecondPage.qml:
Code:

MenuItem {
    text: "Show Page 3"
    onClicked: pageStack.push(Qt.resolvedUrl("ThirdPage.qml"))
}

ThirdPage.qml:
Code:

MenuItem {
    text: "Show Page 1"
    onClicked: pageStack.pop(null)
}

So, even in this basic test the "pageStack.pop(null)" on "ThirdPage" only pops off one page, uwinding to "SecondPage", when it ought to take you back to the "FirstPage" (stack bottom). Why doesn't it? What am I doing wrong? Or is it a bug? If I remember correctly this is the way I did it in Harmattan, but in Sailfish it doesn't work... :(


All times are GMT. The time now is 12:42.

vBulletin® Version 3.8.8