How to call/open another page/application from within a QML file?
Using 'Qt.openUrlExternally works in some cases, like sending an email by using 'mailto:' but the same cannot be said for opening files, like say a 'jpg' or a page from an application. This works, as an example for 'mailto'; Code:
MouseArea { I am unable to open any .desktop file using Qt.openUrlExternally or pageStack.push methods - yet from shell, I can open jolla-clock a few ways, but not from within another file. What am I missing here? As an example, this works from within a QML file; (it opens the settings dialog for the given application) Code:
MouseArea { Any ideas of pointers for basically being able to open a page of one application from another. I have trawled many pages and found conflicting/old/dead end information, barely any of which relates to SFOS. |
Re: 'pageStack.push(Qt.resolvedUrl())
Bump!
I'd like to know the answer to this too, out of interest. Does it work for pages that have no C++ objects? If you place a really simple qml file in your home directory, can you push it? |
Re: 'pageStack.push(Qt.resolvedUrl())
I don't understand your questions. I wouldn't recognise C++ from a kick in the balls or how to 'push' a file from 'home'..?, can you explain more in layman terms please...?
|
Re: 'pageStack.push(Qt.resolvedUrl())
Qt.openUrlExternally("/usr/share/applications/jolla-clock.desktop")
works for me |
Re: 'pageStack.push(Qt.resolvedUrl())
coderus, where do you place the code to test it?
|
Re: 'pageStack.push(Qt.resolvedUrl())
did you tried also this way ?
Code:
Qt.resolvedUrl("file:///path/to/your.qml") |
Re: 'pageStack.push(Qt.resolvedUrl())
Hi Schturman, thanks for replying, but no, that doesn't seem to work either. I don't understand, but I'm really pleased it works for coderus. ;)
|
Re: 'pageStack.push(Qt.resolvedUrl())
Quote:
Quote:
Some of those applications have data structures and classes defined in C++ that are included in the QML file so that the objects can be initialised and used from QML. Sometimes the objects the application needs for the backend are created when the first qml page is loaded, like in hammerhead torch, which initialises the LEDControl object in harbour-hammerhead-torch.qml, and then uses it in other pages like MainPage.qml by referring to it by its id ("led"). I don't think MainPage.qml from hammerhead torch would work if you just loaded it directly, because "led" wouldn't refer to anything. I don't know if that means it wouldn't load at all, or if the page would load with errors. When I said push a page I was talking about the page stack ("pageStack.push"), and home was referring to /home/nemo (a convenient place to place a test qml file). |
Re: 'pageStack.push(Qt.resolvedUrl())
Okay, thanks for clarification (I'm still learning!).
I'm not actually making an application, i'm simply editing existing files and seeing what happens, basically fishing for ideas to customise my device. In this case, I wanted to go directly to the alarm dialog page by tapping on the time on lockscreen. This means, I have directly edited Clock.qml, found in '/usr/share/lipstick-jolla-home-qt5/lockscreen/*'. To make this happen, I used MouseArea to make the time clickable and it opened the application settings for Openrepos-clock-settings (a .qml file) - success!, but when it comes to opening say, a file or desktop file, nothing happens. |
Re: 'pageStack.push(Qt.resolvedUrl())
Much more info now.
Inside lipstick you cant use openUrlExternally you should create Code:
LauncherItem { |
All times are GMT. The time now is 20:13. |
vBulletin® Version 3.8.8