[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-bindings
Subject:    Re: [Kde-bindings] Qt, Qyoto buttons work intermediately
From:       linuxoidoz () yahoo ! com ! au
Date:       2010-02-18 9:44:20
Message-ID: 201002181944.20856.linuxoidoz () yahoo ! com ! au
[Download RAW message or body]

So if I understand it right, if I have one class MainWindow with a button btn1, and another class \
StartWindow with a button btn2, then you use this

Connect(button, SIGNAL("clicked()"), otherObject.btn2, SLOT("buttonClicked()"));

to emit a signal buttonClicked() from btn2 in StartWindow when button btn1 in MainWindow has been \
clicked? 

> you tell the meta object system to invoke "otherObject.buttonClicked()" when the signal "clicked()" in \
> the object "button" is emitted


In C# you declare a method first as
this.btn1.Clicked += new System.EventHandler(this.OnBtn1Clicked);

and then implement it as
protected virtual void OnBtn1Clicked (object sender, System.EventArgs e)

How do you do this with Qt in C#? Sorry, I just can't understand this signal/slot thing without \
comparable examples. All I need to know is, for example, how to show a message box from another class and \
pass a variable to it.

This
		QObject.Connect(btnAbout, Qt.SIGNAL("clicked()"), this, Qt.SLOT("ShowAbout(variable)"));

		[Q_SLOT]
		private void ShowAbout() {
			QMessageBox.About(this, "About", variable.ToString());
		}

simply doesn't work. How can you pass a reference to a widget in the SLOT if you're saying you need to \
pass a type, NOT a variable, when the variable is invisible to the QMessageBox unless you pass it to the \
method.

If you could send me a link to signal/slot C# examples, I'm happy to read, but this Qt-C# signal/slot \
theory is too different to plain C# to comprehend.

_______________________________________________
Kde-bindings mailing list
Kde-bindings@kde.org
https://mail.kde.org/mailman/listinfo/kde-bindings


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic