Qt::WindowFlags f = nullptr in framworks headers
Kevin Funk
kfunk at kde.org
Fri Jan 20 08:19:21 UTC 2017
On Wednesday, 18 January 2017 21:12:07 CET Stephen Kelly wrote:
> Hello,
>
> As a result of the recent porting from 0 to nullptr, we have things like
>
> Qt::WindowFlags f = nullptr
>
> in frameworks headers. See for example kruler. That is - enum default
> parameter values have been ported incorrectly.
>
> I don't know if some clang tooling is being used to do the porting, but if
> so, the tool is buggy.
clang-tidy was used.
I don't see why the tool is buggy.
Example change from kruler.h:
- explicit KRuler(Qt::Orientation orient, QWidget *parent = 0,
Qt::WindowFlags f = 0);
+ explicit KRuler(Qt::Orientation orient, QWidget *parent = nullptr,
Qt::WindowFlags f = nullptr);
Both:
Qt::WindowFlags f = 0, and
Qt::WindowFlags f = nullptr
call this QFlags [1] ctor:
QFlags(Zero)
=> The porting was correct
If it looks odd, that might be indeed another issue. But from a technical this
is correct.
As I said on the Diff already, just port it to this if you want to:
Qt::WindowFlags = {}
Note: I'll be in vacation starting today, for 3 weeks, won't have time to
implement this.
Regards,
Kevin
[1] QFlags ctors:
Q_DECL_CONSTEXPR inline QFlags(Enum f) Q_DECL_NOTHROW : i(Int(f)) {}
Q_DECL_CONSTEXPR inline QFlags(Zero = Q_NULLPTR) Q_DECL_NOTHROW : i(0) {}
Q_DECL_CONSTEXPR inline QFlags(QFlag f) Q_DECL_NOTHROW : i(f) {}
#ifdef Q_COMPILER_INITIALIZER_LISTS
Q_DECL_CONSTEXPR inline QFlags(std::initializer_list<Enum> flags)
Q_DECL_NOTHROW
: i(initializer_list_helper(flags.begin(), flags.end())) {}
#endif
> Attempting to build the python bindings now fails because our scripting to
> generate sip files (or sip itself - I didn't investigate further because it
> seems obvious that the headers should be fixed to solve the issue) can not
> handle this.
>
> Thanks,
>
> Steve.
--
Kevin Funk | kfunk at kde.org | http://kfunk.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 163 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20170120/c68e0e0f/attachment.sig>
More information about the Kde-frameworks-devel
mailing list