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
// Default empty project template | |
import bb.cascades 1.0 | |
// creates one page with a label | |
Page { | |
titleBar: TitleBar { | |
options: [ | |
Option { | |
text: "title" | |
} , |
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
{"widget": { | |
"debug": "on", | |
"window": { | |
"title": "Sample Konfabulator Widget", | |
"name": "main_window", | |
"width": 500, | |
"height": 500 | |
}, | |
"image": { | |
"src": "Images/Sun.png", |
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
JsonDataAccess jda; | |
QVariant list = jda.load("contacts.json"); | |
qDebug()<<list.toMap().value("widget").toMap("window").value("title").toString(); | |
//affiche Sample Konfabulator Widget |
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
//parser un json (QString) vers un QVariant | |
QString source = "{"name": "sacha"} | |
QVariant data = QxtJson::parse(source); | |
//affiche "sacha" | |
qDebug()<<data.toMap().value("name").toString(); | |
//ecrire du json | |
QVariantMap data; | |
data.insert("name", "olivier"); | |
QString source = QxtJson::parse(data); |
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
// En C++ , passer votre QVariant au contexte qml | |
qml->setContextProperty("myData",data); | |
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
Label | |
{ | |
text:myData.name | |
} |
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
void myMessageOutput(QtMsgType type, const char* msg){ | |
fprintf(stdout, "%s\n", msg); | |
fflush(stdout); | |
} | |
int main(int argc, char **argv) | |
{ | |
Application app(argc, argv); |
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
ScrollView { | |
scrollViewProperties.pinchToZoomEnabled: true | |
scrollViewProperties.initialScalingMethod: ScalingMethod.AspectFit | |
scrollViewProperties.minContentScale: 1 | |
scrollViewProperties.maxContentScale: 10 | |
scrollViewProperties.scrollMode: ScrollMode.Both | |
Container { | |
WebView { |
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
ScrollView { | |
scrollViewProperties.pinchToZoomEnabled: true | |
scrollViewProperties.initialScalingMethod: ScalingMethod.AspectFit | |
scrollViewProperties.minContentScale: 1 | |
scrollViewProperties.maxContentScale: 10 | |
scrollViewProperties.scrollMode: ScrollMode.Both | |
Container { | |
WebView { |
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
#ifndef MATABLEVIEW_H | |
#define MATABLEVIEW_H | |
#include <QTableView> | |
class MaTableView : public QTableView | |
{ | |
Q_OBJECT | |
public: | |
explicit MaTableView(QWidget *parent = 0); |