'QImage::setPixel does not look the same depending of the OS

I'm using the method QImage::setPixel() to draw some lines on a QImage. For example, to create a horizontal line, I'm doing this :

for(int i = x1; i <= x2; i++)
{
    this->mazeImage->setPixel(i, y1, qRgb(0,0,0));
}

This is an exemple of how it looks on my PC (Windows 10): example of lines on WindowsAs you can see, some lines looks wider than others.

And the same example on a other PC (Linux): example of lines on Linux
As you can see, the lines are perfect.

So how can I handle that and get some perfect lines also on Windows ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source