Results 1 to 4 of 4

Thread: Button in TreeWidgetItem

  1. #1
    Join Date
    Nov 2008
    Posts
    21
    Thanked 1 Time in 1 Post

    Default Button in TreeWidgetItem

    Hello,

    I use a QTreeWidget to display a list with multiple columns (replacement of the Q3ListView).

    It has to be possible to change the content of one of the columns (a dilaog has to be appear).

    Now, the user can click the cell and the dialog appears, but the user has to know that, otherwise he does not know how to change the content.

    That's why I'd like to insert a button at the end of this column, similar to dialogs of MS Visual Studio for example (see attachement).

    The QTreeWidgetItem has only a setICon() method, I need something like a setWidget() method.

    What would be an easy way to bring that button into the item?
    Attached Images Attached Images

  2. #2
    Join Date
    May 2008
    Posts
    61
    Thanks
    9
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Button in TreeWidgetItem

    Hi osiris81,

    You can use the QItemDelegate class to create your own editor widget for the QTableWidget.

    You can check the Spin Box Delegate Example.

    alisami

  3. #3
    Join Date
    Nov 2008
    Posts
    21
    Thanked 1 Time in 1 Post

    Default Re: Button in TreeWidgetItem

    Thank you alisami!

    I tried the example and it looks good, just one thing:

    The item changes it's view only when I activate it (by doubleclicking for example). Is it possible to show the item always in this "state"?

  4. #4
    Join Date
    Nov 2008
    Posts
    21
    Thanked 1 Time in 1 Post

    Default Re: Button in TreeWidgetItem

    Sorry, I just found it:


    void openPersistentEditor ( const QModelIndex & index )

Similar Threads

  1. button background color when it is clicked
    By navi1084 in forum Qt Programming
    Replies: 4
    Last Post: 9th December 2008, 15:02
  2. button with backgr and icon using stylesheets
    By s_p_t10 in forum Qt Programming
    Replies: 0
    Last Post: 7th May 2008, 20:19
  3. problem about mouse button events
    By vql in forum Qt Programming
    Replies: 1
    Last Post: 29th April 2008, 10:14
  4. question about button
    By narumi in forum Newbie
    Replies: 2
    Last Post: 21st January 2008, 05:44
  5. Push button double click
    By curtisw in forum Qt Programming
    Replies: 3
    Last Post: 15th February 2006, 16: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.