In 'AppListView' are empty places where Loader should load Component with 'SimpleRow'











up vote
0
down vote

favorite












I have a code application written in QT/QML and V-PLAY on the github here:



My problem:



I want to use AppListView to display different elements (like Button or SwitchApp) in 'Ustawienia' (Settings) page dependent on elements in array:



property var typeOfElementsInSettings: ['switch','switch','button','switch']


I use 'delegete: Loader' to do It, I inspired in this thread. I load component from other file, one will have Button inside, other AppSwitcher. Loader inserts SimpleRow to AppListView, I know It because variable myIndex should increment when SimpleRow is added and It was incremented but I can't see anything. I mean that I see empty space in place where should be displayed SimpleRow.



See screenshot:



Android Theme:



android theme



iOS Theme:



ios theme



This is my code in Main.qml



NavigationItem{
title: "Ustawienia"
icon: IconType.cogs

NavigationStack{
Page{
title: "Ustawienia"
AppButton{
id: przy
text: "abba"
}

AppListView{
anchors.top: przy.bottom
model: ListModel{
ListElement{
type: "kategoria 1"; name: "opcja 1"
}
ListElement{
type: "kategoria 1"; name: "opcja 2"
}
ListElement{
type: "kategoria 2"; name: "opcja 3"
}
ListElement{
type: "Opcje programisty"; name: "Czyszczenie ustawień aplikacji"
}
}


section.property: "type";
section.delegate: SimpleSection {
title: section
}

delegate: Loader{
sourceComponent: {
switch(typeOfElementsInSettings[myIndex]){
case "switch":
console.log(typeOfElementsInSettings[myIndex])
console.log("s")
return imageDel;
case "button":
console.log(typeOfElementsInSettings[myIndex])
console.log("b")
return imageDel;
}
}
}
SimpleRowSwitch { id: imageDel }
VideoDelegate { id: videoDel }
}

}
}
onSelected: {
//console.log("selected")
}
Component.onCompleted: {
//console.log("Zrobiono")
}
}


This my code in SimpleRowSwitch.qml:



import VPlayApps 1.0
import QtQuick 2.9

Component{
SimpleRow {
x: 100
y: 200
text: name;
AppSwitch{
property int indexOfElementInSettings: 0
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: dp(10)
Component.onCompleted: {
indexOfElementInSettings=myIndex
console.log(myIndex)
if(switchsSettingsLogicArray[myIndex]===1){
checked=true
} else {
checked=false
}
//myIndex++;
}
onToggled: {
console.log(indexOfElementInSettings)
}
}
Component.onCompleted: {
console.log(x)
console.log(y)
console.log(typeOfElementsInSettings[myIndex])
console.log(myIndex)
myIndex++
}
onSelected: {
console.log("abba")
}
}
}









share|improve this question
























  • Please post your code as a text, not as an image. Read how to post Minimal, Complete, and Verifiable example
    – folibis
    Oct 25 at 6:12












  • I uploaded my code on the github.
    – pyroxar
    Oct 25 at 9:23










  • You should create Minimal, Complete, and Verifiable example which reproduces the problem. No one will download your entire project to look for errors. We're all busy people, but we're happy to help you if you make an effort.
    – folibis
    Oct 25 at 10:12















up vote
0
down vote

favorite












I have a code application written in QT/QML and V-PLAY on the github here:



My problem:



I want to use AppListView to display different elements (like Button or SwitchApp) in 'Ustawienia' (Settings) page dependent on elements in array:



property var typeOfElementsInSettings: ['switch','switch','button','switch']


I use 'delegete: Loader' to do It, I inspired in this thread. I load component from other file, one will have Button inside, other AppSwitcher. Loader inserts SimpleRow to AppListView, I know It because variable myIndex should increment when SimpleRow is added and It was incremented but I can't see anything. I mean that I see empty space in place where should be displayed SimpleRow.



See screenshot:



Android Theme:



android theme



iOS Theme:



ios theme



This is my code in Main.qml



NavigationItem{
title: "Ustawienia"
icon: IconType.cogs

NavigationStack{
Page{
title: "Ustawienia"
AppButton{
id: przy
text: "abba"
}

AppListView{
anchors.top: przy.bottom
model: ListModel{
ListElement{
type: "kategoria 1"; name: "opcja 1"
}
ListElement{
type: "kategoria 1"; name: "opcja 2"
}
ListElement{
type: "kategoria 2"; name: "opcja 3"
}
ListElement{
type: "Opcje programisty"; name: "Czyszczenie ustawień aplikacji"
}
}


section.property: "type";
section.delegate: SimpleSection {
title: section
}

delegate: Loader{
sourceComponent: {
switch(typeOfElementsInSettings[myIndex]){
case "switch":
console.log(typeOfElementsInSettings[myIndex])
console.log("s")
return imageDel;
case "button":
console.log(typeOfElementsInSettings[myIndex])
console.log("b")
return imageDel;
}
}
}
SimpleRowSwitch { id: imageDel }
VideoDelegate { id: videoDel }
}

}
}
onSelected: {
//console.log("selected")
}
Component.onCompleted: {
//console.log("Zrobiono")
}
}


