Results 1 to 13 of 13

Thread: Suggestions for particular text format in QTextEdit

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    Default Re: Suggestions for particular text format in QTextEdit

    Quote Originally Posted by wysota View Post
    You can always put the words in a table.
    This is another way I'm trying to follow. However there are two problems. Currently I'm testing use of QTextCursor and insertTable but I have a problem that, after created a new table, the cursor remain "inside" the table and every new insertion is always inside the first cell, I need a way to move the cursor out of the table for create a new table outside. Since we are on topic can you help me about this problem? However the doubt I have regarding this solution is that, if QTextEdit control use tables as same way as standard html browser do, tables can not be positioned side by side but only one per line. I still was not able to verify...

    By the way I made a picture for clarify better my needed format:

    demo.jpg

    As you cann see "block of words" have to be disposed in multiple lines as normal text but every big word must have the connected small word centered under them...

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Suggestions for particular text format in QTextEdit

    Maybe you should just state what is the final effect you are trying to achieve? Why are you using QTextEdit, is that some requirement?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3

    Default Re: Suggestions for particular text format in QTextEdit

    No, QTextEdit is the first control I thought to use but is not mandatory. My need is only that these "text blocks" must be act like standard edit control. This mean if I resize the "control" showing these text the block must to redispose automatically as a normal text do (ex. if I decrease the width of the control the blocks on the right must to moved in the line below and so on). The second need is that the text can be selected and copied into clipboard and the control is read only.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Suggestions for particular text format in QTextEdit

    This would suggest you are dealing with a list of blocks which would suggest QListView or QListWidget to be an ideal solution to your problem. Of course you have to provide a custom delegate for selecting text (unless you're not interested in selecting part of a single block but rather whole block at a time).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5

    Default Re: Suggestions for particular text format in QTextEdit

    Unfortunately I don't think QListView is a good solution mainly because not all the big words will have the same width size. Using the ListView control I have a grid with all the columns sized as the largest width element in the list that is not what I would. Just for a moment forget the presence of the "small words below the big words". In this case this will be a normal editor with standard text written using big font (like this text I'm writing). In add of this standard text every big words will have a small word below. An example could be a text written in a foreign language and below every words the meaning of the word in your language written smaller...

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Suggestions for particular text format in QTextEdit

    Quote Originally Posted by Suppaman View Post
    Unfortunately I don't think QListView is a good solution mainly because not all the big words will have the same width size.
    That is not important. Enable wrapping property and have the list flow from left to right.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7

    Default Re: Suggestions for particular text format in QTextEdit

    I'll try to follow this way too, but before I would to verify if really tables can not be aligned into the same line in QTextEdit. Someone can confirm? In add I still have the problem above using QTextTable. After inserted new table using insertTable() the cursor remain inside the first cell, how can I move the cursor outside the table just created?

    Thank you for the help

  8. #8

    Default Re: Suggestions for particular text format in QTextEdit

    Hi

    If someone is interested I found the solution. Basically I created tables with css style "float:left" that is supported by QTextEdit control. This will result to show tables in the same line and move on the next line if the edit control is resized, exactly what I need. Thank you to all for the support.

Similar Threads

  1. QTextEdit format html code
    By Edder in forum Qt Programming
    Replies: 1
    Last Post: 14th July 2012, 15:03
  2. can't get format under cursor of a QTextEdit
    By dvirtz in forum Qt Programming
    Replies: 4
    Last Post: 1st November 2011, 12:12
  3. Problem with Qtextedit format - hex viewing
    By daro21 in forum Qt Programming
    Replies: 1
    Last Post: 6th June 2011, 19:18
  4. Support for .rtf format in QTextDocument or QTextEdit?
    By LynneV in forum Qt Programming
    Replies: 1
    Last Post: 13th September 2010, 23:01
  5. QTextEdit current cursor text format
    By afail in forum Qt Programming
    Replies: 0
    Last Post: 13th April 2009, 14:24

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.