summaryrefslogtreecommitdiffstats
path: root/qtsharp/src/examples/samples/qstring-slot.cs
blob: e6d5110a6b93847aca0f15bc1fd99171a5bf611f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Demo of a QString slot
// Implemented by Marcus Urban

using System;
using Qt;

public class MyWidget : QVBox
{
	QLineEdit lineEdit;
	QLabel label;

	public MyWidget (QWidget parent, String name) : base (parent, name)
	{
		lineEdit = new QLineEdit( this, "lineEdit" );
		label = new QLabel( this, "label" );
		label.SetText("Default");
		
		QObject.Connect( lineEdit, SIGNAL("textChanged(QString)"),
			label, "SetText(QString)" );
	}


	public MyWidget (QWidget parent) : this (parent, "") {}
	public MyWidget () : this (null, "") {}
}

public class Example {

	public static int Main (String[] args)
	{
		QApplication a = new QApplication (args);
		
		MyWidget w = new MyWidget ();
		a.SetMainWidget (w);
		w.Show ();
		return a.Exec ();
	}
}