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. Adding a QML component to a TextArea
Forum Updated to NodeBB v4.3 + New Features

Adding a QML component to a TextArea

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 1.9k 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.
  • M Offline
    M Offline
    mh00023
    wrote on last edited by
    #1

    Hello, I was wondering if it is possible to add an interactive QML component inside a TextArea QML item? I considered a QTextObject, as it seems that QTextDocument is the underlying object that stores its data, but this seems to only suffice to show static renderings.

    Thanks!

    1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi,

      Can you explain what do you mean by interactive QML component ?
      Do you want it to be editable ?

      157

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mh00023
        wrote on last edited by
        #3

        Hello,
        By interactive, I mean that the qml component can accept mouse events and respond accordingly. I am in the exploratory phase of making an eReader for a book I'm writing. I was hoping to use a TextArea (or something similar) due to its built-in selection, highlighting and HTML parsing capabilities. I was hoping to embed an image/table or figure that the user can interact with, such as displaying an annotation when the mouse hovers over a part of an image/figure/table.

        THanks again!

        1 Reply Last reply
        0
        • p3c0P Offline
          p3c0P Offline
          p3c0
          Moderators
          wrote on last edited by
          #4

          According to your requirements TextArea indeed would be a good candidate for features that you mentioned.
          AFAIK, for the other requirement for "on hover" you can use the "linkHovered":http://qt-project.org/doc/qt-5/qml-qtquick-controls-textarea.html#linkHovered-signal signal provided the image/figure is created as a link and then with its corresponding handler you can load and display the component.
          MouseArea doesn't seem to work with TextArea even with propagateComposedEvents set to true so you are limited to use linkHovered only.

          157

          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