Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Draw grid in QGraphicsScene/QGraphicsView
Forum Updated to NodeBB v4.3 + New Features

Draw grid in QGraphicsScene/QGraphicsView

Scheduled Pinned Locked Moved General and Desktop
3 Posts 1 Posters 5.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    phenom64
    wrote on last edited by
    #1

    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)!

    1 Reply Last reply
    0
    • P Offline
      P Offline
      phenom64
      wrote on last edited by
      #2

      @::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

      1 Reply Last reply
      0
      • P Offline
        P Offline
        phenom64
        wrote on last edited by
        #3

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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved