Results 1 to 3 of 3

Thread: Something like putting dash every new line in QTextEdit

  1. #1
    Join Date
    Sep 2010
    Location
    Poland
    Posts
    112
    Thanks
    8
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Something like putting dash every new line in QTextEdit

    I once saw the thread here where someone was looking for something similar like formatting text on fly.

    What I want to achieve is to detect whenever 'Enter' is clicked and start new line with the dash at it's beginning ? What I really want to achieve is TODO list

    I can not find this thread and I do know which class could be used to achieve my goal.

    probably QTextCursor may help here, will see.
    Scenario like this maybe
    1. connect textChanged() signal
    2. using QTextCursor check code of the last entered char
    3. if it is new line code than put new line and start new line with dash ?

    No I failed to came up with something working use the scenario above
    Last edited by kornicameister; 5th February 2011 at 14:33.
    My schedule makes my cry
    My works makes my laugh
    My life makes... oh...no....

  2. #2
    Join Date
    Apr 2009
    Posts
    5
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Something like putting dash every new line in QTextEdit

    There are several possibilities. Maybe you could just use QTextEdit::AutoBulletList as the formatting mode. Or if that's not enough,
    subclass QTextEdit and reimplement keyPressEvent(), then add the dash whenever the return key is pressed.

  3. #3
    Join Date
    Sep 2010
    Location
    Poland
    Posts
    112
    Thanks
    8
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: Something like putting dash every new line in QTextEdit

    I found it before I read your reply, thanks anyway
    But now I am thinking how to insert first dot using the code only
    My schedule makes my cry
    My works makes my laugh
    My life makes... oh...no....

Similar Threads

  1. Replies: 0
    Last Post: 8th December 2010, 22:32
  2. QTextEdit End-of-Line character
    By smhall316 in forum Newbie
    Replies: 1
    Last Post: 29th September 2010, 18:28
  3. Single line QTextEdit
    By Arthur in forum Qt Programming
    Replies: 1
    Last Post: 30th August 2010, 21:04
  4. Modifying a line in a QTextEdit
    By elcuco in forum Qt Programming
    Replies: 1
    Last Post: 15th March 2008, 16:50
  5. Line Number - QTextEdit...???
    By deepusrp in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2007, 16:34

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.