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. Draw numbers when you're using QgraphicsView and QGraphicsScene
QtWS25 Last Chance

Draw numbers when you're using QgraphicsView and QGraphicsScene

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 3 Posters 632 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.
  • D Offline
    D Offline
    deleted396
    wrote on last edited by
    #1

    Hello friends.

    I have in my UI a QGraphicsView in that i am using QGraphicsScene to show a pic. Also, upon the pic i am drawing lines to separate the pic in cells.

    However, i have to draw a number when the user click upon the imagen. For example, if you click the first time, in the position i have to draw a number one, with the second time click, i have to draw a number two...

    Does someone know how i can do that?

    jsulmJ 1 Reply Last reply
    0
    • D deleted396

      Hello friends.

      I have in my UI a QGraphicsView in that i am using QGraphicsScene to show a pic. Also, upon the pic i am drawing lines to separate the pic in cells.

      However, i have to draw a number when the user click upon the imagen. For example, if you click the first time, in the position i have to draw a number one, with the second time click, i have to draw a number two...

      Does someone know how i can do that?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @AdrianCruz http://doc.qt.io/qt-5/qgraphicsview.html

      QGraphicsScene scene;
      scene.addText("Hello, world!");
      
      QGraphicsView view(&scene);
      view.show();
      

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi,

        Keep a counter that you increment each time you click on the scene. Once that done, add a new text item as @jsulm suggested and position it accordingly where the click happened.

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • D Offline
          D Offline
          deleted396
          wrote on last edited by
          #4

          thanks so much! Now is working :)

          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