Reply
Thread Tools
Posts: 301 | Thanked: 531 times | Joined on Aug 2010 @ The Netherlands
#61
Unfortunately, I couldn't manage to bind the C++ and QML properly. In the end, I did all the RegExp work in php, and made it available at a web server. So then I could just work with QML-only code. I'm happy I got something working, and submitted it to Harbour just before Christmas.
Thanks for the help!
__________________
Palm Treo -> N900 -> N9 -> Jolla -> SailfishX -> XA2
Developer mode novice, and enjoying it
 

The Following User Says Thank You to rob_kouw For This Useful Post:
Posts: 301 | Thanked: 531 times | Joined on Aug 2010 @ The Netherlands
#62
I am struggling with some icons, shown in the PhotoDelegate. Do you have experience with the behaviour of icons in light Ambiences vs. dark Ambiences?

Thanks, Rob

Below: the problem.

Bottom layer is a rectangle. With a light Ambience, the rectangle must be darker to show a nice photo. Works properly.
Code:
    Rectangle {
        id: photoRect
        anchors {
            fill: parent
        }
        color: "black"
        opacity: Theme.colorScheme == 0  ? 0.65 : 0.9
    }
On top of this rectangle is the photo, works fine too.

Then in the upper right corner I show the logo of the broadcasting company as an IconButton. For dark Ambiences, it works fine. But for light Ambiences, something strange happens. Basically, I want to show the same logo. But a svg file with a white image, 0.40 opacity, will be shown as very dark grey, so like the inverse of the normal svg.

Code:
        IconButton {
            id: showBroadcast
            icon.source: (site === "NOS")
                             ? ( Theme.colorScheme == 0  ? Qt.resolvedUrl("images/icon-nos.svg") : Qt.resolvedUrl("images/icon-nos-light.svg") )
                             : ( Theme.colorScheme == 0  ? Qt.resolvedUrl("images/icon-the-guardian.svg") : Qt.resolvedUrl("images/icon-the-guardian-light.svg") )
            anchors {
                top: parent.top
                right: parent.right
            }

            onClicked: ExternalLinks.browse(link)
        }
Other tests performed: a logo of black with 1.0 opacity goes black. A logo of white with 1.0 opacity goes black. A logo with some red in it will show as grey.

As a workaround I could work with rectangle, mousearea and image, I guess...
__________________
Palm Treo -> N900 -> N9 -> Jolla -> SailfishX -> XA2
Developer mode novice, and enjoying it
 

The Following 2 Users Say Thank You to rob_kouw For This Useful Post:
coderus's Avatar
Posts: 6,436 | Thanked: 12,700 times | Joined on Nov 2011 @ Ängelholm, Sweden
#63
Nowadays Icon* stuff in sfos using HighlightImage magic underneath to properly adjust monochrome icons for dark/light ambiences. Try using just monochrome white image and check if it magically convert to black in light ambience?
__________________
Telegram | Openrepos | GitHub | Revolut donations
 

The Following 4 Users Say Thank You to coderus For This Useful Post:
Posts: 34 | Thanked: 30 times | Joined on Nov 2011
#64
hello guys, maybe stupid question, maybe I did not judt find it.. is there proper reaction/signal on change of the OS's ambience?
 

The Following 2 Users Say Thank You to bobsikus For This Useful Post:
Posts: 301 | Thanked: 531 times | Joined on Aug 2010 @ The Netherlands
#65
Might be somewhere in Theme...
Theme.colorScheme == 0 stands for a dark Ambience.
__________________
Palm Treo -> N900 -> N9 -> Jolla -> SailfishX -> XA2
Developer mode novice, and enjoying it
 

The Following 2 Users Say Thank You to rob_kouw For This Useful Post:
coderus's Avatar
Posts: 6,436 | Thanked: 12,700 times | Joined on Nov 2011 @ Ängelholm, Sweden
#66
Originally Posted by rob_kouw View Post
Might be somewhere in Theme...
Theme.colorScheme == 0 stands for a dark Ambience.
there are constants available:
Code:
Theme.LightOnDark
Theme.DarkOnLight
https://github.com/CODeRUS/better-sa...qmltypes#L1472

But if initial question was about actual ambience change, there is an example in sailfish code: https://github.com/CODeRUS/better-sa...indow.qml#L225
__________________
Telegram | Openrepos | GitHub | Revolut donations
 

The Following 4 Users Say Thank You to coderus For This Useful Post:
Posts: 34 | Thanked: 30 times | Joined on Nov 2011
#67
coderus: yes exactly, I have found that colorScheme is defined, only the reaction to that I had not found. Thanks a lot, I will look at it

EDIT: Thanks a lot, works

Code:
    import Sailfish.Silica.private 1.0

    ThemeTransaction {
        onAmbienceAboutToChange: doStuff() ;
    }

Last edited by bobsikus; 2020-01-10 at 09:40.
 

The Following 2 Users Say Thank You to bobsikus For This Useful Post:
coderus's Avatar
Posts: 6,436 | Thanked: 12,700 times | Joined on Nov 2011 @ Ängelholm, Sweden
#68
Originally Posted by bobsikus View Post
coderus: yes exactly, I have found that colorScheme is defined, only the reaction to that I had not found. Thanks a lot, I will look at it
if you want to detect color scheme change then bind it to property and watch onPropertyChanged
__________________
Telegram | Openrepos | GitHub | Revolut donations
 

The Following 3 Users Say Thank You to coderus For This Useful Post:
Posts: 34 | Thanked: 30 times | Joined on Nov 2011
#69
Originally Posted by coderus View Post
if you want to detect color scheme change then bind it to property and watch onPropertyChanged
I needed reaction of ambience change to do stuff I need it to do (change some colors based on if the ambience is actually dark or light, because buttons and text to buttons were based on that), If I will do it by binding, it would probably be a little bit less needy for system resources (don't do it everytime, do it only if this changes), so good point

EDIT: works!
Code:
    property real themeType: Theme.colorScheme

    onThemeTypeChanged: console.log ("AmbienceChange");

Last edited by bobsikus; 2020-01-10 at 09:40.
 

The Following 2 Users Say Thank You to bobsikus For This Useful Post:
Posts: 301 | Thanked: 531 times | Joined on Aug 2010 @ The Netherlands
#70
Originally Posted by coderus View Post
there are constants available:
Code:
Theme.LightOnDark
Theme.DarkOnLight
https://github.com/CODeRUS/better-sa...qmltypes#L1472
Ooh, nice. Thanks, it will clarify my code some more.
__________________
Palm Treo -> N900 -> N9 -> Jolla -> SailfishX -> XA2
Developer mode novice, and enjoying it
 

The Following 2 Users Say Thank You to rob_kouw For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 22:57.