Created
August 30, 2015 09:56
-
-
Save anonymous/2d362b753d2cbf3bc359 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[D] onClicked:76 - Clicked seraph | |
but breakpoint in serviceProperties methode says optimized out reference |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
main | |
----- | |
... | |
QStringList Servers = settings.getServers(); | |
view->engine()->rootContext()->setContextProperty("myModel", QVariant::fromValue(Servers)); | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SilicaListView { | |
id: listView | |
anchors.fill: parent | |
header: PageHeader { | |
title: qsTr("Server") | |
} | |
model: myModel | |
delegate: BackgroundItem { | |
id: delegate | |
Label { | |
x: Theme.paddingLarge | |
text: modelData | |
anchors.verticalCenter: parent.verticalCenter | |
color: delegate.highlighted ? Theme.highlightColor : Theme.primaryColor | |
} | |
onClicked: { | |
console.log("Clicked " + modelData) | |
var props = settings.serviceProperties(modelData); | |
pageStack.push(Qt.resolvedUrl("addServerDialog.qml")) | |
} | |
} | |
VerticalScrollDecorator {} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
QStringList settings::getServers() | |
{ | |
QStringList rtval; | |
beginGroup("servers"); | |
rtval = childGroups(); | |
endGroup(); | |
return rtval; | |
} | |
QVariantMap settings::serviceProperties(const QString &name) | |
{ | |
QVariantMap properties; | |
beginGroup("servers"); | |
beginGroup(name); | |
QStringList keys = allKeys(); | |
endGroup(); | |
endGroup(); | |
foreach (const QString& key, keys) | |
{ | |
properties.insert(key, value(key)); | |
} | |
return properties; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment