Results 1 to 2 of 2

Thread: How to set the alignment in a TableView?

  1. #1
    Join Date
    Jan 2006
    Location
    La Spezia,Italy
    Posts
    77
    Thanks
    9
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default How to set the alignment in a TableView?

    Hello,I'm using the model/view architecture to render some data (strings).
    I created my model and gave it to the view and it works fine. Now a question arises:"How can i set the alignment of the displayed items?". I suppose I have to modify the QStyleOptionViewItem structure of my view but I don't know how to do. Must I create a new Style and rewrite a drawSomething function and the call setStyle?
    Thanks.

    Simone

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to set the alignment in a TableView?

    Set appropriate Qt::TextAlignmentRole in the model for items you want to have changed alignment.

  3. The following user says thank you to wysota for this useful post:

    vratojr (9th March 2006)

Similar Threads

  1. Drag an item from QTreeWidget and drop in TableView
    By steg90 in forum Qt Programming
    Replies: 8
    Last Post: 18th May 2007, 11:42
  2. tableview and layouts
    By zorro68 in forum Qt Programming
    Replies: 1
    Last Post: 10th February 2007, 17:21
  3. Regarding alignment in QTable
    By joseph in forum Qt Programming
    Replies: 4
    Last Post: 5th December 2006, 10:35
  4. TreeView, TableView
    By rbrand in forum Qt Programming
    Replies: 1
    Last Post: 4th July 2006, 08:54
  5. Modified tableview
    By dkite in forum Qt Programming
    Replies: 2
    Last Post: 14th March 2006, 01:58

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.