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

  • Home
  • SEARCH
  • 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 8061399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:19:35+00:00 2026-06-05T10:19:35+00:00

I am drawing a line in an object derived from QWidget. I can set

  • 0

I am drawing a line in an object derived from QWidget. I can set the pen to draw a line in the color of my choice. What I want to be able to do is change the color of the pen when it’s current y coordinate is above a specified value.

One option is simply to split the line I want to draw into two separate halves; split where the y coordinate is above the specified value. While there is nothing wrong with this method, I was hoping that there was a simpler method I could use.

What I want to be able to do is basically extend the drawline function. I want to be able to change the drawing algorithm so that, for each pixel it wants to set the color of, it will check which color to use based on a supplied function.

  • 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-06-05T10:19:37+00:00Added an answer on June 5, 2026 at 10:19 am

    I would not recommend to overload the basic drawing algorithm. I think it be more easy to use a QGradient when drawing the line?

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

Sidebar

Related Questions

I want to use core-plot for drawing line graph dynamically. data won't come at
In my program I want to draw a simple score line graph. I have
I'm drawing a line using this code: this.graphics.moveTo(posx, posy); this.graphics.lineTo(2*posx,2*posy); But now I want
Using System.Drawing.Printing, I want to print a set of lines on print document. But
I'm developing a retained mode drawing application in GDI+. The application can draw simple
I'm creating an application where the user can draw a line on a screen
This is my drawing code to draw a custom line with mouse onto a
Can anyone please help. Im following a tutorial on drawing primitives from the MSDN
I am drawing line using bezier curve and i need to convert that bezier
I am playing with a simple tutorial for drawing line in HTML5 canvas. Since,

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.