This my code in SimpleRowSwitch.qml:



import VPlayApps 1.0
import QtQuick 2.9

Component{
SimpleRow {
x: 100
y: 200
text: name;
AppSwitch{
property int indexOfElementInSettings: 0
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: dp(10)
Component.onCompleted: {
indexOfElementInSettings=myIndex
console.log(myIndex)
if(switchsSettingsLogicArray[myIndex]===1){
checked=true
} else {
checked=false
}
//myIndex++;
}
onToggled: {
console.log(indexOfElementInSettings)
}
}
Component.onCompleted: {
console.log(x)
console.log(y)
console.log(typeOfElementsInSettings[myIndex])
console.log(myIndex)
myIndex++
}
onSelected: {
console.log("abba")
}
}
}









share|improve this question
























  • Please post your code as a text, not as an image. Read how to post Minimal, Complete, and Verifiable example
    – folibis
    Oct 25 at 6:12












  • I uploaded my code on the github.
    – pyroxar
    Oct 25 at 9:23










  • You should create Minimal, Complete, and Verifiable example which reproduces the problem. No one will download your entire project to look for errors. We're all busy people, but we're happy to help you if you make an effort.
    – folibis
    Oct 25 at 10:12













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I have a code application written in QT/QML and V-PLAY on the github here:



My problem:



I want to use AppListView to display different elements (like Button or SwitchApp) in 'Ustawienia' (Settings) page dependent on elements in array:



property var typeOfElementsInSettings: ['switch','switch','button','switch']


I use 'delegete: Loader' to do It, I inspired in this thread. I load component from other file, one will have Button inside, other AppSwitcher. Loader inserts SimpleRow to AppListView, I know It because variable myIndex should increment when SimpleRow is added and It was incremented but I can't see anything. I mean that I see empty space in place where should be displayed SimpleRow.



See screenshot:



Android Theme:



android theme



iOS Theme:



ios theme



This is my code in Main.qml



NavigationItem{
title: "Ustawienia"
icon: IconType.cogs

NavigationStack{
Page{
title: "Ustawienia"
AppButton{
id: przy
text: "abba"
}

AppListView{
anchors.top: przy.bottom
model: ListModel{
ListElement{
type: "kategoria 1"; name: "opcja 1"
}
ListElement{
type: "kategoria 1"; name: "opcja 2"
}
ListElement{
type: "kategoria 2"; name: "opcja 3"
}
ListElement{
type: "Opcje programisty"; name: "Czyszczenie ustawień aplikacji"
}
}


section.property: "type";
section.delegate: SimpleSection {
title: section
}

delegate: Loader{
sourceComponent: {
switch(typeOfElementsInSettings[myIndex]){
case "switch":
console.log(typeOfElementsInSettings[myIndex])
console.log("s")
return imageDel;
case "button":
console.log(typeOfElementsInSettings[myIndex])
console.log("b")
return imageDel;
}
}
}
SimpleRowSwitch { id: imageDel }
VideoDelegate { id: videoDel }
}

}
}
onSelected: {
//console.log("selected")
}
Component.onCompleted: {
//console.log("Zrobiono")
}
}


This my code in SimpleRowSwitch.qml:



import VPlayApps 1.0
import QtQuick 2.9

Component{
SimpleRow {
x: 100
y: 200
text: name;
AppSwitch{
property int indexOfElementInSettings: 0
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: dp(10)
Component.onCompleted: {
indexOfElementInSettings=myIndex
console.log(myIndex)
if(switchsSettingsLogicArray[myIndex]===1){
checked=true
} else {
checked=false
}
//myIndex++;
}
onToggled: {
console.log(indexOfElementInSettings)
}
}
Component.onCompleted: {
console.log(x)
console.log(y)
console.log(typeOfElementsInSettings[myIndex])
console.log(myIndex)
myIndex++
}
onSelected: {
console.log("abba")
}
}
}









share|improve this question















I have a code application written in QT/QML and V-PLAY on the github here:



My problem:



I want to use AppListView to display different elements (like Button or SwitchApp) in 'Ustawienia' (Settings) page dependent on elements in array:



property var typeOfElementsInSettings: ['switch','switch','button','switch']


