Re: [SailfishDevel] pageStack.pop() - send paramater to prev page
You could also create a shared (stateless) JS library which you can use to share variables between different qml documents. /Mikko 2014-06-06 9:47 GMT+03:00 Andrey Kozhevnikov coderusin...@gmail.com: i have an another idea for you: ... var newPage = pageStack.push(Qt.resolvedUrl(newPage.qml), {...}) newPage.done.connect(thisPage.pageDone) ... //thisPage ... function pageDone(var1, var2, var3, ...) { //do something with var } ... //newPage ... signal done(string var1, int var2, string var3, ...) ... //Button ... onClicked: { page.done(something, 123, test, ...) } ... 05.06.2014 22:49, i...@flyingfischer.ch пишет: Hi Chris thanks for this idea and your code example! I am working on app in a very early stage that will partially talk to a remote server and get dynamic content. In some cases it even will create a little bit of traffic... ...so I will stick for the moment with the solution provided by Konstantin. Regarding the use of Dialog: I come from the Java world and am an absolute newbie on QT. I couldn't figure out how this would work. The documentation from Sailfish OS || QT is not very clear about this, at least not for me. ...but I intend to learn and will certainly restudy the docu and try to check out other use cases from other apps, untill I get it ;-) Thanks to anybody! Markus Am 05.06.2014 16:40, schrieb Christopher Lamb: Hi Markus In my app I chose to instantiate all my Pages in the same place. Each of the pages has a declaration in a separate qml file (e.g. MainPage.qml, AreaSelectionPage.qml). With this architecture none of the declarations need to know about the previous or next page. It is not their concern. Instead they emit signals NextPage, BackPageWithInfo, and Cancelled. In the signal handler in the page instantation I do the actual pushing and popping, and because all pages are instantiated in the same scope, they are all available to be pushed / popped to. (see code example below). The downside is that all the pages are created on startup (regardless of if they are ever visited). For lightweight pages this is not a problem, but for some pages this might be a problem. For these I dynamically create the page content when the page is visible. Grüsse Chris ApplicationWindow { id: appWindow ... initialPage: mainPage MainPage { id: mainPage onNextPage: { if (pageType ==SMS) { console.log(smsType is: + smsType) if (smsType ==Default) pageStack.push(smsPage, {lati: mainPage.getLati(), longi: mainPage.getLongi(), alti: mainPage.getAlt i(), area_id: area_id, template_id: template_id, msg_status: msg_status, lastPage: mainPage}) } else { pageStack.push(areaSelectionPage) } } } AreaSelectionPage { id: areaSelectionPage onBackPageWithInfo: { mainPage.areaSet = true; mainPage.area_id = area_id; pageStack.pop(mainPage); } onCancelled: pageStack.pop(mainPage); } SMSPage { id: smsPage onNextPage: { pageStack.push(contactSelectionPage, {area_id: area_id, template_id: template_id}) } } ContactSelectionPage { id: contactSelectionPage onBackPageWithInfo: { console.log(About to pop smsPage; contactName: + contactName + , contactPhone: + contactPhone); smsPage.contactName = contactName; smsPage.contactPhone = contactPhone; smsPage.lastPage = contactSelectionPage; pageStack.pop(smsPage); } onCancelled: pageStack.pop(smsPage); } } On 05.06.14 14:43, i...@flyingfischer.ch wrote: Thanks for your inputs! Calling PreviousPage.topic = MyTopic; pageStack.pop(); gives me a ReferenceError: PreviousPage is not defined. PreviousPage.qml and property string topic do exist. Thanks for your patience! Markus ___ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org ___ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscribe@lists. sailfishos.org ___ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscribe@lists. sailfishos.org ___ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscribe@lists. sailfishos.org ___ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
Re: [SailfishDevel] Technical question: populating ListModel from C++
Hi, Or if you don't want to subclass e.g. qabstractitemmodel, you can always return a QVariantList(or QList) from c++ and expose that sequence to QML. Then use that JS array to populate ListModel. /Mikko 2014-05-23 10:53 GMT+03:00 Markus Svensson markus.svens...@me.com: Hi, I have done the same thing in my Sailfish learning project. It was way more complicated than I would have liked it to be (or maybe I did it in the wrong way...). Feel free to have a look at how I implemented it: https://github.com/Ortofta/SilicaNote The code quality is probably not the best - these are my first baby steps in QT and Sailfish. ;) Regards, Markus 23 maj 2014 kl. 08:52 skrev Kimmo Lindholm kimmo.lindh...@eke.fi: Hi,, Thank you Janne and Jarko, I will take a look on both of these approaches; use the QSqlQueryModel in your c++ and expose that to QML ; just like in : http://qt-project.org/wiki/How_to_use_a_QSqlQueryModel_in_QML subclassing QAbstractItemModel. See http://qt-project.org/doc/qt-5/qtquick-modelviewsdata-cppmodels.html and http://qt-project.org/doc/qt-5/qabstractitemmodel.html to get started. -kimmo ___ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org ___ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org ___ SailfishOS.org Devel mailing list To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org
Re: [SailfishDevel] QML C++ Integration not working in Sailfish
Hi, Try creating Bloomfilters class instance before declaring view, and store app and view either to qscopedpointer or qsharedpointer. /Mikko 2014-02-26 13:15 GMT+02:00 antonio.cano.go...@ovi.com: Hi Thomas, I did both modification but the code does not work yet. Here is the new code: QGuiApplication *app = SailfishApp::application(argc, argv); QQuickView *view = SailfishApp::createView(); Bloomfilters * bloomfilters = new Bloomfilters(); view-rootContext()-setContextProperty(bloomfiltersdata, bloomfilters); view-setSource(SailfishApp::pathTo(qml/bloomfilter.qml)); view-showFullScreen(); return app-exec(); El Miércoles 26 de febrero de 2014 12:01, Thomas Perl th.p...@gmail.com escribió: On 2014-02-26 11:48, antonio.cano.go...@ovi.com wrote: I tried this: QGuiApplication *app = SailfishApp::application(argc, argv); QQuickView *view = SailfishApp::createView(); Bloomfilters * bloomfilters = new Bloomfilters(); view-setSource(SailfishApp::pathTo(qml/bloomfilter.qml)); view-showFullScreen(); view-rootContext()-setContextProperty(Bloomfilters, bloomfilters); return app-exec(); But it is not working yet. Two things: 1. Call setContextProperty() right before before setSource(), so it's already available when the QML content is loaded. 2. Use lowercase for context property names (bloomfilters instead of Bloomfilters). In some places, QML interprets IDs starting with an upper case letter as a type name, and that won't work then, therefore stick to lowercase. HTH :) Thomas ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] ComboBox with many MenuItems
Hi, Look at the thread: http s ://www.mail-archive.com/devel@lists.sailfishos.org/msg02026.htmlhttp://www.mail-archive.com/devel@lists.sailfishos.org/msg02026.html /Mikko 2014/1/22 Franck Routier (perso) a...@mecadu.org Hi, I have a ComboBox with MenuItem. OnClicked, each MenuItem updates a value in a component of my page. So far, so good. But when adding more item, the menu list is displayed on a second page. I can choose an item, but the inClicked function does not act as it does with less items (and the standard behaviour of the menu). Putting a console.log(called) in onClicked does not output anything either... So, is this expected, and what is the trick to get my action triggered when a one in many MenuItem of a ComboBox is selected ? BR, Franck ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] Does BackgroundItem not accept all elements?
Hi, Define some height for the separator item. /Mikko 2014/1/22 Gabriel Böhme m.gabrielboe...@googlemail.com Hi sailors, I have a ListView and want to create a delegate for it. So I use the BackgroundItem as Silica Documentation recommend, but it seems, that the BackgroundItem is not accepting all elements. Easy example: BackgroundItem { id: background highlightedColor: Theme.secondaryHighlightColor onClicked: { console.log(clicked: +index) } Column { id: background_content spacing: Theme.paddingSmall width: parent.width TextEdit { text: tmdb_title color: Theme.highlightColor font.pixelSize: Theme.fontSizeMedium wrapMode: TextEdit.Wrap readOnly: true } Label { text: Released: +tmdb_release_date color: Theme.primaryColor font.pixelSize: Theme.fontSizeMedium } Separator { width: parent.width color: Theme.highlightColor } } In this case the BackgroundItem just accepts the TextEdit and the Label, but not the Separator. Which can be seen by clicking it. Setting the contentHeight, does not change this behavior, it's just results in not showing the highlighted color anymore. Do I miss something? Whats wrong here? Thanks, Gabriel. ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] Does BackgroundItem not accept all elements?
Hi, Okay, you could try defining a width and height directly for the background item: BackgroundItem { id: background width: parent.width height: background_content.childrenRect.height ... } /Mikko 2014/1/22 Google Mail m.gabrielboe...@googlemail.com This makes the Separator line just thicker, but do not help. I have the same problems also with Image - with explicitly set height or not. Or Column with nested Row. For now I created my own delegate, don't know what's wrong, but maybe some elements are not recognised as children?! Gabriel. *Von: *Mikko Leppänen *Gesendet: *Mittwoch, 22. Januar 2014 13:15 *An: *Sailfish OS Developers *Antwort an: *Sailfish OS Developers *Betreff: *Re: [SailfishDevel] Does BackgroundItem not accept all elements? Hi, Define some height for the separator item. /Mikko 2014/1/22 Gabriel Böhme m.gabrielboe...@googlemail.com Hi sailors, I have a ListView and want to create a delegate for it. So I use the BackgroundItem as Silica Documentation recommend, but it seems, that the BackgroundItem is not accepting all elements. Easy example: BackgroundItem { id: background highlightedColor: Theme.secondaryHighlightColor onClicked: { console.log(clicked: +index) } Column { id: background_content spacing: Theme.paddingSmall width: parent.width TextEdit { text: tmdb_title color: Theme.highlightColor font.pixelSize: Theme.fontSizeMedium wrapMode: TextEdit.Wrap readOnly: true } Label { text: Released: +tmdb_release_date color: Theme.primaryColor font.pixelSize: Theme.fontSizeMedium } Separator { width: parent.width color: Theme.highlightColor } } In this case the BackgroundItem just accepts the TextEdit and the Label, but not the Separator. Which can be seen by clicking it. Setting the contentHeight, does not change this behavior, it's just results in not showing the highlighted color anymore. Do I miss something? Whats wrong here? Thanks, Gabriel. ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] QML Timer stops running
Hi, I don't know but perhaps you can use qtsensors(e.g. tapsensor) in order to track/register some special event indicating that the phone is live again. -Mikko 2014/1/15 Luca Donaggio donag...@gmail.com I'm in a similar situation: I've written a small app for my personal use that periodically download some stats from one of my company's web servers. I'm perfectly fine with it not doing anything while in deep-sleep, but I would like to do a forced update as soon as the device wakes up. How can I detect such event from C++ side (my app is run as a daemon actually, so no qml involved)? Is there some DBus signal I can listen to? Thanks, Luca Donaggio On Wed, Jan 15, 2014 at 9:26 AM, Jonni Rainisto jonni.raini...@jolla.comwrote: Hi, For the love of ***, dont use libiphb every 5 seconds, that will kill batterylife for suspend (store QA will reject apps that eat battery). Its more meant to be triggered every 10, 15, 30 etc. minutes. So if you want to make 25 minute timer that works even while suspended, then you should do libiphb to wake up after 25 minutes. Or if you want to make libiphb to wake up device every 10 minutes, you can make your application to check how much time has really passed since last wakeup by checking hw clock (as that is the only clock which is updated even while beeing suspended) timestamps like this: static void tv_get_monotime(struct timeval *tv) { #if defined(CLOCK_BOOTTIME) struct timespec ts; if (clock_gettime(CLOCK_BOOTTIME, ts) 0) if (clock_gettime(CLOCK_MONOTONIC, ts) 0) qFatal(Can't clock_gettime!); TIMESPEC_TO_TIMEVAL(tv, ts); #endif } From: devel-boun...@lists.sailfishos.org [ devel-boun...@lists.sailfishos.org] on behalf of Thomas Tanghus [ tho...@tanghus.net] Sent: Tuesday, January 14, 2014 4:11 PM To: Sailfish OS Developers Subject: Re: [SailfishDevel] QML Timer stops running On Tuesday 14 January 2014 13:05 Graham Cobb wrote: On 14/01/14 01:14, Thomas Tanghus wrote: On Tuesday 14 January 2014 01:53 Ove Kåven wrote: No matter what OS or platform you're on, counting the number of times your timer callback is called is *never* a good idea, even on desktop PCs. Timer callbacks can be skipped for any number of reasons (heavy system load, laptop suspend, etc). Good point. That will also at least work around the issue when in pre-deep- sleep. I agree with Ove (that is how every timer function I have ever worked on works, from interrupt handlers in embedded system kernels through to the GPE Calendar app) -- repeating timers are a convenience, but are never treated as accurate. But I would also suggest that for any apps that do timing, when the app is not being displayed (and so the screen doesn't need to be updated), the code should switch to using a single-shot timer set to the time when the next event happens, instead of using repeating timers. If the kitchen timer is set for 25 minutes and the screen is blank you don't want your app waking up every second. Of course, it is a little bit tedious to write the code to cancel the long timer and restart short timers when the screen is turned back on but the user will thank you for it. It sounds like a good idea, and should be fairly easy to implement. I just don't know how to detect when the screen is off (this is my first baby-steps in mobile coding). We have the applicationActive property, but the cover can still be active and visible while it is false. Unfortunately, I have no idea how you actually set up a single shot timer that will fire correctly in deep sleep from the Qt environment (the last time I implemented that logic was on Maemo). Rainisto pointed to libiphb[1] which I have now implemented with a crude wakeup every 5-10 seconds. Not optimal, but I'm OK with it for v 0.1.1 ;) [1] http://talk.maemo.org/showpost.php?p=1401318postcount=2 -- Med venlig hilsen / Best Regards Thomas Tanghus ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list -- Luca Donaggio ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] Request for modern C++ compiler in the SailfishOS SDK
Hi, I agree. It would be good to have an up to date version of gcc, and also support for clang is welcome (better diagnostics, faster compile times and full c++11 conformance). Actually Apple has fully replaced gcc to clang in Xcode 5. I have asked about this from the developer-care but never got any answer. br Mikko Lähetetty iPadista Putze Sven sailfish...@hardcodes.de kirjoitti 30.12.2013 kello 22.45: Hi there, yes the subject is quite a bit provocative :-) When I get it right there is a gcc4.6.4 on the MerSDK virtual machine. An up-to-date version of gcc should be something around 4.8. Usually I am not part of the I must always have the latest version race but with reference to compilers this would be *really* nice to have. Just think of full C++11 support. And as you just mentioned it(*), are there any plans regarding clang as compiler? This thingy produces far better error messages than gcc. BR. Sven P.S.: this is not meant as a rant! (*) I had a clown for breakfast, sorry. ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] Mainloop problem
Hi, Use smart pointers on app, view and udp, and remove those delete statements. -Mikko Mikael Hermansson m...@7b4.se kirjoitti 22.12.2013 kello 20.24: Seems there is no point use the connect signal in normal case? Because the app shall close correct without those. However in my case it was related to that Cover.qml file had errors that made the app mainloop not shutdown correcly. But my other application STILL don't want to shutdown correcly. I have some QML errors so still confused what is wrong... On Sunday 22 December 2013 17.45.53 Mikael Hermansson wrote: Changed to: QObject::connect(app, SIGNAL(lastWindowClosed()), app, SLOT(quit())); still it does not leave mainloop On Sunday 22 December 2013 21.36.47 Andrey Kozhevnikov wrote: use lastWindowClosed signal instead of destroyed and int retval = app-exec(); delete x; delete y; return retval; On 22.12.2013 21:22, Mikael Hermansson wrote: Cant figure out what I am doing wrong but it seems mainloop does not shutdown when using QQuickView like below. And I can't figure out what signal I should conect to? Or more exact what signal is sent from sailfish when app is closed? AFAIK SailfishApp is just a subclass of QQuickView but there is no public API what signals it implements/overrides? [code] QGuiApplication *app = SailfishApp::application(argc, argv); UDPManager *udp = new UDPManager(); QQuickView *view = SailfishApp::createView(); /* FIXME: THIS DOES NOT WORK */ QObject::connect(view, SIGNAL(destroyed()), view, SLOT(QGuiApplication::quit())); view-rootContext()-setContextProperty(version, QString(VERSION)); view-rootContext()-setContextProperty(udp, udp); view-setSource(QString(/usr/share/harbour-push2sail/qml/push2sail .q ml)); view-showFullScreen(); app-exec(); delete app; delete udp; [/code] ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list ___ SailfishOS.org Devel mailing list
[SailfishDevel] ContextMenu doesn't invoke a signal handler
Hi, I have a case where a column contains multiple Comboboxes and each of these boxes have a different number of menuitems inside the Contextmenu. Now everything works fine if the contextmenu only contains a few items and the focus stays on the current page. However when there's more items to be shown and it needs to show the items on a different page, then I'm not able get the contextmenu to invoke onActivated signal handler (items are listed though). I'm not quite sure what seems to be causing this? This is an older project which I now started to reshape and noticed this issue. At least I get it to work properly in the first release of the SDK. Thanks, Mikko ___ SailfishOS.org Devel mailing list
Re: [SailfishDevel] State is persistent when I come back to a page, how to avoid this ?
Hi, You can try something like: onStatusChanged: { if (status === PageStatus.Activating) { card.state = hide; // card = id for card component } } Add above statement inside the CardPage. HTH, Mikko 2013/12/18 Franck Routier (perso) a...@mecadu.org -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, [Disclaimer: I'm still discovering Qt...] I have a page called CardPage that displays a Card component. Card has two states : show or hide. It will change state when clicked. When first shown, the CardPage sets its Card state to hide. The user can click and show the card. So far so good. Then the user goes back one page, can choose another card among several. When a card is chosen, the CardPage is shown again. But then, the last Card state is applied. I don't want that, I want to force the hide state each time the CardPAge is shown. 1) I don't really understand why/how the Card's state is persisted 2) I need to force the state each time the CardPage becomes active, and I don't know how to do that. Here is some code snippets: CardPage: Page { id: cardPage property string source property string value Column { width: cardPage.width spacing: Theme.paddingLarge PageHeader { title: Your card ! } Card { source: cardPage.source value: cardPage.value relSize: 3 state: hide // -- I want this each time the page is shown anchors.horizontalCenter: parent.horizontalCenter } } } Here is how it is called from my main page (where the user chooses between several cards): delegate: Card { id: myCard source: ico value: val onClicked: { pageLoader.source = CardPage.qml pageLoader.item.source = myCard.source pageLoader.item.value = myCard.value pageStack.push(pageLoader.item) } } Thanks for your help. Franck -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.14 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBAgAGBQJSsXt2AAoJEGEvoAir78RoCQ8IALT5P8OAXOyiW18b9tdCr9Qo oHT5fDZqbUQ3ZRCe1pbrzajnBtmqXgXX2tl8P2weh752AeXhoEF+7pXikfe15YXD Q/hJ9qJbuhyeQFx7wlmE6Lzuq3Y3nWthdgZhHT56XYIj8wbz4GJZdmhxaaHJsLwr 7jID1N0m24OqiNe3QjhaII5VbS1bP81ZwlhQpndDQujcFu31EJvaN23KeB1DtGkm blN+EzDRBUL08cRELszVM7Hb9DlljzOkoSiRMchjQ2rlaSyun/FMUPvYUXYA3rtG YS80YYkDyou9JHvU14c61TnXL3ioXyy+9+5XWzDaXt5FHNE/RrfGApaiELVE8C0= =wp1L -END PGP SIGNATURE- ___ SailfishOS.org Devel mailing list mleppa...@gmail.com ___ SailfishOS.org Devel mailing list
[SailfishDevel] Fail to send an email in Qt
Hi, I'm trying to send an email from my app but the following error messages appear in the application output whenever I attempt to send an email: *void QCopClient::connectToServer() QLocalSocket::ServerNotFoundError QLocalSocket::connectToServer: Invalid name* ** *Could not connect to QCop server; probably not running.* How this could be fixed? Thanks, Mikko ___ SailfishOS.org Devel mailing list
[SailfishDevel] A problem with ComboBox Element
Hi, I need to use the ComboBox element in my project but I can't seem to get it work like it should. The problem is that I'm not able to get the ContextMenu appear and list all the options. According to reference it should open when clicking either a label or value. What I'm doing wrong here? Cheers, - Mikko ___ SailfishOS.org Devel mailing list