Ask / Submit
3

IconButton.source (Image) not recognized in QtCreator

asked 2018-12-19 14:20:42 +0300

Tanghus gravatar image

updated 2018-12-20 01:42:53 +0300

I use an IconButton to allow the user to play back alarm sounds:

IconButton { 
    icon.source: sound.playbackState === Audio.PlayingState 
        ? "image://theme/icon-m-pause"  
        : "image://theme/icon-m-play";  
    onClicked: {  
        sound.source = selectedSound;  
        if(sound.playbackState === Audio.PlayingState) {  
            sound.stop();  
        } else {  
            sound.play();  
        }  
    }  
}

image description

As can be seen, the editor "doesn't know" about the source Image.

The rendering error with sound.source: selectedSound; in the screen shot is fixed.

I have no idea why the code rendering is so flawed here..?

edit retag flag offensive close delete

Comments

1

In my app Fast Chess I have the icon.source error in SDK also. For me it seems to be only SDK problem. The validator doesn't claim against that nor it doesn't prevent the app to be accepted in the Harbour. I do not notice any effect on the app performance. The only problem seems to be that irritative message.

Rikujolla ( 2018-12-19 21:00:54 +0300 )edit

2 Answers

Sort by » oldest newest most voted
1

answered 2018-12-19 14:57:49 +0300

Edz gravatar image

updated 2018-12-19 15:35:59 +0300

Original comments edited as the question was partly answered by Allstar12345

import Sailfish.Media 1.0 should sort the icon.source: error......

edit flag offensive delete publish link more
0

answered 2018-12-19 14:54:17 +0300

It's actually the " sound.source: selectedSound;" from onClicked causing that issue from a quick look, I assume you meant to type sound.source = selectedSound; instead of the ":"

edit flag offensive delete publish link more

Comments

Yes, that was an error. Fixed. Thanks :) But the issue with icon.sourcestill exists.

Tanghus ( 2018-12-19 14:57:33 +0300 )edit

What import are you using ?

If you have a rouge import like QtQuick controls it could knock it off

Allstar12345 ( 2018-12-19 15:00:20 +0300 )edit

@Allstar12345

import QtQuick 2.6

import QtMultimedia 5.6

import Sailfish.Silica 1.0

import Sailfish.Pickers 1.0

Tanghus ( 2018-12-19 15:02:40 +0300 )edit

Try the comment from Edz for the icon source, for the media a long shot but do you have QT += multimedia in your .pro, just in case

Allstar12345 ( 2018-12-19 15:07:01 +0300 )edit

@Allstar12345@Edz apparently deleted his comment again. He suggested also importing Sailfish.Media 1.0 and that actually fixes the icon.source issue, even though there is a warning about the import.

screenie

Tanghus ( 2018-12-19 15:19:30 +0300 )edit
Login/Signup to Answer

Question tools

Follow
2 followers

Stats

Asked: 2018-12-19 14:20:42 +0300

Seen: 174 times

Last updated: Dec 20 '18