257
|
1 module main;
|
|
2
|
|
3 /+
|
|
4 import qt.gui.QApplication;
|
1
|
5 import qt.core.QCoreApplication;
|
257
|
6 import qt.gui.QDialogButtonBox;
|
|
7 +/
|
|
8 import tango.io.Stdout;
|
1
|
9
|
257
|
10 extern(C) void* qtd_test_Object();
|
|
11 extern(C) void qtd_test_delete_Object(void* obj);
|
|
12
|
|
13 import qt.core.QObject;
|
|
14 import qt.core.QCryptographicHash;
|
|
15 import qt.core.QFSFileEngine;
|
|
16 import qt.QtdObject;
|
|
17
|
1
|
18
|
257
|
19 void main()
|
|
20 {
|
|
21 //auto nativeId = qtd_test_Object();
|
|
22 scope obj = new QCryptographicHash(QCryptographicHash_Algorithm.Md5);
|
|
23 obj.__nativeOwnership = true;
|
|
24 qtd_test_delete_Object(obj.__nativeId);
|
|
25 //Stdout(obj).newline;
|
|
26 }
|
|
27
|
|
28 /+
|
|
29 void main(char[][] args)
|
1
|
30 {
|
257
|
31 /+
|
|
32 scope app = new QCoreApplication(args);
|
|
33 app.aboutToQuit.connect(&quit);
|
|
34 Stdout(app.children[0]).newline;
|
|
35 +/
|
|
36
|
|
37 /+
|
|
38 scope parent = new QObject;
|
|
39 qtd_qobject(parent.__nativeId);
|
|
40 Stdout(parent.children[0]).newline;
|
|
41 +/
|
|
42
|
|
43
|
|
44
|
1
|
45
|
257
|
46 //return app.exec();
|
|
47 }
|
|
48
|
|
49 void quit()
|
|
50 {
|
|
51 Stdout("Quitting").newline;
|
|
52 }
|
|
53 +/
|
|
54
|
|
55 /+
|
|
56 import tango.io.Stdout;
|
|
57
|
|
58 import qt.gui.QMainWindow;
|
|
59
|
|
60 public class TestWindow : QMainWindow
|
|
61 {
|
|
62 public this()
|
|
63 {
|
|
64 //Stdout(qVersion).newline;
|
|
65
|
|
66 //Stdout(this.children.length).newline;
|
|
67 auto box = new QDialogButtonBox(this);
|
|
68 auto closeButton = box.addButton(QDialogButtonBox.Close);
|
|
69 closeButton.clicked.connect(&onCloseClick);
|
|
70 }
|
188
|
71
|
257
|
72 void onCloseClick()
|
|
73 {
|
|
74 Stdout("Close clicked").newline;
|
|
75 }
|
|
76 }
|
|
77
|
|
78 void main(char[][] args)
|
|
79 {
|
|
80 scope app = new QApplication(args);
|
|
81 scope mainWin = new TestWindow;
|
|
82 mainWin.show();
|
|
83 return app.exec();
|
|
84 }
|
|
85 +/
|
|
86
|
|
87 /+
|
188
|
88
|
257
|
89 import qt.gui.QListWidget;
|
|
90 import qt.gui.QApplication;
|
|
91 import qt.gui.QMainWindow;
|
|
92 import tango.io.Stdout;
|
|
93 void main( char[][] args )
|
|
94 {
|
1
|
95
|
257
|
96 Stdout(qVersion).newline;
|
|
97 static void itemChanged( QListWidgetItem cur, QListWidgetItem prev )
|
|
98 {
|
|
99 if(prev )
|
|
100 {
|
|
101 Stdout("Here prev", prev, prev.__nativeId).newline;
|
|
102 prev.text; // This causes the SIGSEGV
|
|
103 Stdout("There prev").newline;
|
|
104 }
|
|
105
|
|
106 if( cur )
|
|
107 {
|
|
108 Stdout("Here", cur, cur.__nativeId).newline;
|
|
109 cur.text; // This causes the SIGSEGV
|
|
110 Stdout("There").newline;
|
|
111 }
|
|
112 }
|
|
113 scope app = new QApplication(args);
|
|
114 scope mainWin = new QMainWindow;
|
|
115 scope lw = new QListWidget( mainWin );
|
|
116 scope lwi = new QListWidgetItem("text", lw);
|
|
117 lwi.text;
|
|
118 Stdout("Here 0 ", lwi.__nativeId).newline;
|
|
119
|
|
120 lw.currentItemChanged.connect( &itemChanged );
|
|
121 mainWin.show;
|
|
122 return app.exec;
|
1
|
123 }
|
257
|
124
|
|
125 +/ |