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. How to get text from the scene in new class
Qt 6.11 is out! See what's new in the release blog

How to get text from the scene in new class

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 1.7k Views 1 Watching
  • 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.
  • S Offline
    S Offline
    ShrikantAmbade
    wrote on last edited by
    #1

    Hello everyone ,

    How to get text item form the scene
    many Thanks

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi

      QList<QGraphicsItem *> list = scene->items();
      foreach( QGraphicsItem * item, list )
      {
          if( QGraphicsTextItem * TextItem = qgraphicsitem_cast<QGraphicsTextItem *>( item ) )
          {
          TextItem-> ..... 
          }
      }
      
      S 1 Reply Last reply
      1
      • jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Sorry, but I have no idea what you are asking!
        What is scene?
        Which text? Where is this text stored? What do you mean by "new class"?

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

        S 1 Reply Last reply
        0
        • mrjjM mrjj

          Hi

          QList<QGraphicsItem *> list = scene->items();
          foreach( QGraphicsItem * item, list )
          {
              if( QGraphicsTextItem * TextItem = qgraphicsitem_cast<QGraphicsTextItem *>( item ) )
              {
              TextItem-> ..... 
              }
          }
          
          S Offline
          S Offline
          ShrikantAmbade
          wrote on last edited by
          #4

          @mrjj Thanks for reply... but I think Why we are not using list as list has all the items from the window scene like this

          QList<QGraphicsItem *> list = scene->items();
          foreach( QGraphicsItem * item, list )
          {
              if( QGraphicsTextItem * TextItem = qgraphicsitem_cast<QGraphicsTextItem *>( list ) )
              {
              TextItem-> ..... 
              }
          }
          
          1 Reply Last reply
          0
          • jsulmJ jsulm

            Sorry, but I have no idea what you are asking!
            What is scene?
            Which text? Where is this text stored? What do you mean by "new class"?

            S Offline
            S Offline
            ShrikantAmbade
            wrote on last edited by
            #5

            @jsulm scene is my display window and if i write on my scene some text. I want to read that text when I read all the items() from the scene

            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