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. NodeEditor adding TextInput
Forum Updated to NodeBB v4.3 + New Features

NodeEditor adding TextInput

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 1.1k 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.
  • YunusY Offline
    YunusY Offline
    Yunus
    wrote on last edited by Yunus
    #1

    Hi,
    I found a project on internet about node editor which is used QGraphicsScene. and I'm new on this. I need to add a TextInput on the window(which is in the picture) to be able to take values from user. But I don't know how to do. Do you have any idea? Ty.

    0_1548937412690_Screenshot from 2019-01-31 15-16-55.png

    JonBJ 1 Reply Last reply
    0
    • YunusY Yunus

      Hi,
      I found a project on internet about node editor which is used QGraphicsScene. and I'm new on this. I need to add a TextInput on the window(which is in the picture) to be able to take values from user. But I don't know how to do. Do you have any idea? Ty.

      0_1548937412690_Screenshot from 2019-01-31 15-16-55.png

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @Yunus
      For a "TextInput" you can use Qt widgets like QLineEdit on your scene. You can add QWidgets via http://doc.qt.io/qt-5/qgraphicsscene.html#addWidget, which wraps them in a "graphics proxy widget" http://doc.qt.io/qt-5/qgraphicsproxywidget.html.

      1 Reply Last reply
      3
      • YunusY Offline
        YunusY Offline
        Yunus
        wrote on last edited by
        #3

        @JonB
        Ty you for ur reply JonB. But can you give an example how to do that. I added a QWidget to my app as you said but the rest is complex for me.

        0_1548939834291_Screenshot from 2019-01-31 16-00-14.png

        JonBJ 1 Reply Last reply
        0
        • YunusY Yunus

          @JonB
          Ty you for ur reply JonB. But can you give an example how to do that. I added a QWidget to my app as you said but the rest is complex for me.

          0_1548939834291_Screenshot from 2019-01-31 16-00-14.png

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #4

          @Yunus
          Sorry, I have never used QGraphicsScene. But if you claim the code you show adds a QWidget it does not, you have no call to QGraphicsScene::addWidget()...

          1 Reply Last reply
          3
          • YunusY Offline
            YunusY Offline
            Yunus
            wrote on last edited by
            #5

            @JonB
            When I look into your link carefully, I found the solution. Thank u very much for ur help. Here is the solution:

            scene = new QGraphicsScene(this);

            QLineEdit *edit = new QLineEdit;
            QGraphicsProxyWidget *proxy = scene->addWidget(edit);
            
            edit->isVisible();  
            proxy->isVisible();
            
            mrjjM 1 Reply Last reply
            0
            • YunusY Yunus

              @JonB
              When I look into your link carefully, I found the solution. Thank u very much for ur help. Here is the solution:

              scene = new QGraphicsScene(this);

              QLineEdit *edit = new QLineEdit;
              QGraphicsProxyWidget *proxy = scene->addWidget(edit);
              
              edit->isVisible();  
              proxy->isVisible();
              
              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Yunus
              Hi
              Yes, simply give the widget to the proxy and insert proxy into scene.
              If you later find out you want to move them by mouse and have issues, please see here
              https://stackoverflow.com/questions/15413564/make-qgraphicsproxywidget-movable-selectable

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

                Hi
                Small note.
                This sample also has a text object that is not based on proxy
                http://doc.qt.io/qt-5/qtwidgets-graphicsview-diagramscene-example.html
                (it uses QGraphicsTextItem )

                1 Reply Last reply
                1
                • YunusY Offline
                  YunusY Offline
                  Yunus
                  wrote on last edited by
                  #8

                  @mrjj
                  Yes, I also saw that solution. but I dont need the whole QWidget window, the solution which I shared above is perfectly okey for me. Thak u for reply

                  1 Reply Last reply
                  1

                  • Login

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