Mercurial > projects > qtd
diff mini/test1/main.d @ 257:17b5e13364b7 lifetime
(none)
author | maxter |
---|---|
date | Wed, 16 Sep 2009 13:56:02 +0000 |
parents | 7dd099050621 |
children |
line wrap: on
line diff
--- a/mini/test1/main.d Mon Aug 31 12:07:28 2009 +0000 +++ b/mini/test1/main.d Wed Sep 16 13:56:02 2009 +0000 @@ -1,30 +1,125 @@ +module main; + +/+ +import qt.gui.QApplication; import qt.core.QCoreApplication; +import qt.gui.QDialogButtonBox; ++/ +import tango.io.Stdout; -version(Tango) {} else { import std.stdio; } +extern(C) void* qtd_test_Object(); +extern(C) void qtd_test_delete_Object(void* obj); + +import qt.core.QObject; +import qt.core.QCryptographicHash; +import qt.core.QFSFileEngine; +import qt.QtdObject; + -int main(string[] args) +void main() +{ + //auto nativeId = qtd_test_Object(); + scope obj = new QCryptographicHash(QCryptographicHash_Algorithm.Md5); + obj.__nativeOwnership = true; + qtd_test_delete_Object(obj.__nativeId); + //Stdout(obj).newline; +} + +/+ +void main(char[][] args) { - auto app = new QCoreApplication(args); + /+ + scope app = new QCoreApplication(args); + app.aboutToQuit.connect(&quit); + Stdout(app.children[0]).newline; + +/ + + /+ + scope parent = new QObject; + qtd_qobject(parent.__nativeId); + Stdout(parent.children[0]).newline; + +/ + + + - auto parent = new QObject(); - parent.setObjectName("papa"); - auto child1 = new QObject(parent); - child1.setObjectName("child1"); - auto child2 = new QObject(parent); - child2.setObjectName("child2"); - auto child3 = new QObject(parent); - child3.setObjectName("child3"); - - auto cd = parent.children; + //return app.exec(); +} + +void quit() +{ + Stdout("Quitting").newline; +} ++/ + +/+ +import tango.io.Stdout; + +import qt.gui.QMainWindow; + +public class TestWindow : QMainWindow +{ + public this() + { + //Stdout(qVersion).newline; + + //Stdout(this.children.length).newline; + auto box = new QDialogButtonBox(this); + auto closeButton = box.addButton(QDialogButtonBox.Close); + closeButton.clicked.connect(&onCloseClick); + } - writeln(app.arguments); - foreach(child; cd) - writeln(child.objectName); - - app.setLibraryPaths(["freakin", "bloody", "awesome!"]); + void onCloseClick() + { + Stdout("Close clicked").newline; + } +} + +void main(char[][] args) +{ + scope app = new QApplication(args); + scope mainWin = new TestWindow; + mainWin.show(); + return app.exec(); +} ++/ + +/+ - writeln(app.libraryPaths); +import qt.gui.QListWidget; +import qt.gui.QApplication; +import qt.gui.QMainWindow; +import tango.io.Stdout; +void main( char[][] args ) +{ - return 5; -// return app.exec(); + Stdout(qVersion).newline; + static void itemChanged( QListWidgetItem cur, QListWidgetItem prev ) + { + if(prev ) + { + Stdout("Here prev", prev, prev.__nativeId).newline; + prev.text; // This causes the SIGSEGV + Stdout("There prev").newline; + } + + if( cur ) + { + Stdout("Here", cur, cur.__nativeId).newline; + cur.text; // This causes the SIGSEGV + Stdout("There").newline; + } + } + scope app = new QApplication(args); + scope mainWin = new QMainWindow; + scope lw = new QListWidget( mainWin ); + scope lwi = new QListWidgetItem("text", lw); + lwi.text; + Stdout("Here 0 ", lwi.__nativeId).newline; + + lw.currentItemChanged.connect( &itemChanged ); + mainWin.show; + return app.exec; } + ++/ \ No newline at end of file