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. Issue with using QGraphicsScene::render() with QLinearGradient
Forum Update on Tuesday, May 27th 2025

Issue with using QGraphicsScene::render() with QLinearGradient

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 1 Posters 246 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.
  • A Offline
    A Offline
    AndyBrice
    wrote on 16 May 2024, 11:04 last edited by AndyBrice
    #1

    I have a QGraphicsScene with various objects representing a table plan. When someone prints I use QGraphicsScene::render() on a QPrinter object to do the printout. This has worked fine in Qt 5 for years. But I have run into an issue with Qt 6 on Windows.

    When I QGraphicsScene::render() this:

    ddcfb628-b373-4cc9-bd41-00736b0f5fb5-image.png

    I get this:

    443c112f-604f-47ea-b62c-07997bf3b871-image.png

    The gradient just stops beyond a certain x value.

    It happens if I print to a real printer or a PDF virtual printer. Customers have reported the issue a well, so it isn't just my computer or printer.

    If I change the QLinearGradient on the seats or tables to a flat colour, the problem goes away.

    The issue occurs with Qt 6.5.5 LTS on Windows 10. Qt 6.5.5 LTS on macOS seems to work ok. The problem does not occur with Qt 5.

    Has anyone else seen this? I wanted to check before I spend ages writing a standalone program to reproduce the issue.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      AndyBrice
      wrote on 16 May 2024, 14:12 last edited by
      #2

      Digging further I think it might be that QPrinter::device()->viewport() is not updated when I call:

      QPrinter::setPageOrientation( QPageLayout::Landscape );

      1 Reply Last reply
      0
      • A Offline
        A Offline
        AndyBrice
        wrote on 20 May 2024, 10:14 last edited by
        #3

        Just me then?

        I still haven't found a solution.

        1 Reply Last reply
        0
        • A Offline
          A Offline
          AndyBrice
          wrote on 22 May 2024, 09:46 last edited by
          #4

          Problem seems to have been fixed in Qt 6.7.1.

          1 Reply Last reply
          0

          2/4

          16 May 2024, 14:12

          • Login

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