I am new to painting QGraphicsItems on a QGraphicsScene.

I am trying to paint a series of lines horizontally across a scene. I can't seem to get the lines to paint at the proper 'y' axis. No matter what 'y' coordinate I specify in the scene by explicitly setting the items position, the items appear in order from the very top left of the scene towards the bottom.

Changing the scenes alignment will change where the items paint, but I need to explicitly specifiy where the items go on the scene, ignoring the scene alignment.

I want to specify the item to paint at a specific point in the scene, but the items are always painted to the top left of the scene.

My code below:

Qt Code:
  1. QGraphicsScene *m_pqMainScene;
  2. QGraphicsItem *m_paItem[MAX_NUMBER_OF_ITEMS];
  3.  
  4. int xPos = 0, yPos = 395;
  5. int itemHeight = 15;
  6. int horizontalLineLength = (numberOfItems() * itemHeight);
  7.  
  8. // Horizontal line
  9. for (long lIndex = 1; lIndex <=numberOfFromItems(); lIndex++)
  10. {
  11. m_paItem[lIndex] = new QGraphicsLineItem(0, 0, horizontalLineLength, 0, 0);
  12. m_paItem[lIndex]->setPos(xPos, yPos);
  13. m_pqMainScene->addItem(m_paItem[lIndex]);
  14. yPos -= itemHeight;
  15. }
To copy to clipboard, switch view to plain text mode 

What am I doing wrong???

Thanks!