We have moved to a new Sailfish OS Forum. Please start new discussions there.

[question]Pure C++ Sailfish documentation

asked 2015-01-26 21:20:57 +0200

NeWin gravatar image

updated 2015-03-06 09:38:15 +0200

eric gravatar image

Hi all sailfish community,

That can be weird for a lot of you guys but for some I feel way much more comfortable with C++ than qml. Maybe because I've deeply investigate C++, maybe because of my work on hi-performance computing, may be because of it's flexibility. And in fact I just don't like qml... I don't really know why I just don't like it, even after 3 continuous day of learning it.

But the problem is I did not find any tutorial or any "getting started" that only use C++, everyone on internet follow the classic way which it "a little bit C++ and a lot qml"

So my 2 questions are:

1) is this possible to write an app only in C++ and have beautiful sailfish component ?

2) Where can I find something that look like a little doc about how to write it

PS: I've barely never touched QT so I don't really know if I can just traduce qml into C++ or things like this

edit retag flag offensive close delete



you probably better ask on sailfish development mailing list devel@lists.sailfishos.org

virgi26 ( 2015-01-26 23:57:31 +0200 )edit

@NeWin I totally agree with you, I hate managed code in all of its aspects and I always code desktop applications with nothing but C++. Thankfully Qt allows to create amazing UIs with nothing but C++ (this functionality is now moved into a separate module called QtWidgets, but it still works), so essentially everything you can do with QML you can also do with C++/Qt. It's a real pity that you can't create a proper UI on mobile devices this way.

ScumCoder ( 2015-02-13 23:35:55 +0200 )edit

2 Answers

Sort by » oldest newest most voted

answered 2015-01-26 22:31:11 +0200

I'm not sure if I understand you correctly but I assume that you mean "write a lot of C++ and a little bit QML" in contrast to "a little bit C++ and a lot qml".

1) Yes it is possible. To get the beautiful Sailfish UI component you have to use the Sailfish Silica QML component and QML to define the application UI.

2) Qt documentation is very extensive. You can start by reading Integrating QML and C++. C++ and QML can communicate in various ways.

I have actually coded all my apps for Sailfish OS mostly in C++. I don't particularly like writing apps in pure QML but some things are just faster and easier to implement at the QML side so the end result is often a balanced mix of C++ and QML (+ Javascript).

edit flag offensive delete publish link more



An other way to ask my question can be "Can I write a sailfish app WITHOUT any qml" I know I can have the silica component in QML (all docs and tutorial are about that) and I know and understant most people prefer a good balance between QML C++ and sometime javascript but for some reason I don't like it (and "I don't like it" doesn't mean "it's bad from my point of view", I just don't like it...) so my question was about how to avoid qml (even if most people will think i'm dumb)

NeWin ( 2015-01-26 22:58:46 +0200 )edit

As @mikelima already answered:

1) You can get the Sailfish UI only by using Silica and QML. So the answer for the number one is no.

2) What comes to number 2, you could use SDL2 but it's mainly targeted towards game development as well as many other similar libraries/engines.

skvark ( 2015-01-27 19:11:47 +0200 )edit

There is absolutely no way to create a pulley menu or use the page stack in C++ ? =/ I'm pretty disappointed, so I think I will never make an sailfish app because of that... thank you for your answer

NeWin ( 2015-01-27 19:40:50 +0200 )edit

answered 2015-01-27 00:17:45 +0200

mikelima gravatar image

updated 2015-01-27 10:28:38 +0200

If your application needs a GUI that blends with the OS, qml is mandatory. If you do not care for that, you can create it with c++ or c alone. But you will have to develop your interface on your own. The best bet in this case is to use the SDL library, at least if you want to distribute your application n the Jolla store, as qtgui is blacklisted.

edit flag offensive delete publish link more



I'm pretty surprised (and disappointed) there is no way to get things like pulley menu page stack etc... in C++ but thank for your answer.

NeWin ( 2015-01-27 19:43:00 +0200 )edit
Login/Signup to Answer

Question tools



Asked: 2015-01-26 21:20:57 +0200

Seen: 1,268 times

Last updated: Jan 27 '15