Results 1 to 3 of 3

Thread: QTableWidgetItem Text Editing

  1. #1
    Join Date
    Jan 2006
    Location
    Ohio
    Posts
    332
    Thanks
    37
    Thanked 8 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Red face QTableWidgetItem Text Editing

    I have a QTableWidget set up the way I want it and I have it set up so I cannot edit the first column of text and can edit the second column of text.

    Whenever I edit the text in the 2nd column of QTableWidgetItems, if the text exceeds the width of the column, the text on the left is shifted over so I cannot see it and can keep entering text on the right. How do I get it to work so that it displays a 2nd line while I edit it and then once I leave the cell or hit Enter, it moves it back to the single line with part of it invisible. When I edit text, I want it to work like a QTextEdit in that it will wrap to another line, but then when I leave the cell to display like a QLineEdit. I have tried QTableView::setWordWrap( true ) but that didn't work. Thanks!

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: QTableWidgetItem Text Editing

    I guess you could make a custom delegate whose createEditor() returns a QTextEdit instead of QLineEdit.
    J-P Nurmi

  3. #3
    Join Date
    Mar 2009
    Posts
    1
    Qt products
    Platforms
    Windows

    Default Re: QTableWidgetItem Text Editing

    ToddAtWSU,

    I need to do exactly the same thing. Did this method work for you? Do you have an example handy?

Similar Threads

  1. Unhandled exception in qatomic
    By NewGuy in forum Qt Programming
    Replies: 14
    Last Post: 23rd July 2013, 09:49
  2. QTextEdit slow to insert text
    By thomaspu in forum Qt Programming
    Replies: 4
    Last Post: 10th January 2008, 12:05
  3. Setting a highlight text color for QTableWidgetItem
    By Hiba in forum Qt Programming
    Replies: 6
    Last Post: 14th December 2007, 10:51
  4. Editable text in QGraphicsView
    By wysota in forum Qt Programming
    Replies: 8
    Last Post: 24th February 2007, 15:30
  5. Auto text select in QTableWidgetItem
    By tstankey in forum Newbie
    Replies: 2
    Last Post: 5th October 2006, 20:40

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.