diff options
author | Jerome Pasion <jerome.pasion@nokia.com> | 2010-09-10 15:29:04 (GMT) |
---|---|---|
committer | Jerome Pasion <jerome.pasion@nokia.com> | 2010-09-10 15:29:04 (GMT) |
commit | b8644eab5205a9ff20ad27836be2439e7f6a19e9 (patch) | |
tree | 763de4d835e668d16be556998357f047a0a93754 /doc/src | |
parent | dd387a0125b577fafc1a3363a4b8cd995053b7db (diff) | |
download | Qt-b8644eab5205a9ff20ad27836be2439e7f6a19e9.zip Qt-b8644eab5205a9ff20ad27836be2439e7f6a19e9.tar.gz Qt-b8644eab5205a9ff20ad27836be2439e7f6a19e9.tar.bz2 |
Clarified the coding standard regarding connecting signals to slots.
Cleaned up the contradiction identified in QTBUG-10114.
Reviewed-by: David Boddie
Bug: QTBUG-8961, QTBUG-10114
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/objectmodel/signalsandslots.qdoc | 6 | ||||
-rw-r--r-- | doc/src/snippets/signalmapper/filereader.cpp | 12 |
2 files changed, 15 insertions, 3 deletions
diff --git a/doc/src/objectmodel/signalsandslots.qdoc b/doc/src/objectmodel/signalsandslots.qdoc index 09c427b..c12ca78 100644 --- a/doc/src/objectmodel/signalsandslots.qdoc +++ b/doc/src/objectmodel/signalsandslots.qdoc @@ -336,7 +336,7 @@ If on the other hand you want to call two different error functions when the number overflows, simply connect the signal to - two different slots. Qt will call both (in arbitrary order). + two different slots. Qt will call both (in the order they were connected). \snippet doc/src/snippets/signalsandslots/lcdnumber.h 10 \snippet doc/src/snippets/signalsandslots/lcdnumber.h 11 @@ -427,6 +427,10 @@ \snippet doc/src/snippets/signalmapper/filereader.cpp 1 + \note The following code will compile and run, but due to signature normalization, the code will be slower. + + \snippet doc/src/snippets/signalmapper/filereader.cpp 2 + \sa {Meta-Object System}, {Qt's Property System} \target 3rd Party Signals and Slots diff --git a/doc/src/snippets/signalmapper/filereader.cpp b/doc/src/snippets/signalmapper/filereader.cpp index 76ed4c1..08f4d06 100644 --- a/doc/src/snippets/signalmapper/filereader.cpp +++ b/doc/src/snippets/signalmapper/filereader.cpp @@ -66,10 +66,18 @@ FileReader::FileReader(QWidget *parent) //! [0] //! [1] - connect(signalMapper, SIGNAL(mapped(const QString &)), - this, SLOT(readFile(const QString &))); + connect(signalMapper, SIGNAL(mapped(QString)), + this, SLOT(readFile(QString))); //! [1] +/* +//! [2] + //slower due to signature normalization at runtime + + connect(signalMapper, SIGNAL(mapped(const QString &)), + this, SLOT(readFile(const QString &))); +//! [2] +*/ QHBoxLayout *buttonLayout = new QHBoxLayout; buttonLayout->addWidget(taxFileButton); buttonLayout->addWidget(accountFileButton); |