qt:wiring_up_signals_and_slots
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
qt:wiring_up_signals_and_slots [2011/04/03 13:06] – mithat | qt:wiring_up_signals_and_slots [2011/04/03 13:13] – mithat | ||
---|---|---|---|
Line 2: | Line 2: | ||
===== Creating signal→slot connections ===== | ===== Creating signal→slot connections ===== | ||
- | Qt uses a [[signals and slots]] system to process events. | + | Qt uses a [[signals and slots]] system to process events. |
* [[#Create an "event handler" | * [[#Create an "event handler" | ||
* [[#Do it " | * [[#Do it " | ||
Line 8: | Line 8: | ||
* [[#Do it in the constructor ]] | * [[#Do it in the constructor ]] | ||
- | If you use Qt Designer with some other IDE for development, | + | Each of the above listed approaches |
==== The alternatives ==== | ==== The alternatives ==== | ||
=== Create an "event handler" | === Create an "event handler" | ||
- | // | + | // |
Users of Visual Studio, Delphi, and Lazarus will be most familiar with this approach. In Qt Creator, right click on a control and select //Go to slot ...//. A dialog box giving you a list of signals available for the control will appear; select the signal for which you wish to create a handler. If the handler doesn' | Users of Visual Studio, Delphi, and Lazarus will be most familiar with this approach. In Qt Creator, right click on a control and select //Go to slot ...//. A dialog box giving you a list of signals available for the control will appear; select the signal for which you wish to create a handler. If the handler doesn' | ||
Line 32: | Line 32: | ||
How does the build system know that that '' | How does the build system know that that '' | ||
<code cpp-qt>< | <code cpp-qt>< | ||
- | = Question = | + | |
+ | == Question | ||
If the above is true, then it should be possible to create event handlers just by writing code. Two tests are indicated: | If the above is true, then it should be possible to create event handlers just by writing code. Two tests are indicated: | ||
* Write the handlers manually in Qt Creator. | * Write the handlers manually in Qt Creator. | ||
* Write the handlers manually in a project managed by something other than Qt Creator. | * Write the handlers manually in a project managed by something other than Qt Creator. | ||
+ | I've done both and assuming I didn't overlook something, indeed you can hand-add handlers as suggested. | ||
=== Do it " | === Do it " | ||
Line 122: | Line 124: | ||
==== Recommendation ==== | ==== Recommendation ==== | ||
- | While the [[#Create an "event handler" | + | While the [[#Create an "event handler" |
===== Runtime signal→slot connection modifications ===== | ===== Runtime signal→slot connection modifications ===== | ||
I don't know. But it should be possible. | I don't know. But it should be possible. |
qt/wiring_up_signals_and_slots.txt · Last modified: 2011/04/03 13:14 by mithat