C++ and Qt application to draw lines without using an already implemented algorithm