Results 1 to 1 of 1

Thread: QTableView with Styled Item Delegate as QToolButton

  1. #1
    Join Date
    Nov 2009
    Posts
    44
    Thanks
    8
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default QTableView with Styled Item Delegate as QToolButton

    Hello, I have a QTableView with a model column that has the Qt:ecorationRole set with a small image. The cell is editable, and I want to use a QToolButton as the ItemDelegate editor widget.

    My problem is that the ItemDelegate Style option rectangle is always too wide and the button is always drawn right justified in the space. It draws the QToolButton to the right of the Qt:ecorationRole image in the table cell, and if the column is narrow enough to just fit the image width, the button is hidden under the column to the right. The column needs to be resized to show the button (see attached images). Does anyone know why? I think it should use the cell area for drawing, and superimpose the editor in the space by default. I have tried setting the SizeHintRole, setting the size directly and changing the column width. I know I can paint it any way I want. But I'd like to understand why the hierarchy of setting the default editor size chooses the size it does! Thanks in advance for any help - much appreciated.
    Attached Images Attached Images

Similar Threads

  1. QLabel as an item delegate
    By qlands in forum Qt Programming
    Replies: 13
    Last Post: 12th August 2011, 12:51
  2. Replies: 0
    Last Post: 10th March 2011, 12:44
  3. Item Delegate Visibility
    By raneeshambat in forum Newbie
    Replies: 1
    Last Post: 18th September 2009, 21:41
  4. Replies: 5
    Last Post: 10th August 2009, 11:50
  5. Delegate for a certain item?
    By somebody in forum Qt Programming
    Replies: 1
    Last Post: 18th August 2008, 23:55

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.