Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 762079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:54:53+00:00 2026-05-14T15:54:53+00:00

I am rendering a QPixmap inside of a QThread. the code to paint is

  • 0

I am rendering a QPixmap inside of a QThread. the code to paint is inside a function. If I declare the painter inside the drawChart function everything seems ok but if I declare the painter inside the run function the image is wrong in the sense that at the edge of a black and white area, the pixels at the interface are overlapped to give a grey. Does anyone know why this is so? Could it be because of the nature of the run function itself?

//This is ok  
void RenderThread::run()  
{  
  QImage image(resultSize, QImage::Format_RGB32);  
  drawChart(&image);  
  emit renderedImage(image, scaleFactor);  
}

drawChart(&image)  
{  
  QPainter painter(image);
  painter.doStuff()(;  
  ...  
}  

//This gives a image that seems to have artifacts  
void RenderThread::run()  
{  
  QImage image(resultSize, QImage::Format_RGB32);  
  QPainter painter(image);  
  drawChart(painter);  
  emit renderedImage(image, scaleFactor);  
}  

drawChart(&painter)
{   
  painter.doStuff();    
  ...  
}

//bad
Valid XHTML.
//good
Valid XHTML.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:54:53+00:00Added an answer on May 14, 2026 at 3:54 pm

    From C++ GUI Programming with Qt 4 by Jasmin Blanchette and Mark Summerfield:

    One important thing to understand is
    that the center of a pixel lies on
    “half-pixel” coordinates. For example,
    the top-left pixel covers the area
    between points (0, 0) and (1, 1), and
    its center is located at (0.5, 0.5).
    If we ask QPainter to draw a pixel at,
    say, (100, 100), it will approximate
    the result by shifting the coordinate
    by +0.5 in both directions, resulting
    in the pixel centered at (100.5,
    100.5) being drawn.

    This distinction may seem rather
    academic at first, but it has
    important consequences in practice.
    First, the shifting by +0.5 only
    occurs if antialiasing is disabled
    (the default); if antialiasing is
    enabled and we try to draw a pixel at
    (100, 100) in black, QPainter will
    actually color the four pixels (99.5,
    99.5), (99.5, 100.5), (100.5, 99.5), and (100.5, 100.5) light gray, to give
    the impression of a pixel lying
    exactly at the meeting point of the
    four pixels. If this effect is
    undesirable, we can avoid it by
    specifying half-pixel coordinates, for
    example, (100.5, 100.5).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

After rendering a view on a Post, a call to RenderAction inside the view
let mtvCapView = Rendering.MTViewerCaptureViewProvider(subRead) let image = Image() let imageBinding = Data.Binding(ImageElement) imageBinding.Source <-
I am rendering a rails partial and I want to alternate the background color
I'm having major rendering issues in Safari with the web application I'm working on.
If I'm rendering a regular view in asp.net mvc the only domain object properties
I am rendering an OpenGL scene that include some bitmap text. It is my
I am actually rendering an excel file in the browser. I use the Response.Writefile(filePath)
I'm rendering some HTML in a QT QLabel. The HTML looks like this: <pre>foo\tbar</pre>
Are there any noted differences in appearance rendering of HTML and XHTML in Google
I'm not happy with the rendering of HTML by Swing's JEditorPane. In particular bullets

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.