I've experienced the same running the Qt example "elastic nodes", which is one of the Graphics View examples. You can reproduce the diagonal line by zooming in (using '+' or the mouse wheel), until the frame rectangle is outside the visible area.
Workaround: deactivate the background cache (graphwidget.cpp, constructor, remove the line "setCacheMode(CacheBackground);"), compile, run => no diagonal line.
Btw, I'm using Qt 4.8.5.
I just had a look at the Qt bug tracker and found QTBUG-31579, where unexpected things are drawn when using a pen width of 0, so I tried modifying the elastic nodes example by drawing the rectangle with an explicit pen of 1 pt width, which gave me the expected result even with the background cache enabled. Since it seems they are working on that problem, it should be solved with the next Qt release.
Sorbet, if you need a solution more quickly, you could try to set an explicit pen of nonzero with when drawing.
Hope this works for you.