nomovok-opensource / cutedriver-agent_qt

Other
6 stars 12 forks source link

taslayouttraverse does not compile on Qt 5.9 or later #34

Closed jppiiroinen closed 6 years ago

jppiiroinen commented 6 years ago

taslayouttraverse.cpp: In member function ‘void TasLayoutTraverse::setGenericLayoutInfo(TasObject&, QLayoutItem*)’: taslayouttraverse.cpp:150:83: error: call of overloaded ‘addAttribute(const char [20], Qt::Orientations)’ is ambiguous objectInfo.addAttribute("expandingDirections", item->expandingDirections()); ^ In file included from taslayouttraverse.h:30:0, from taslayouttraverse.cpp:31: ../../tascore/corelib/tasqtdatamodel.h:105:19: note: candidate: TasAttribute& TasObject::addAttribute(const QString&, int) TasAttribute& addAttribute(const QString& name, int value); ^ ../../tascore/corelib/tasqtdatamodel.h:106:19: note: candidate: TasAttribute& TasObject::addAttribute(const QString&, qreal) TasAttribute& addAttribute(const QString& name, qreal value); ^ taslayouttraverse.cpp:151:63: error: call of overloaded ‘addAttribute(const char [10], Qt::Alignment)’ is ambiguous objectInfo.addAttribute("alignment", item->alignment()); ^ In file included from taslayouttraverse.h:30:0, from taslayouttraverse.cpp:31: ../../tascore/corelib/tasqtdatamodel.h:105:19: note: candidate: TasAttribute& TasObject::addAttribute(const QString&, int) TasAttribute& addAttribute(const QString& name, int value); ^ ../../tascore/corelib/tasqtdatamodel.h:106:19: note: candidate: TasAttribute& TasObject::addAttribute(const QString&, qreal) TasAttribute& addAttribute(const QString& name, qreal value); ^ taslayouttraverse.cpp: In member function ‘void TasLayoutTraverse::addGraphicsLayoutItem(TasObject&, QGraphicsLayoutItem*, QGraphicsItem*)’: taslayouttraverse.cpp:221:84: error: call of overloaded ‘addAttribute(const char [20], Qt::Orientations)’ is ambiguous objectInfo.addAttribute("expandingDirections", policy.expandingDirections()); ^ In file included from taslayouttraverse.h:30:0, from taslayouttraverse.cpp:31: ../../tascore/corelib/tasqtdatamodel.h:105:19: note: candidate: TasAttribute& TasObject::addAttribute(const QString&, int) TasAttribute& addAttribute(const QString& name, int value); ^ ../../tascore/corelib/tasqtdatamodel.h:106:19: note: candidate: TasAttribute& TasObject::addAttribute(const QString&, qreal) TasAttribute& addAttribute(const QString& name, qreal value); ^ Makefile:1102: recipe for target 'taslayouttraverse.o' failed make[2]: *** [taslayouttraverse.o] Error 1

The code compiles with Qt 5.9.0, but not with Qt 5.9.1 or Qt 5.9.2.

jppiiroinen commented 6 years ago

Workaround is to disable the layouttraverse with following: `diff --git a/traversers/traversers.pro b/traversers/traversers.pro index a1006b3..74fb28f 100644 --- a/traversers/traversers.pro +++ b/traversers/traversers.pro @@ -23,7 +23,9 @@ SUBDIRS += qttraverser

SUBDIRS += viewitemtraverser

+!CONFIG(no_layout) { SUBDIRS += layouttraverser +}

SUBDIRS += scenegraphtraverser

` and then compile with: qmake -r CONFIG+=no_layout CONFIG+=no_webkit

jppiiroinen commented 6 years ago

Raised a ticket to Qt Project for this as well: https://bugreports.qt.io/browse/QTBUG-63688

jppiiroinen commented 6 years ago

This was actually verified with an example snippet that the issue was with Qt 5.8 > Qt 5.9 change.

The actually root cause was that there was a change which changed the type from int to uint. Instead of having Qt version specific hack there, there is now a commit which adds a function for uint.