[Kde-bindings] Qyoto. How to declare and to pass a signal as method parameter?
Dimitar Dobrev
dpldobrev at yahoo.com
Fri Sep 7 17:35:18 UTC 2012
Hi,
You need to make 2 steps:
1. Mark your signal like this:
[Q_SIGNAL]
protected void pressed()
{
...
}
2. Use the following syntax for your signal:
rootState.addTransition(ellipseButton, SIGNAL("pressed()"), ellipseState);
that is, you write your method name and signature as a string and pass that to the SIGNAL method.
________________________________
From: alex <alexandr.vodorez at gmail.com>
To: kde-bindings at kde.org
Sent: Friday, September 7, 2012 4:17 PM
Subject: [Kde-bindings] Qyoto. How to declare and to pass a signal as method parameter?
Hi. Please help me with signals.
I am trying to migrate code from C++ to C#. This is an example from Qt (Qt/4.8.2/examples/animation/animatedtiles/main.cpp)
In C++ has the following code:
class Button : public QGraphicsWidget
{
...
signals:
void pressed();
...
}
Then a signal "pressed()" is passed as a parameter to the function rootState->addTransition
Button *ellipseButton = new Button(QPixmap(":/images/ellipse.png"), buttonParent);
QState *rootState = new QState;
QAbstractTransition *trans = rootState->addTransition(ellipseButton, SIGNAL(pressed()), ellipseState);
I can't understand how to write it to C#.
class Button: QGraphicsWidget
{
...
protected pressed() <-- ??? How to properly declare a signal?
...
}
At first I thought do not use signals, and instead use the C# events:
event EventHandler pressed;
But in any case, don't know that I need to pass to the function :(
rootState->addTransition(ellipseButton, SIGNAL("<--??? What to write here?"), ellipseState);
Please help me with a problem.
With best regards
Alexandr Vodorez
_______________________________________________
Kde-bindings mailing list
Kde-bindings at kde.org
https://mail.kde.org/mailman/listinfo/kde-bindings
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20120907/a5edb228/attachment.html>
More information about the Kde-bindings
mailing list