Draw grid in QGraphicsScene/QGraphicsView



  • Hi,
    I'm using Qt 5.2 with Qt creator. I' want to draw a lot of rectangle(100 to 1 million) and fill them with 2 colors. To do this quickly I choose to

    1- fill background with one color
    2-draw the complete grid with big lines
    3-and fill each rectangle with the second color.

    !http://img11.hostingpics.net/pics/685155square2.png(exemple)!

    I've done this with direct2D and GDI, it worked well. But with Qt, I'm lost with QGraphiquesScene/view because all my rectangle need to be a square, but while extending my view I' get a weird result. With direct2D my grid size is the lowest size of my view.

    So I need your help. I'm using
    @painter->drawLines(lines.data(), lines.size());@

    What I got with QT

    !http://img11.hostingpics.net/pics/239802cute.png(exemple I got)!



  • @::drawBackground(QPainter *painter, const QRectF &rect)@

    I use rect to get the bound but it seem not work while expanding my view all going weird instead of grow up the size...

    I need a grid witch grow up with the view size .
    thanks



  • No one knows how to draw a simple grid which grow up with view ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.