Qt Forum

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

    Unsolved How to realized the style of Edit Box like this picture shows.

    General and Desktop
    2
    6
    773
    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.
    • brucezcg
      brucezcg last edited by brucezcg

      0_1525743610451_2018-05-08 09_39_47-Marketch(https___github.com_tudou527) - Internet Explorer.png

      How to realized this style of EditBox.
      Special txt can be auto treated as an block, and can be move or delete just like one charactor.
      Thanks

      1 Reply Last reply Reply Quote 0
      • mrjj
        mrjj Lifetime Qt Champion last edited by

        Hi
        so it must contain "boxes" like SOH ?
        also, there will also be editable text ? or just
        a collection of boxes ?
        You could use a list in iconview mode to show it like that if all boxes is same size.

        If you need it with floating/editable text also, i think you need to specify a bit more the needed
        operations on the boxes and the texts then. before i can suggest how you can make it.

        There is TextEdit with images but not sure what boxes can do. if it needs to popup menu and be closable
        as image indicates, it might not work super.

        brucezcg 1 Reply Last reply Reply Quote 1
        • brucezcg
          brucezcg @mrjj last edited by brucezcg

          @mrjj said in How to realized the style of Edit Box like this picture shows.:

          Hi
          so it must contain "boxes" like SOH ?
          also, there will also be editable text ? or just
          a collection of boxes ?
          You could use a list in iconview mode to show it like that if all boxes is same size.

          If you need it with floating/editable text also, i think you need to specify a bit more the needed
          operations on the boxes and the texts then. before i can suggest how you can make it.

          There is TextEdit with images but not sure what boxes can do. if it needs to popup menu and be closable
          as image indicates, it might not work super.

          Thanks for reply.

          1. There will be many kinds of "boxes" not only SOH, but also have NUL ACK CR LF etc. both of them are invisible characters in ASCII table.
          2. One "box" is treated as one item in the edit box.
          3. "Box" can be delete by click x
          4. "Box" can be moved in edit box as an entirety.
          5. There will be also editable text , just like:
            [SOH]hello[CR]
          mrjj 1 Reply Last reply Reply Quote 0
          • mrjj
            mrjj Lifetime Qt Champion @brucezcg last edited by mrjj

            @brucezcg
            One option is create a custom object for TextEdit
            http://doc.qt.io/qt-5/qtsvg-richtext-textobject-example.html
            But im not 100% sure you can easy get click events for it.

            Option 2 would be a custom Widget for "Box" and QLabel with
            TextInteractionFlags set to Qt::TextEditable.
            And then something like a box layout to hold them.
            But if you need to be able to drag them around also, it might be a bit clumsy
            removing and inserting into layout.

            do you need rich text formatting like bold etc ?

            brucezcg 1 Reply Last reply Reply Quote 0
            • brucezcg
              brucezcg @mrjj last edited by

              @mrjj said in How to realized the style of Edit Box like this picture shows.:

              @brucezcg
              One option is create a custom object for TextEdit
              http://doc.qt.io/qt-5/qtsvg-richtext-textobject-example.html
              But im not 100% sure you can easy get click events for it.

              Option 2 would be a custom Widget for "Box" and QLabel with
              TextInteractionFlags set to Qt::TextEditable.
              And then something like a box layout to hold them.
              But if you need to be able to drag them around also, it might be a bit clumsy
              removing and inserting into layout.

              do you need rich text formatting like bold etc ?

              Thanks, I don't need need to format the text.
              As you say, this is big effort to realize what I want

              mrjj 1 Reply Last reply Reply Quote 0
              • mrjj
                mrjj Lifetime Qt Champion @brucezcg last edited by mrjj

                @brucezcg
                Yes, its not trivial to create due to mixed box feature and editable text.
                Especially the drag around part.
                I think the textobject way will work the best.
                It can even drag the object but it seems to vanish bt i assume its fixable :)

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