Results 1 to 2 of 2

Thread: drawPoint not centered

  1. #1
    Join Date
    May 2013
    Posts
    321
    Thanks
    9
    Thanked 8 Times in 8 Posts
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default drawPoint not centered

    Hi all,
    I draw a circle with a dot inside on the center using this code :
    Qt Code:
    1. p.setBrush( Qt::NoBrush );
    2. p.setPen( Qt::white );
    3. p.drawEllipse( m_CursorPos, 5, 5 );
    4. p.drawPoint( m_CursorPos );
    To copy to clipboard, switch view to plain text mode 
    But I see the point is not centered, is it normal ?
    Thanks for the help

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: drawPoint not centered

    It is likely the result of the difference between the logical point and the actual point. Have a read of the Coordinate System. A circle of diameter 10 has no single pixel at the centre.

    You may also find difference between if m_CursorPos as QPoint or QPointF.

Similar Threads

  1. Replies: 1
    Last Post: 24th July 2010, 07:27
  2. QPainter::drawPoint ( int x, int y )
    By berliner in forum Qt Programming
    Replies: 0
    Last Post: 10th May 2010, 00:07
  3. Bar Chart centered on Labels
    By liversedge in forum Qwt
    Replies: 1
    Last Post: 30th January 2010, 19:57
  4. Why QFileDialog::getOpenFileName is not centered?
    By ricardo in forum Qt Programming
    Replies: 20
    Last Post: 30th August 2009, 23:08
  5. centered text label
    By djconnel in forum Qwt
    Replies: 5
    Last Post: 28th April 2009, 17:22

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.