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. QWT transform coordinates to pixels
Qt 6.11 is out! See what's new in the release blog

QWT transform coordinates to pixels

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

    Hi,

    I duplicate my question from QtCenter because the problem wasn't solved yet.

    I'm going to use QLinearGradient to fill area between my_line and some baseline like on the second plot from here. To do this I need to know position of every point of my_line in pixels.
    QwtPlot::canvasMap(int axisId) says: Map for the axis on the canvas. With this map pixel coordinates can translated to plot coordinates and vice versa.
    I can't anderstand which one translate or invTranslate perform the rescaling from axes (x,y) coordinate units to pixels but I tried to use them both:

        QwtScaleMap xMap = ui->qwtPlot->canvasMap(QwtPlot::xBottom); // input parameter type is "axisid" is QwtPlot::yLeft correct?
        QwtScaleMap yMap = ui->qwtPlot->canvasMap(QwtPlot::yLeft);
    
        double x2 = xMap.transform(1000.0);
        double y2 = yMap.transform(1000.0);
    

    And I get the x2 and y2 numbers that are bigger than my QMainWindow size in QDesigner.

    By the way the QwtPlot widget in QDesigner has axes limits from 0 to 1000 and after I draw the curve the limits become about from 0 to 3. How to transform axes coordinates to pixels after I draw the curve?

    I'm working on that few days and all my ideas leaked out.

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      Qwt is not an official Qt Component so you might not get any answers here (if nobody uses it )
      and in that case, I would try the QWT mailing lists.

      Please_Help_me_DP 1 Reply Last reply
      1
      • mrjjM mrjj

        Hi
        Qwt is not an official Qt Component so you might not get any answers here (if nobody uses it )
        and in that case, I would try the QWT mailing lists.

        Please_Help_me_DP Offline
        Please_Help_me_DP Offline
        Please_Help_me_D
        wrote on last edited by
        #3

        @mrjj you are right
        I tried to use mailing list yesterday but didnt understood how to do that :)
        After you wrote I found in Internet how to use mailing list and just created it
        Thank you :)

        1 Reply Last reply
        1

        • Login

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