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. Custom Shaped (Plain)TextEdit Or Custom WrapMode
Forum Updated to NodeBB v4.3 + New Features

Custom Shaped (Plain)TextEdit Or Custom WrapMode

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 471 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.
  • B Offline
    B Offline
    Brad1111
    wrote on last edited by
    #1

    Hello,
    I tried to find out on my own but really couldnt find any solution so far.
    I am trying to have a TextEdit Box like a notepad, but I dont want a rectangular form.
    For example I might want to insert text in like a triangle shaped textedit.
    Or lets imagine simply a rectangle but with a custom linewrapmode where it has different width for every line and could define a triangle in that way as well. For example, if line 0, I set linewrapmode to 50 width, line 1 -> 45 width, line2-> 40 width, line3-> 35 width, It will ultimately give me a custom shaped textedit as well, but the only options available are full WidgetWidth or NoWrap at all.
    Anyway to customize that linewrapmode or to create a custom shaped textbox ?

    Thanks

    1 Reply Last reply
    0
    • I Offline
      I Offline
      IgKh
      wrote on last edited by
      #4

      It is very possible, but not easy. To shape a single paragraph into a custom shape you use QTextLayout directly, and there is an example in the Qt documentation. To make an editor that has an unusual shape for the text, your are going to need to use QTextEdit with a custom implementation of QAbstractTextDocumentLayout. Good luck, you'll need it.

      B 1 Reply Last reply
      2
      • B Offline
        B Offline
        Brad1111
        wrote on last edited by Brad1111
        #2

        any help pls ?
        Summary :
        Having a Text area with different margins on the left or right would look like this :

        This is some example text and I want it
        .............to display for example like this
        ..........................because I chose to. But I
        .......................................dont know how to
        ..................................................define it with
        .................................................................QT.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          Brad1111
          wrote on last edited by
          #3

          still no idea how to create a circle shaped textedit for example.
          Not just borders but with the cursor following the shape.
          If someone knows how to do this, please let me know

          1 Reply Last reply
          0
          • I Offline
            I Offline
            IgKh
            wrote on last edited by
            #4

            It is very possible, but not easy. To shape a single paragraph into a custom shape you use QTextLayout directly, and there is an example in the Qt documentation. To make an editor that has an unusual shape for the text, your are going to need to use QTextEdit with a custom implementation of QAbstractTextDocumentLayout. Good luck, you'll need it.

            B 1 Reply Last reply
            2
            • I IgKh

              It is very possible, but not easy. To shape a single paragraph into a custom shape you use QTextLayout directly, and there is an example in the Qt documentation. To make an editor that has an unusual shape for the text, your are going to need to use QTextEdit with a custom implementation of QAbstractTextDocumentLayout. Good luck, you'll need it.

              B Offline
              B Offline
              Brad1111
              wrote on last edited by
              #5

              @IgKh ahhh Thank you ! I'll mark this as solution :)

              1 Reply Last reply
              0
              • B Brad1111 has marked this topic as solved on

              • Login

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