Results 1 to 2 of 2

Thread: How can I center a checkbox in a treeview?

  1. #1
    Join Date
    Jun 2009
    Posts
    4
    Thanks
    1
    Qt products
    Platforms
    MacOS X Windows

    Default How can I center a checkbox in a treeview?

    Hi everyone, I've writing a custom Model/View, and I have a checkbox in the third column using the Qt::ItemIsUserCheckable flag. But I can't get the checkbox centered in the column. It is always aligned to the left. The Qt:TextAlignmentRole only apply to text, not checkbox.

    Could any one give me a hint. Thanks!

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How can I center a checkbox in a treeview?

    You can use delegates and center the check box.
    Search in the forum, this has been discussed many times.

Similar Threads

  1. QTableView checkbox center with stylesheet
    By quiet in forum Qt Programming
    Replies: 2
    Last Post: 10th March 2011, 13:52
  2. boolean field checkbox QTableView
    By skuda in forum Qt Programming
    Replies: 4
    Last Post: 8th November 2010, 13:48
  3. QTreeView: How to center a checkbox in a cell
    By chezifresh in forum Qt Programming
    Replies: 3
    Last Post: 19th December 2008, 12:11
  4. Need some help re-painting a checkbox
    By JimDaniel in forum Qt Programming
    Replies: 2
    Last Post: 25th January 2008, 16:08
  5. checkbox
    By nErnie in forum Qt Programming
    Replies: 1
    Last Post: 25th September 2006, 21:59

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
  •  
Qt is a trademark of The Qt Company.