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. Painter not painting over 32,765 px in width of QGraphicsItem/QGraphicsObject
QtWS25 Last Chance

Painter not painting over 32,765 px in width of QGraphicsItem/QGraphicsObject

Scheduled Pinned Locked Moved Unsolved General and Desktop
qpainterqgraphicsitemqgraphicsobject
3 Posts 2 Posters 482 Views
  • 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.
  • L Offline
    L Offline
    lansing
    wrote on last edited by lansing
    #1

    I have a QGraphicsItem/QGraphicsObject that's going to expand in width on scroll, and I have filled the background with a red. The problem came when my width got over 32,765 px, the painter stopped painting those area, so I ended up with no red background for the end of the item.

    mygraphicsitem.cpp

    QRectF MyItem::boundingRect() const
    {    
        return QRectF(0, 0, 33000, 40);
    }
    
    void MyItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
    {    
        QBrush redBrush(Qt::red);
        QRectF rec = boundingRect();
    
        painter->fillRect(rec, redBrush);
    
    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      https://doc.qt.io/qt-5/qpainter.html#details
      "if you are using coordinates with Qt's raster-based paint engine, it is important to note that, while coordinates greater than +/- 2^15 can be used, any painting performed with coordinates outside this range is not guaranteed to be shown; the drawing may be clipped. This is due to the use of short int in the implementation."

      I think this is what you are seeing.

      L 1 Reply Last reply
      1
      • mrjjM mrjj

        Hi
        https://doc.qt.io/qt-5/qpainter.html#details
        "if you are using coordinates with Qt's raster-based paint engine, it is important to note that, while coordinates greater than +/- 2^15 can be used, any painting performed with coordinates outside this range is not guaranteed to be shown; the drawing may be clipped. This is due to the use of short int in the implementation."

        I think this is what you are seeing.

        L Offline
        L Offline
        lansing
        wrote on last edited by
        #3

        @mrjj Thanks, so I hit the limit. I'll try not to go over that.

        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