Results 1 to 5 of 5

Thread: Problem with Editable QTreeWidgetItem

  1. #1
    Join Date
    Mar 2009
    Posts
    3
    Thanks
    2

    Default Problem with Editable QTreeWidgetItem

    Hello,

    I am using a QTreeWidget with QTreeWidgetItem. My Widget Items have many columns but I want only the first column to be editable... How do I do that? For now, it seems that if I set the Flag to Editable, all the row is editable.

    Thanks!

    Marc-Andre

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem with Editable QTreeWidgetItem

    you can create delegate and return an editor only for first column,for other just return "0".
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  3. #3
    Join Date
    Mar 2009
    Posts
    3
    Thanks
    2

    Default Re: Problem with Editable QTreeWidgetItem

    Where is there information about "delegate". I am not familiar with the concept. I checked that QTreeWidget and QTreeWidgetItem but there is nothing about that. It seems that the concept is more present in QTreeView...

  4. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem with Editable QTreeWidgetItem

    take a look at this example QTDIR/examples/itemviews/spinboxdelegate and QItemDelegate. QTreeWidget inherits setItemDelegate method.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

  5. #5
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Problem with Editable QTreeWidgetItem

    you can also remove Qt::ItemIsEditable for items when you populate a tree.
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

Similar Threads

  1. Weird problem: multithread QT app kills my linux
    By Ishark in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2008, 09:12
  2. Steps in solving a programming problem?
    By triperzonak in forum General Programming
    Replies: 8
    Last Post: 5th August 2008, 08:47
  3. QTreeWidget - Making a Column editable.
    By Preeteesh in forum Qt Programming
    Replies: 1
    Last Post: 16th June 2007, 12:02
  4. QTreeWidgetItem swap or move up one level problem
    By patrik08 in forum Qt Programming
    Replies: 2
    Last Post: 24th September 2006, 18:34
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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.