I use 'delegete: Loader' to do It, I inspired in this thread. I load component from other file, one will have Button inside, other AppSwitcher. Loader inserts SimpleRow to AppListView, I know It because variable myIndex should increment when SimpleRow is added and It was incremented but I can't see anything. I mean that I see empty space in place where should be displayed SimpleRow.



See screenshot:



Android Theme:



android theme



iOS Theme:



ios theme



This is my code in Main.qml



NavigationItem{
title: "Ustawienia"
icon: IconType.cogs

NavigationStack{
Page{
title: "Ustawienia"
AppButton{
id: przy
text: "abba"
}

AppListView{
anchors.top: przy.bottom
model: ListModel{
ListElement{
type: "kategoria 1"; name: "opcja 1"
}
ListElement{
type: "kategoria 1"; name: "opcja 2"
}
ListElement{
type: "kategoria 2"; name: "opcja 3"
}
ListElement{
type: "Opcje programisty"; name: "Czyszczenie ustawień aplikacji"
}
}


section.property: "type";
section.delegate: SimpleSection {
title: section
}

delegate: Loader{
sourceComponent: {
switch(typeOfElementsInSettings[myIndex]){
case "switch":
console.log(typeOfElementsInSettings[myIndex])
console.log("s")
return imageDel;
case "button":
console.log(typeOfElementsInSettings[myIndex])
console.log("b")
return imageDel;
}
}
}
SimpleRowSwitch { id: imageDel }
VideoDelegate { id: videoDel }
}

}
}
onSelected: {
//console.log("selected")
}
Component.onCompleted: {
//console.log("Zrobiono")
}
}


This my code in SimpleRowSwitch.qml:



import VPlayApps 1.0
import QtQuick 2.9

Component{
SimpleRow {
x: 100
y: 200
text: name;
AppSwitch{
property int indexOfElementInSettings: 0
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
anchors.rightMargin: dp(10)
Component.onCompleted: {
indexOfElementInSettings=myIndex
console.log(myIndex)
if(switchsSettingsLogicArray[myIndex]===1){
checked=true
} else {
checked=false
}
//myIndex++;
}
onToggled: {
console.log(indexOfElementInSettings)
}
}
Component.onCompleted: {
console.log(x)
console.log(y)
console.log(typeOfElementsInSettings[myIndex])
console.log(myIndex)
myIndex++
}
onSelected: {
console.log("abba")
}
}
}






qt qml v-play






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited yesterday









John Law

17411




17411










asked Oct 24 at 13:21









pyroxar

11




11












  • Please post your code as a text, not as an image. Read how to post Minimal, Complete, and Verifiable example
    – folibis
    Oct 25 at 6:12












  • I uploaded my code on the github.
    – pyroxar
    Oct 25 at 9:23










  • You should create Minimal, Complete, and Verifiable example which reproduces the problem. No one will download your entire project to look for errors. We're all busy people, but we're happy to help you if you make an effort.
    – folibis
    Oct 25 at 10:12


















  • Please post your code as a text, not as an image. Read how to post Minimal, Complete, and Verifiable example
    – folibis
    Oct 25 at 6:12












  • I uploaded my code on the github.
    – pyroxar
    Oct 25 at 9:23










  • You should create Minimal, Complete, and Verifiable example which reproduces the problem. No one will download your entire project to look for errors. We're all busy people, but we're happy to help you if you make an effort.
    – folibis
    Oct 25 at 10:12
















Please post your code as a text, not as an image. Read how to post Minimal, Complete, and Verifiable example
– folibis
Oct 25 at 6:12






Please post your code as a text, not as an image. Read how to post Minimal, Complete, and Verifiable example
– folibis
Oct 25 at 6:12














I uploaded my code on the github.
– pyroxar
Oct 25 at 9:23




I uploaded my code on the github.
– pyroxar
Oct 25 at 9:23












You should create Minimal, Complete, and Verifiable example which reproduces the problem. No one will download your entire project to look for errors. We're all busy people, but we're happy to help you if you make an effort.
– folibis
Oct 25 at 10:12




You should create Minimal, Complete, and Verifiable example which reproduces the problem. No one will download your entire project to look for errors. We're all busy people, but we're happy to help you if you make an effort.
– folibis
Oct 25 at 10:12

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52970114%2fin-applistview-are-empty-places-where-loader-should-load-component-with-simpl%23new-answer', 'question_page');
}
);

Post as a guest





































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f52970114%2fin-applistview-are-empty-places-where-loader-should-load-component-with-simpl%23new-answer', 'question_page');
}
);

Post as a guest




















































































Popular posts from this blog

Xamarin.iOS Cant Deploy on Iphone

Glorious Revolution

Dulmage-Mendelsohn matrix decomposition in Python