Code issue: Button Icon - "source" is not a member of "". (M18) | "i" is declared more than once. (M107)
Hello, can you help with coding problems too ? Sorry I am a noob in coding.... Try to modify a git project for the new SDK 1.24
Sailfish OS SDK 1.24
import QtQuick 2.2
import Sailfish.Silica 1.0
..
...
IconButton {
id: sendButton
anchors.right: parent.right
anchors.bottom: parent.bottom
anchors.bottomMargin: Theme.paddingLarge
icon.source: "image://theme/icon-m-enter-accept" **"source" is not a member of "". (M18)**
tyed this:
IconButton.icon: "image://theme/icon-m-enter-accept"
or
icon: "image://theme/icon-m-enter-accept"
but this did not work.... got this error from app output:
[W] modifyPageStack:113 - Error while modifying page stack: Error: Error while loading page: file:///usr/share/projekt123/qml/pages/ChatPage.qml:40 Non-existent attached object
[D] onError:208 - ERROR: file:///usr/lib/qt5/qml/Sailfish/Silica/PageStack.js:483: Error: Error while loading page: file:///usr/share/project123/qml/pages/ChatPage.qml:40 Non-existent attached object
./SailfishOS/mersdk/targets/SailfishOS-3.0.1.11-i486/usr/lib/qt5/qml/Sailfish/Silica/PageStack.js
481 if (pageComp) {
482 if (pageComp.status == Component.Error) {
483 throw new Error("Error while loading page: " + pageComp.errorString())
484 } else {
485 // instantiate page from component
486 page = pageComp.createObject(container, properties || {})
487 }
another issue:
function stringToColour(str) {
var hash = 0;
for (var i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
var colour = '#';
for (var i = 0; i < 3; i++) { **"i" is declared more than once. (M107)**
var value = (hash >> (i * 8)) & 0xFF;
colour += ('00' + value.toString(16)).substr(-2);
}
return colour;
}
How to fix this ?
Ignore it, it still works despite the warnings. If you wish to suppress the message, hover over the underlined text and right click, select
Refactoring
/Add a comment to suppress this message
- compile the app and see it working. Without seeing the rest of your code, it's really difficult to say why.Also, please try to keep issues separate instead of lumping them altogether in one post.
Spam Hunter ( 2019-02-06 15:37:13 +0200 )edit