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)

coderus 2020-08-28 22:56

Re: Help me to code for Sailfish OS
 
i dont know a way to do this in pure qml without c++ code

rob_kouw 2020-08-31 15:10

Re: Help me to code for Sailfish OS
 
2 Attachment(s)
Alright. Well, I looked at c++ and didn't know how to implement it. So I just leave it for now.

Another question then. The first page looks awful in Landscape. It seems the height is still as high as in Portrait. One level deeper is normal behavior, but one level deeper it is also strange.

First page is here: https://github.com/cow-n-berg/harbou...CachesPage.qml

I think I don't mess around with any height, only for the ListItem. How can it happen?

Markkyboy 2020-09-01 10:43

Re: Help me to code for Sailfish OS
 
Quote:

Originally Posted by rob_kouw (Post 1569012)
Alright. Well, I looked at c++ and didn't know how to implement it. So I just leave it for now.

First page is here: https://github.com/cow-n-berg/harbou...CachesPage.qml

I think I don't mess around with any height, only for the ListItem. How can it happen?

I note from your CachesPage.qml you have set allowedOrientations to Portrait only, perhaps to add Landscape also. I'm not sure if this will fix the problem, but it can't be helping.

rob_kouw 2020-09-01 20:35

Re: Help me to code for Sailfish OS
 
Quote:

Originally Posted by Markkyboy (Post 1569018)
I note from your CachesPage.qml you have set allowedOrientations to Portrait only, perhaps to add Landscape also. I'm not sure if this will fix the problem, but it can't be helping.

Thanks for helping! Right, I decided to limit this CachesPage to Portrait, after I wrote the question above. Apologies for the miscommunication.

Markkyboy 2020-09-01 21:16

Re: Help me to code for Sailfish OS
 
I have a similar problem with landscape with regard to positioning items.

This is editing directly on the device not in SDK, where I know Lipstick is not allowed.

A few years back, we could do the following for rotating items when in landscape;

HTML Code:

import QtQuick 2.0
import Sailfish.Silica 1.0
import Sailfish.Lipstick 1.0 <----- import Lipstick
import "weather.js" as WeatherData

Grid {
    id: labels

    property bool rotated: {    <----add this
        Lipstick.compositor.topmostWindowOrientation &
        (Qt.LandscapeOrientation | Qt.InvertedLandscapeOrientation)
    }

    rows: 2
    columns: 2

    // rotated ? landscape : portrait
    rowSpacing: rotated ? 270 : 580    < -----and adjust this with the 'rotated' property
    columnSpacing: rotated ? 500 : 170

    anchors.centerIn: parent

The above is just a snippet to show the added code which used to work in nearly any file, but now it is not working. I get the following error;

Code:

[W] unknown:10 - file:///usr/share/wind-dash/qml/pages/Labels.qml:10: ReferenceError: Lipstick is not defined
Has something changed?, how can I work around this?, I would like my grid of labels to change position when the app is viewed in landscape.

coderus 2020-09-01 21:35

Re: Help me to code for Sailfish OS
 
you want rotation but dont want to rotate page? use rotation sensor.

Markkyboy 2020-09-01 21:54

Re: Help me to code for Sailfish OS
 
Quote:

Originally Posted by coderus (Post 1569033)
you want rotation but don't want to rotate page? use rotation sensor.

are you replying to me coderus?

coderus 2020-09-01 21:54

Re: Help me to code for Sailfish OS
 
correct [10 chars]

Markkyboy 2020-09-01 21:57

Re: Help me to code for Sailfish OS
 
Quote:

Originally Posted by coderus (Post 1569035)
correct [10 chars]

then you totally misunderstand my question. I did not include any information about page rotation as my app already rotates to landscape.

The problem is, my row and column spacings are not changing position when turned to landscape. The code I posted previously allowed me to do just that, now it does not work.

Markkyboy 2020-09-02 16:14

Re: Help me to code for Sailfish OS
 
2 Attachment(s)
Okay,

I've found another way to achieve my goal.

I took a good look in `/usr/lib/qt5/qml/Sailfish/Lipstick` and found some code pertaining to rotation/rotating items; `isLandscape` does the job, so the code now looks like this;

Code:

import QtQuick 2.0
import Sailfish.Silica 1.0
import "weather.js" as WeatherData

Grid {
    id: labels
    rows: 2
    columns: 2

    rowSpacing: isLandscape ? 270 : 580
    columnSpacing: isLandscape ? 500 : 170

    anchors.centerIn: parent

No need for import statements or additional properties, time to tidy up other aspects of this 'wind dashboard'.


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

vBulletin® Version 3.8.8