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. [Solved] Graphics definition on a PC
Forum Update on Monday, May 27th 2025

[Solved] Graphics definition on a PC

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

    Hi,

    Sorry I just post the same topic but in french (my mistake).
    I am new in Qt and I want to draw and view small solid circles on a PC screen.
    I use QGraphicsScene and addEllipse. It is working fine but I have an issue with the definition on the screen which seems nnot so good for small circles (8 to 10 pixels)
    I wonder if it is possible to tune the definition on the screen for a window.
    Am I using the right module/class (QGraphicsScreen) or should I use something different?
    Thanks for your advices

    1 Reply Last reply
    0
    • A Offline
      A Offline
      Asperamanca
      wrote on last edited by
      #2

      I don't know what problem exactly you have (a screenshot would be helpful), but you can try:

      • setRenderHint(QPainter::Antialiasing) on your QGraphicsView
      • Add 0.5 to your item positions. So instead of setPos(10, 10) try setPos(10.5, 10.5)
      1 Reply Last reply
      0
      • J Offline
        J Offline
        jeffcan
        wrote on last edited by
        #3

        Thanks,
        I will try this evening.
        However, I was using QGraphicsScene / QGraphicsView with the method AddEllipse.
        I haven't seen that setrenderHint is working in this case. So following your advise, it seems that I would better take the module QPainter with drawEllipse is it correct?
        It is not clear for me when it is best to use QPainter vs QGraphicsScene

        1 Reply Last reply
        0
        • A Offline
          A Offline
          Asperamanca
          wrote on last edited by
          #4

          QGraphicsScene uses QPainter internally. If you set the RenderHint flags on the QGraphicsView, it will pass them on to the QPainter that paints the ellipse.

          The QGraphicsEllipseItem which you create using addEllipse is using QPainter::drawEllipse internally. So either way, you are using the same paint functions.

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jeffcan
            wrote on last edited by
            #5

            Thanks,
            The SetrenderHint resolved my issue

            1 Reply Last reply
            0
            • A Offline
              A Offline
              Asperamanca
              wrote on last edited by
              #6

              You are welcome.
              Please mark the topic solved by editing your original post, and put [Solved] in front of the title.

              1 Reply Last reply
              0

              • Login

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