*facepalm*
Unless Qt supports negative indexes (like python's [-1]) I would have thought this would be an int. Thanks for catching that everyone.
BTW: I meant to do:
quint32 foregroundColor = reverseHist[foregroundPixels];
So it was good I appened attentiont to the warning.
Sent: Friday, May 03, 2019 at 10:58 AM
From: "Mike Chinander" <chinan...@gmail.com>
To: "interestqt-project.org" <interest@qt-project.org>
Subject: Re: [Interest] Operator QMap<uint, uint>[] is casting to int?On that last line you're indexing a QList which takes an int for its argument._______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interestOn Fri, May 3, 2019 at 9:44 AM Jason H <jh...@gmx.com> wrote:Given the code below:
QMap<uint, uint> reverseHistogram;
...
QList<uint> reverseKeys = reverseHistogram.keys();
int foregroundIndex = reverseHistogram.size()-2; // arg, QMap::size() returns signed
uint foregroundPixels = reverseKeys[foregroundIndex];
uint foregroundColor = reverseKeys[foregroundPixels];
uint foregroundColor = reverseKeys[foregroundPixels]; //main.cpp:66:37: warning: implicit conversion changes signedness: 'uint' (aka 'unsigned int') to 'int'
Where is the "signed" conversion happening?
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest
_______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest