I just know how to write the code,but I don't know how to let them work.Who can tell me how to creat them with Qt Creator?
I just know how to write the code,but I don't know how to let them work.Who can tell me how to creat them with Qt Creator?
There's a fine example in the docs ( and online here ).
Here's an example (not a 100% working example):
in the header:
and the cpp file:Qt Code:
#include <QtGui> { Q_OBJECT public: MyClass::MyClass(); MyClass::~MyClass(); signals: void mySig(); public slots: void mySlot(); };To copy to clipboard, switch view to plain text mode
Qt Code:
#include "myclass.h" MyClass::MyClass() { ..... connect (this, SIGNAL(mySig()), this, SLOT(mySlot()); ..... if (something) { emit mySig(); } } MyClass::~MyClass() { } void MyClass::MySlot() { ..... doSomething(); ..... }To copy to clipboard, switch view to plain text mode
Dave2011 (5th August 2011)
And then? complie?
Added after 16 minutes:
I'm sorry I haven't understood.More detail please.Thanks!
Last edited by Dave2011; 5th August 2011 at 17:01.
Whats wrong with the great Signals And Slots documentation (A Small Example is available there as well) ?
I'm not good at English, you know,it's always a pity for me.I can't understand the documentation accuratly!
What I'm needed is a whole example and the steps to complie it!
Thanks to you for help me.![]()
For a simple signal/slot example you might take a look at this tread. The code in the post actually works.
Start by making a new "Qt Quick Application" in Qt Creator.
Bookmarks