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. QPainter.begin

QPainter.begin

Scheduled Pinned Locked Moved Unsolved General and Desktop
qpainter
2 Posts 2 Posters 1.3k Views 2 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.
  • G Offline
    G Offline
    GrahamLa
    wrote on last edited by
    #1

    Hi
    I am using a QPainter object and call the begin and end methods.
    Both return a boolean and I wanted to know if there is a way of finding out(in code) why one these methods might return false?
    For example

    QPainter painter;
    if (!painter.begin(&printer))
    {
        //What happened
    }
    
    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by Chris Kawa
      #2

      Some of the reasons are right there in the documentation: QPainter::begin().
      Generally speaking begin() returns false when the underlying resources are unavailable - another painter is active on that device, trying to paint to a null device or image, underlying paint engine is uninitialized or non existing etc. For end() it's similar - either the painter in not active on any device or the underlying paint engine failed to end the operation for whatever reason.

      There is no API for getting the reason of failure of any of those as it would be hard to make one considering there are different paint engines and you can even make one yourself. It would have to be something really generic like a string, and having users parse that and basically expect every possible reason on every supported platform would not be a good API.

      1 Reply Last reply
      2

      • Login

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