[Kde-bindings] KDE/kdebindings/csharp/qyoto

Richard Dale Richard_Dale at tipitina.demon.co.uk
Tue Jun 19 15:35:43 UTC 2007


SVN commit 677633 by rdale:

* Improved the layout of the README, and made some changes to the text

CCMAIL: kde-bindings at kde.org



 M  +1 -0      ChangeLog  
 M  +70 -50    README  


--- trunk/KDE/kdebindings/csharp/qyoto/ChangeLog #677632:677633
@@ -1,6 +1,7 @@
 2007-06-19  Richard Dale  <rdale at foton.es>
 
 	* Added the missing QUiLoader class
+	* Improved the layout of the README, and made some changes to the text
 
 2007-06-18  Arno Rehn  <arno at arnorehn.de>
 
--- trunk/KDE/kdebindings/csharp/qyoto/README #677632:677633
@@ -1,79 +1,99 @@
 README
 ------
 
-Qyoto is a set of C# classes wrapping the Qt library to be used with Mono/.NET.
-The API is pretty much the same, the only differences are the following:
- - Method names begin with a capital letter.
- - Q_PROPERTYs are mapped onto .NET properties (for example the property
-   'windowTitle' with the accessors 'setWindowTitle()' and 'windowTitle()'
-   becomes just 'WindowTitle' in .NET/Mono).
- - The creation of signals/slots is working differently:
+Qyoto comprises of set of C# classes wrapping the Qt 4.3 library for
+use with Mono/.NET, along with a runtime that interfaces with the
+language independent Smoke library that was originally designed for
+PerlQt and is currently also used for QtRuby.
 
+The API is pretty much the same as the C++ one, the main differences
+being the following:
+
+ - Method names begin with a capital letter
+
+ - Q_PROPERTYs are mapped onto .NET properties and, for example, the
+property 'windowTitle' with the accessors 'setWindowTitle()'
+and 'windowTitle()' becomes just a 'WindowTitle' property
+in .NET/Mono.
+
+ - The declaration of signals/slots is slightly different, although
+the QMetaObject created at runtime for QObject subclasses is
+identical to the equivalent C++ class:
+
 To mark methods as slots, just add a Q_SLOT attribute to them.
-Example:
+For example:
 
 [Q_SLOT]
 void ButtonClicked() {
-	// do something
+    // do something
 }
 
 
-To create custom signals, you first have to create an interface which inherits
-from the Signals interface of the parent class. In this interface you declare
-your signals, all marked with the Q_SIGNAL attribute.
-Then you have to override the Property 'Emit' of the class for which you want to
-create custom signals. The return value of 'Emit' is the protected variable
-Q_EMIT, casted to out signals interface.
-To emit a signal, use 'Emit.SignalName()'
-Example:
+Each QObject subclass with signals, has a signals interface with the
+method signatures of all the signals for that class. To create custom
+signals, you first have to create an interface which inherits from
+the signals interface of the parent class. In this interface you
+declare your signals, all marked with the Q_SIGNAL attribute. Then
+you need to override the Property 'Emit' of the class for which you
+want to emit the custom signals. The return value of 'Emit' is the
+protected variable Q_EMIT (actually a transparent proxy), casted to
+the type of the class's signals interface.
 
+To emit a signal, use 'Emit.SignalName(<an optional arg list>)'
+
+For example:
+
 class Test : QWidget {
-	// some code
-	
-	protected ITestSignals Emit {
-		get {
-			return (ITestSignals) Q_EMIT;
-		}
-	}
-	
-	public void EmitSignal() {
-		// here we emit our custom signal
-		Emit.TestSignal(5);
-	}
-	
-	// some code
+    // some code
+    
+    protected ITestSignals Emit { get { return (ITestSignals)
+Q_EMIT; } }
+    
+    public void MyMethod() {
+        // here we emit our custom signal
+        Emit.TestSignal(5);
+    }
+    
+    // some code
 }
 
 interface ITestSignals {
-	[Q_SIGNAL]
-	void TestSignal(int arg1);
+    [Q_SIGNAL]
+    void TestSignal(int arg1);
 }
 
 
-Signals and slots are connected in the normal way, e.g.
+Signals and slots are connected in the same way as for C++, except
+that the signal and slot signatures are strings. For instance:
+
 Connect(qApp, SIGNAL("aboutToQuit()"), this, SLOT("quit()"));
 
+Qyoto also provides a set of tools for use with Qt Designer .ui files
+and resources in .rcc files, uics and csrcc (ports of uic and rcc to
+produce C# code). Invocation from the command line is the same as for
+the C++ tools. To use your generated GUI code, first create an
+instance of the Ui class, then call SetupUi() with the current widget
+as parameter and your GUI will be set up, just like in C++.
 
-Qyoto also provides a set of tools for dealing with ui files and resources, uics and csrcc (ports of uic and rcc to produce C# code). The invocation is the same as for the C++ tools.
-To use your generated GUI code, first create an instance of the Ui class, then call SetupUi() with the current widget as parameter and your GUI will be set up, just like in C++.
-Example:
+For example:
 
 class Test : QWidget {
-	Ui.Form ui;
-	
-	public Test() {
-		ui = new Ui.Form(),
-		ui.SetupUi(this);
-	}
+    Ui.Form ui;
+    
+    public Test() {
+        ui = new Ui.Form(),
+        ui.SetupUi(this);
+    }
 }
 
-To use ressources, just compile the generated code into your application and then call Q_INIT_RESOURCE() in Main().
-Excerpt from simpletreeview example:
+To use resources, just compile the generated code into your
+application and then call Q_INIT_RESOURCE() in Main().
+Excerpt from the simpletreeview example:
 
 public static int Main(string[] args) {
-	Q_INIT_RESOURCE("simpletreemodel");
-	new QApplication(args);
-	QFile file = new QFile(":/default.txt");
-	
-	// more code...
+    Q_INIT_RESOURCE("simpletreemodel");
+    new QApplication(args);
+    QFile file = new QFile(":/default.txt");
+    
+    // more code...
 }



More information about the Kde-bindings mailing list