Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved item's line width also zoomed after zoom QGraphicsView

    General and Desktop
    2
    3
    1280
    Loading More Posts
    • 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.
    • joeQ
      joeQ last edited by

      we all know, QGraphicsView, QGraphicsScene is good way to show graphics item.

      In Scene, i add some rect items with QGraphicsRectItem. i set the line width is 2..

      View has the matrix. i use the matrix to zoomin and zoomout.

      when i zoomed. i find the line width also zoomed when you see with your eyes. i don't want this result. i also know that set the line width 0, and the line width always is 1. this is line. but, if i fill rect.

      i want to set the line width or rect area always is fixed in screen when you to see it after zoom view.

      Thank u .Happy Valentine's Day

      Just do it!

      joeQ 1 Reply Last reply Reply Quote 0
      • joeQ
        joeQ @joeQ last edited by joeQ

        @joeQ

        I think i saved it.

        The item also zoomed after view set matrix. because item is on the scene. the scene is not zoom.
        we just zoom the view when we see the scene from eyes. it just like you to read one book with
        magnifier. the line of character is also can be zoom.

        so, if you don't want to this. i think the better way is to zoom the scene content not the view,
        not use the matrix to zoom view.

        when you want to zoomin:

        1. get the sceneRect, and zoomin the sceneRect's width and height, reset it to scene;
        2. clear all the item in scene, because, you should resize them and readd them to scene;

        zoomout is same with zoomin;

        zoom the content not the view.

        That's all.


        last method was stupid.

        Please to see my another post. maybe good way

        Just do it!

        1 Reply Last reply Reply Quote 0
        • K
          KapitanPL last edited by

          To all who finds this as first google result.

          The answer to this question is

          QPen pen;
          pen.setCosmetic(true);

          1 Reply Last reply Reply Quote 0
          • First post
            Last post