summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcelo Lira <marcelo.lira@openbossa.org>2010-11-09 10:08:48 -0300
committerMarcelo Lira <marcelo.lira@openbossa.org>2010-11-09 10:52:05 -0300
commit167959faa575856b48c951fd9cc500049004cf60 (patch)
tree6685fb1d2915cf5494e7f85a3620cb6ff12f3ff2
parent4120f5e4b8a2781a917d97395b251fbc0bf8c8d8 (diff)
downloadshiboken-167959faa575856b48c951fd9cc500049004cf60.tar.gz
shiboken-167959faa575856b48c951fd9cc500049004cf60.tar.xz
shiboken-167959faa575856b48c951fd9cc500049004cf60.zip
Fixed overload decisor sorting to put QStrings after pointers to wrapped objects.
This is a special extension for Qt bindings. Since QStrings accept None values the same way object and value types accept, to avoid confusion and calling the wrong signature QString must go after object and value pointers. This wasn't a problem before, but now QString is a primitive-type and the decisor has no access to its implicit conversions, and thus can't sort it properly. Reviewed by Luciano Wolf <luciano.wolf@openbossa.org> Reviewed by Renato Ara├║jo <renato.filho@openbossa.org>
-rw-r--r--generator/overloaddata.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/generator/overloaddata.cpp b/generator/overloaddata.cpp
index 9be972f1..031c0684 100644
--- a/generator/overloaddata.cpp
+++ b/generator/overloaddata.cpp
@@ -147,6 +147,9 @@ void OverloadData::sortNextOverloads()
OverloadSortData sortData;
bool checkPyObject = false;
int pyobjectIndex = 0;
+ bool checkQString = false;
+ bool hasObjectPointer = false;
+ int qstringIndex = 0;
// Primitive types that are not int, long, short,
// char and their respective unsigned counterparts.
@@ -172,6 +175,15 @@ void OverloadData::sortNextOverloads()
if (!checkPyObject && getTypeName(ov->argType()).contains("PyObject")) {
checkPyObject = true;
pyobjectIndex = sortData.lastProcessedItemId();
+ } else if (!checkQString && getTypeName(ov->argType()) == "QString") {
+ checkQString = true;
+ qstringIndex = sortData.lastProcessedItemId();
+ if (referenceFunction()->name() == "QListWidgetItem")
+ qDebug() << ov->argType()->minimalSignature() << " checkQString: " << checkQString;
+ } else if (!hasObjectPointer && (ov->argType()->isValuePointer() || ov->argType()->typeEntry()->isObject() )) {
+ hasObjectPointer = true;
+ if (referenceFunction()->name() == "QListWidgetItem")
+ qDebug() << ov->argType()->minimalSignature() << " hasObjectPointer: " << hasObjectPointer;
}
foreach (const AbstractMetaType* instantiation, ov->argType()->instantiations()) {
@@ -267,6 +279,8 @@ void OverloadData::sortNextOverloads()
/* Add dependency on PyObject, so its check is the last one (too generic) */
if (checkPyObject && !targetTypeEntryName.contains("PyObject"))
graph.addEdge(sortData.map[targetTypeEntryName], pyobjectIndex);
+ else if (checkQString && hasObjectPointer && targetTypeEntryName != "QString")
+ graph.addEdge(sortData.map[targetTypeEntryName], qstringIndex);
if (targetTypeEntry->isEnum()) {
for (int i = 0; i < numPrimitives; ++i) {