Results 1 to 4 of 4

Thread: How to draw lines with the right width?

  1. #1
    Join Date
    Nov 2006
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default How to draw lines with the right width?

    Hallo people,

    I'm using QGraphicsView and I have a QGraphicsScene with many QGraphicsItems that are simple lines. All the lines are horizontal, vertical or 45° inclinated.

    My problem is that on the screen some lines are painted wider than other even if all of them are created with the same width and the same inclination. This behaviour depends on the zoom applied.

    I want to make a 2D CAD application and I don't want to use antialiasing when I draw lines (is it right that all 2D CAD application don't use antialiasing in drawing lines?).

    Please suggest me a solution.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to draw lines with the right width?

    Why shouldn't CAD applications use antialiasing? Antialiasing just makes lines look smoother, it doesn't modify them in any way.

  3. #3
    Join Date
    Nov 2006
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: How to draw lines with the right width?

    I'm not sure but I think that when you zoom a group of black paralle lines in 2D CAD you dont see any gray pixels. This is evident when the lines are drawed with the width of 1 or 2 or 3 pixels on the screen.

    Maybe I'm wrong...

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,360
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to draw lines with the right width?

    If you do the scaling correctly, zooming shouldn't interfere.

Similar Threads

  1. QPainter draw rounded arrow
    By xgoan in forum Qt Programming
    Replies: 1
    Last Post: 9th November 2006, 12:32
  2. Using QGLWidget paint engine to draw regular widgtes?
    By high_flyer in forum Qt Programming
    Replies: 11
    Last Post: 9th October 2006, 12:06
  3. Howto draw stuff
    By Morea in forum Newbie
    Replies: 16
    Last Post: 7th April 2006, 12:05
  4. How to obtain the width of a QTableWidget?
    By Giel Peters in forum Qt Programming
    Replies: 3
    Last Post: 9th January 2006, 22:34
  5. Draw on a QTableWidget
    By Corran in forum Qt Programming
    Replies: 6
    Last Post: 6th January 2006, 22:17

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.