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. Embedding custom QWidgets inside a QTextEdit
QtWS25 Last Chance

Embedding custom QWidgets inside a QTextEdit

Scheduled Pinned Locked Moved General and Desktop
qtexteditqt4pyqt4
8 Posts 2 Posters 3.4k 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.
  • K Offline
    K Offline
    kfkf
    wrote on 9 Oct 2015, 19:52 last edited by kfkf 10 Sept 2015, 19:53
    #1

    Hi, I'm working on the QtConsole and I've searched wide and high to a solution to this problem, and came up empty handed.
    This feature is of a really high importance to me, and I've wasted many hours on finding a solution to it, the closest I've got is QTextObject - but with no real-life examples and pretty shaky API I don't have an idea how to approach the implementation.

    Can anyone point me to the right direction? Is it even possible?
    Thanks!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 9 Oct 2015, 20:15 last edited by
      #2

      Hi and welcome to devnet,

      If you have a design like the Kate Editor in mind, the console is outside the editing widget which seems to be the best design.

      If not, what do you have in mind ?

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

      K 1 Reply Last reply 9 Oct 2015, 20:20
      0
      • S SGaist
        9 Oct 2015, 20:15

        Hi and welcome to devnet,

        If you have a design like the Kate Editor in mind, the console is outside the editing widget which seems to be the best design.

        If not, what do you have in mind ?

        K Offline
        K Offline
        kfkf
        wrote on 9 Oct 2015, 20:20 last edited by
        #3

        @SGaist Hi SGaist, I'm working on the QtConsole, which is a "Qt-based console for working with Jupyter(IPython) kernels".
        It's emulating a console with a QTextEdit widget, which works really well - but I would like to embed custom QWidgets inside the console, which means inside the QTextEdit widget.

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 9 Oct 2015, 20:25 last edited by
          #4

          What kind of widget would you like to embed ?

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

          K 1 Reply Last reply 9 Oct 2015, 20:28
          0
          • S SGaist
            9 Oct 2015, 20:25

            What kind of widget would you like to embed ?

            K Offline
            K Offline
            kfkf
            wrote on 9 Oct 2015, 20:28 last edited by kfkf 10 Sept 2015, 20:29
            #5

            I left it open(QWidget) as I'm looking for a generic solution, but if an example can help - my first priority is a QTableView and QTreeView(think about visualizing the results of ls or os.listdir with a widget).

            1 Reply Last reply
            0
            • S Offline
              S Offline
              SGaist
              Lifetime Qt Champion
              wrote on 9 Oct 2015, 20:36 last edited by
              #6

              For the table part, you should be able to do that directly with QTextEdit with help of html or the QTextDocument API.

              Otherwise you might have to use a layout + multiple QTextEdit/QWidget in a QScrollArea.

              Another alternative might be the Graphics View framework

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

              K 1 Reply Last reply 10 Oct 2015, 08:27
              0
              • S SGaist
                9 Oct 2015, 20:36

                For the table part, you should be able to do that directly with QTextEdit with help of html or the QTextDocument API.

                Otherwise you might have to use a layout + multiple QTextEdit/QWidget in a QScrollArea.

                Another alternative might be the Graphics View framework

                K Offline
                K Offline
                kfkf
                wrote on 10 Oct 2015, 08:27 last edited by
                #7

                Thanks @SGaist, I wasn't aware of QTextTable, which seems as a reasonable solution(but still we'll have to implement the sort and search which comes for free with the QTableView).

                About multiple QTextEdit/QWidgets in a QScrollArea, besides being a bit frustrating that it's the best solution, it's actually the closest I've seen, so thank you very much!

                1 Reply Last reply
                0
                • S Offline
                  S Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on 10 Oct 2015, 20:42 last edited by
                  #8

                  One alternative might be to implement a QAbstractTextDocumentLayout

                  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

                  1/8

                  9 Oct 2015, 19:52

                  • Login

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