summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2014-04-07 10:05:37 +0200
committerMarc Mutz <marc.mutz@kdab.com>2014-07-23 20:32:10 +0200
commit46a0a87b2a394a60246764808a91e1f5c09d721a (patch)
treea6ca8079cf3de577c1019f54c42d8bb6aeb9859f /src/widgets
parentc2cc74f862df3bbc8bf7c8ecd5909af9de3d95ca (diff)
QInputDialog: simplify signalForMember()
Instead of playing clever tricks with the index variable, simply scan through the list of argument-carrying signals and, if nothing fits there, fall explicitly back to accepted(). Change-Id: I1be49ce601edb854cc1bab5be994b2c09fe31b3c Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/dialogs/qinputdialog.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/widgets/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp
index e7c8128337..99344b3dd8 100644
--- a/src/widgets/dialogs/qinputdialog.cpp
+++ b/src/widgets/dialogs/qinputdialog.cpp
@@ -64,7 +64,6 @@ enum CandidateSignal {
TextValueSelectedSignal,
IntValueSelectedSignal,
DoubleValueSelectedSignal,
- AcceptedSignal,
NumCandidateSignals
};
@@ -75,7 +74,6 @@ static const char *candidateSignal(int which)
case TextValueSelectedSignal: return SIGNAL(textValueSelected(QString));
case IntValueSelectedSignal: return SIGNAL(intValueSelected(int));
case DoubleValueSelectedSignal: return SIGNAL(doubleValueSelected(double));
- case AcceptedSignal: return SIGNAL(accepted());
case NumCandidateSignals: ; // fall through
};
@@ -87,13 +85,12 @@ static const char *signalForMember(const char *member)
{
QByteArray normalizedMember(QMetaObject::normalizedSignature(member));
- int i = 0;
- while (i < NumCandidateSignals - 1) { // sic
+ for (int i = 0; i < NumCandidateSignals; ++i)
if (QMetaObject::checkConnectArgs(candidateSignal(i), normalizedMember))
- break;
- ++i;
- }
- return candidateSignal(i);
+ return candidateSignal(i);
+
+ // otherwise, use fit-all accepted signal:
+ return SIGNAL(accepted());
}
QT_BEGIN_NAMESPACE